1 | <?php |
||
30 | class LList implements |
||
31 | Listable, |
||
32 | Immutable, |
||
33 | Countable, |
||
34 | Arrayable, |
||
35 | Invokable |
||
36 | { |
||
37 | use IsImmutable, IsArrayable; |
||
38 | |||
39 | /** |
||
40 | * @var SplDoublyLinkedList |
||
41 | */ |
||
42 | private $data; |
||
43 | |||
44 | /** |
||
45 | * LList constructor. |
||
46 | * |
||
47 | * @param array|Traversable $data The list constructor |
||
48 | */ |
||
49 | public function __construct($data) |
||
53 | |||
54 | /** |
||
55 | * Set internal data array. |
||
56 | * |
||
57 | * @param array|Traversable $data The list constructor |
||
58 | */ |
||
59 | private function setData($data) |
||
74 | |||
75 | /** |
||
76 | * Get internal data array. |
||
77 | * |
||
78 | * @return array |
||
79 | */ |
||
80 | protected function getData() |
||
84 | |||
85 | /** |
||
86 | * Invoke LList. |
||
87 | * |
||
88 | * This method is called when a LList object is invoked (called as if it were a function). |
||
89 | * |
||
90 | * @return mixed |
||
91 | */ |
||
92 | public function __invoke() |
||
101 | |||
102 | /** |
||
103 | * Count elements of an object |
||
104 | * @link http://php.net/manual/en/countable.count.php |
||
105 | * @return int The custom count as an integer. |
||
106 | * </p> |
||
107 | * <p> |
||
108 | * The return value is cast to an integer. |
||
109 | * @since 5.1.0 |
||
110 | */ |
||
111 | public function count() |
||
115 | |||
116 | } |
||
117 |
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.