Skip to content

Commit 3d24c3d

Browse files
committed
Address changes from doctrine/collections 1.8.0
Collection::contains() and Collection::indexOf() use templating to infer if they are going to return false or null respectively, in case $element does not even match the type of the collection.
1 parent 8e048f8 commit 3d24c3d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Doctrine/ODM/MongoDB/PersistentCollection/PersistentCollectionTrait.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@ public function containsKey($key)
359359
return $this->coll->containsKey($key);
360360
}
361361

362+
/**
363+
* @template TMaybeContained
364+
*/
362365
public function contains($element)
363366
{
364367
$this->initialize();
@@ -373,6 +376,11 @@ public function exists(Closure $p)
373376
return $this->coll->exists($p);
374377
}
375378

379+
/**
380+
* @psalm-return (TMaybeContained is T ? TKey|false : false)
381+
*
382+
* @template TMaybeContained
383+
*/
376384
public function indexOf($element)
377385
{
378386
$this->initialize();

0 commit comments

Comments
 (0)