Conditions | 1 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 0 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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 |
||
9 | public function __construct( |
||
10 | public readonly string $field, |
||
11 | public readonly string $type, |
||
12 | public readonly string|null $collation, |
||
13 | public readonly bool $isNull, |
||
14 | public readonly string $key, |
||
15 | public readonly string|null $default, |
||
16 | public readonly string $extra, |
||
17 | public readonly string $privileges, |
||
18 | public readonly string $comment, |
||
19 | ) { |
||
20 | } |
||
22 |