1 | <?php |
||
43 | class Collection extends AbstractCollection implements ResolvableCollectionInterface |
||
44 | { |
||
45 | /** @var ResolverInterface */ |
||
46 | private $resolver; |
||
47 | |||
48 | /** @var ComparatorInterface */ |
||
49 | private $comparator; |
||
50 | |||
51 | /** |
||
52 | * @param DeltaInterface[]|\Traversable $versions |
||
53 | * @param ResolverInterface $resolver |
||
|
|||
54 | * @param ComparatorInterface $comparator |
||
55 | * |
||
56 | * @throws InvalidArgumentException |
||
57 | */ |
||
58 | 157 | public function __construct( |
|
75 | |||
76 | /** |
||
77 | * @return ResolverInterface |
||
78 | */ |
||
79 | 149 | final protected function getResolver() |
|
83 | |||
84 | /** |
||
85 | * Gets an element. |
||
86 | * |
||
87 | * @param mixed $element If an alias is given then it will be resolved to an element. Otherwise the $key will be used |
||
88 | * to fetch the element by index. |
||
89 | * @param bool $resolve Whether to use the resolver or not. |
||
90 | * |
||
91 | * @return DeltaInterface|null Null if not present |
||
92 | */ |
||
93 | 32 | public function find($element, $resolve = true) |
|
111 | |||
112 | /** |
||
113 | * Returns whether the key exists in the collection. |
||
114 | * |
||
115 | * @param $index |
||
116 | * @param bool $resolve |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | 1 | public function has($index, $resolve = true) |
|
124 | |||
125 | /** |
||
126 | * @inheritdoc |
||
127 | */ |
||
128 | 144 | public function validate(DeltaInterface $version) |
|
132 | |||
133 | /** |
||
134 | * invalidateResolverCache |
||
135 | */ |
||
136 | 147 | final protected function invalidateResolverCache() |
|
140 | |||
141 | /** |
||
142 | * Add a version to the collection |
||
143 | * |
||
144 | * @param mixed $version |
||
145 | * |
||
146 | * @return bool |
||
147 | * |
||
148 | * @throws CollectionException |
||
149 | * @throws InvalidArgumentException |
||
150 | */ |
||
151 | 144 | public function add(DeltaInterface $version) |
|
161 | |||
162 | /** |
||
163 | * @param $key |
||
164 | * |
||
165 | * @return DeltaInterface|null |
||
166 | */ |
||
167 | 4 | public function remove($key) |
|
176 | |||
177 | /** |
||
178 | * {@inheritDoc} |
||
179 | */ |
||
180 | 10 | public function replace(DeltaInterface $version) |
|
188 | |||
189 | /** |
||
190 | * {@inheritDoc} |
||
191 | */ |
||
192 | 8 | public function clear() |
|
197 | |||
198 | /** |
||
199 | * Sort the collection |
||
200 | * @param ComparatorInterface $comparator |
||
201 | * @return static |
||
202 | */ |
||
203 | 19 | public function sort(ComparatorInterface $comparator = null) |
|
212 | |||
213 | /** |
||
214 | * Returns a collection with elements sorted in reverse order. |
||
215 | * |
||
216 | * @return static |
||
217 | */ |
||
218 | 8 | public function getReverse() |
|
222 | |||
223 | /** |
||
224 | * @return ComparatorInterface |
||
225 | */ |
||
226 | 19 | public function getComparator() |
|
230 | } |
||
231 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.