Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
38 | 3 | public function __invoke(...$arguments): object |
|
39 | { |
||
40 | try { |
||
41 | 3 | $arguments = Stream::of(SetInterface::class, ...$arguments); |
|
42 | 2 | } catch (InvalidArgumentException $e) { |
|
43 | 2 | $arguments = Stream::of(MapInterface::class, ...$arguments); |
|
44 | } |
||
45 | |||
46 | return $arguments |
||
47 | 2 | ->drop(1) |
|
48 | 2 | ->reduce( |
|
49 | 2 | $arguments->first(), |
|
50 | 2 | static function($structure, $element) { |
|
51 | 2 | return $structure->merge($element); |
|
52 | 2 | } |
|
66 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.