1 | <?php |
||
16 | abstract class AbstractCollection implements CollectionInterface |
||
17 | { |
||
18 | /** |
||
19 | * Ensure all elements of a collection exists in this collection |
||
20 | * |
||
21 | * Return true if the collection has changed, and false if it hasn't |
||
22 | * |
||
23 | * @param CollectionInterface $collection |
||
24 | * @return bool |
||
25 | */ |
||
26 | public function addAll(CollectionInterface $collection): bool |
||
30 | |||
31 | /** |
||
32 | * Ensure all elements of an array exists in this collection |
||
33 | * |
||
34 | * Return true if the collection has changed, and false if it hasn't |
||
35 | * |
||
36 | * @param array $collection |
||
37 | * @return bool |
||
38 | */ |
||
39 | public function addAllArray(array $collection): bool |
||
48 | |||
49 | /** |
||
50 | * Returns true if the collection contains all elements from another collection |
||
51 | * |
||
52 | * @param CollectionInterface $collection |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function containsAll(CollectionInterface $collection): bool |
||
59 | |||
60 | /** |
||
61 | * Returns true if the collection contains all elements from an array |
||
62 | * |
||
63 | * @param array $collection |
||
64 | * @return bool |
||
65 | */ |
||
66 | public function containsAllArray(array $collection): bool |
||
76 | |||
77 | /** |
||
78 | * Returns the size of the collection |
||
79 | * |
||
80 | * @return int |
||
81 | */ |
||
82 | public function count(): int |
||
86 | |||
87 | /** |
||
88 | * Returns true if the collection is empty |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | public function isEmpty(): bool |
||
96 | |||
97 | /** |
||
98 | * Remove all items in a collection from this collection |
||
99 | * |
||
100 | * Returns true if the collection was modified |
||
101 | * |
||
102 | * @param CollectionInterface $collection |
||
103 | * @return bool |
||
104 | */ |
||
105 | public function removeAll(CollectionInterface $collection): bool |
||
109 | |||
110 | /** |
||
111 | * Remove all items in an array from this collection |
||
112 | * |
||
113 | * Returns true if the collection was modified |
||
114 | * |
||
115 | * @param array $collection |
||
116 | * @return bool |
||
117 | */ |
||
118 | public function removeAllArray(array $collection): bool |
||
127 | |||
128 | /** |
||
129 | * Remove all items from this collection that don't exist in specified collection |
||
130 | * |
||
131 | * Returns true if the collection was modified |
||
132 | * |
||
133 | * @param CollectionInterface $collection |
||
134 | * @return bool |
||
135 | */ |
||
136 | public function retainAll(CollectionInterface $collection): bool |
||
140 | |||
141 | /** |
||
142 | * Remove all items from this collection that don't exist in specified array |
||
143 | * |
||
144 | * Returns true if the collection was modified |
||
145 | * |
||
146 | * @param array $collection |
||
147 | * @return bool |
||
148 | */ |
||
149 | public function retainAllArray(array $collection): bool |
||
160 | |||
161 | /** |
||
162 | * Find the first element in collection |
||
163 | * |
||
164 | * The closure will get passed each element. Returning true will end the |
||
165 | * loop and return that element |
||
166 | * |
||
167 | * @param callable $find |
||
168 | * @return mixed |
||
169 | */ |
||
170 | public function find(callable $find) |
||
180 | |||
181 | /** |
||
182 | * Use a closure to determine existence in the collection |
||
183 | * |
||
184 | * The closure will get passed each element. Returning true from the |
||
185 | * closure will return true from this method. |
||
186 | * |
||
187 | * @param callable $exists |
||
188 | * @return bool |
||
189 | */ |
||
190 | public function exists(callable $exists): bool |
||
200 | |||
201 | /** |
||
202 | * Filter the collection using closure |
||
203 | * |
||
204 | * The closure will get passed each element. Returning true from the |
||
205 | * closure will include that element in the new collection. |
||
206 | * |
||
207 | * @param callable $filter |
||
208 | * @return CollectionInterface |
||
209 | */ |
||
210 | public function filter(callable $filter): CollectionInterface |
||
214 | } |
||
215 |
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.