1 | <?php |
||
41 | class Collection extends AbstractCollection implements ResolvableCollectionInterface |
||
42 | { |
||
43 | /** @var ResolverInterface */ |
||
44 | private $resolver; |
||
45 | |||
46 | /** @var ComparatorInterface */ |
||
47 | private $comparator; |
||
48 | |||
49 | /** |
||
50 | * @param VersionInterface[]|\Traversable $versions |
||
51 | * @param ResolverInterface $resolver |
||
|
|||
52 | * @param ComparatorInterface $comparator |
||
53 | * |
||
54 | * @throws InvalidArgumentException |
||
55 | */ |
||
56 | 157 | public function __construct( |
|
73 | |||
74 | /** |
||
75 | * @return ResolverInterface |
||
76 | */ |
||
77 | 149 | final protected function getResolver() |
|
81 | |||
82 | /** |
||
83 | * Gets an element. |
||
84 | * |
||
85 | * @param mixed $element If an alias is given then it will be resolved to an element. Otherwise the $key will be used |
||
86 | * to fetch the element by index. |
||
87 | * @param bool $resolve Whether to use the resolver or not. |
||
88 | * |
||
89 | * @return VersionInterface|null Null if not present |
||
90 | */ |
||
91 | 32 | public function find($element, $resolve = true) |
|
109 | |||
110 | /** |
||
111 | * Returns whether the key exists in the collection. |
||
112 | * |
||
113 | * @param $index |
||
114 | * @param bool $resolve |
||
115 | * |
||
116 | * @return bool |
||
117 | */ |
||
118 | 1 | public function has($index, $resolve = true) |
|
122 | |||
123 | /** |
||
124 | * @inheritdoc |
||
125 | */ |
||
126 | 144 | public function validate(VersionInterface $version) |
|
130 | |||
131 | /** |
||
132 | * invalidateResolverCache |
||
133 | */ |
||
134 | 147 | final protected function invalidateResolverCache() |
|
138 | |||
139 | /** |
||
140 | * Add a version to the collection |
||
141 | * |
||
142 | * @param VersionInterface $version |
||
143 | * |
||
144 | * @return bool |
||
145 | * |
||
146 | * @throws CollectionException |
||
147 | * @throws InvalidArgumentException |
||
148 | */ |
||
149 | 144 | public function add(VersionInterface $version) |
|
159 | |||
160 | /** |
||
161 | * @param $key |
||
162 | * |
||
163 | * @return VersionInterface|null |
||
164 | */ |
||
165 | 4 | public function remove($key) |
|
174 | |||
175 | /** |
||
176 | * {@inheritDoc} |
||
177 | */ |
||
178 | 10 | public function replace(VersionInterface $version) |
|
186 | |||
187 | /** |
||
188 | * {@inheritDoc} |
||
189 | */ |
||
190 | 8 | public function clear() |
|
195 | |||
196 | /** |
||
197 | * Sort the collection |
||
198 | * @param ComparatorInterface $comparator |
||
199 | * @return static |
||
200 | */ |
||
201 | 19 | public function sort(ComparatorInterface $comparator = null) |
|
210 | |||
211 | /** |
||
212 | * Returns a collection with elements sorted in reverse order. |
||
213 | * |
||
214 | * @return static |
||
215 | */ |
||
216 | 8 | public function getReverse() |
|
220 | |||
221 | /** |
||
222 | * @return ComparatorInterface |
||
223 | */ |
||
224 | 19 | public function getComparator() |
|
228 | } |
||
229 |
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.