Passed
Pull Request — 0.6.x (#223)
by Shinji
01:41
created

FunctionEntry::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 8
dl 0
loc 10
rs 10
c 0
b 0
f 0

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
3
/**
4
 * This file is part of the sj-i/ package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Reli\Inspector\Output\TopLike;
15
16
final class FunctionEntry
17
{
18
    public function __construct(
19
        public string $name,
20
        public string $file,
21
        public int $lineno,
22
        public int $count_exclusive = 0,
23
        public int $count_inclusive = 0,
24
        public int $total_count_exclusive = 0,
25
        public int $total_count_inclusive = 0,
26
        public float $percent_exclusive = 0,
27
    ) {
28
    }
29
}
30