| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1 |
| Changes | 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 |
||
| 33 | 2 | public function __construct( |
|
| 34 | $command, |
||
| 35 | $permission, |
||
| 36 | array $aliases = [], |
||
| 37 | AdminGroups $adminGroupsHelper, |
||
| 38 | Connection $connection, |
||
| 39 | ChatNotification $chatNotification, |
||
| 40 | PlayerStorage $playerStorage, |
||
| 41 | LoggerInterface $logger |
||
| 42 | ) |
||
| 43 | { |
||
| 44 | 2 | parent::__construct($command, $permission, $aliases, $adminGroupsHelper); |
|
| 45 | |||
| 46 | 2 | $this->connection = $connection; |
|
| 47 | 2 | $this->chatNotification = $chatNotification; |
|
| 48 | 2 | $this->playerStorage = $playerStorage; |
|
| 49 | 2 | $this->logger = $logger; |
|
|
|
|||
| 50 | 2 | } |
|
| 51 | } |
||
| 52 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.