1 | <?php |
||
5 | abstract class AbstractUnit implements UnitInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | protected $code; |
||
11 | /** |
||
12 | * @var UnitInterface |
||
13 | */ |
||
14 | protected $parent; |
||
15 | /** |
||
16 | * @var UnitInterface[] |
||
17 | */ |
||
18 | protected $siblings = []; |
||
19 | |||
20 | /** |
||
21 | * @param string $code |
||
22 | */ |
||
23 | 56 | public function __construct($code) |
|
27 | |||
28 | /** |
||
29 | * @return string |
||
30 | */ |
||
31 | 56 | public function getCode() |
|
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 44 | public function getParent() |
|
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 32 | public function setParent(UnitInterface $parent) |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | * @var bool $addSiblingBack |
||
55 | */ |
||
56 | 20 | public function addSibling(UnitInterface $sibling, $addBack = true, $addSiblingBack = true) |
|
69 | |||
70 | /** |
||
71 | * @return UnitInterface[] |
||
72 | */ |
||
73 | 45 | public function getSiblings() |
|
77 | } |
||
78 |
This check compares calls to functions or methods with their respective definitions. If the call has more 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.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.