Passed
Pull Request — master (#21)
by
unknown
02:07
created

ClassConfig::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 9
dl 0
loc 23
ccs 1
cts 1
cp 1
crap 1
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
declare(strict_types=1);
4
5
namespace Yiisoft\Proxy\Config;
6
7
final class ClassConfig
8
{
9 1
    public function __construct(
10
        public bool $isInterface,
11
        public string $namespace,
12
        /**
13
         * @var string[]
14
         */
15
        public array $modifiers,
16
        public string $name,
17
        public string $shortName,
18
        public string $parent,
19
        /**
20
         * @var string[]
21
         */
22
        public array $parents,
23
        /**
24
         * @var string[]
25
         */
26
        public array $interfaces,
27
        /**
28
         * @var MethodConfig[]
29
         */
30
        public array $methods,
31
    ) {
32
    }
33
}
34