Skip to content

Commit f3a6876

Browse files
committed
Update return type of persistent collection
1 parent 936fd13 commit f3a6876

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

UPGRADE-3.0.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,7 @@ The default implementation of `Type::closureToPHP` has been modified to call
100100
`convertToPHPValue` on the type class. This implementation was provided by
101101
the `ClosureToPHP` trait, which is deprecated. If you have custom types
102102
that use the `ClosureToPHP` trait, remove the trait.
103+
104+
## Persistent Collections
105+
106+
The return type of `PersistentCollection::add()` has changed from `true` to `void`.

src/PersistentCollection/PersistentCollectionTrait.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,12 +440,10 @@ public function set(string|int $key, mixed $value): void
440440
*
441441
* @param mixed $element The element to add.
442442
* @phpstan-param T $element
443-
*
444-
* @return true The return value is kept for BC reasons, but will be void in doctrine/mongodb-odm 3.0.
445443
*/
446-
public function add($element): bool
444+
public function add($element): void
447445
{
448-
return $this->doAdd($element, false);
446+
$this->doAdd($element, false);
449447
}
450448

451449
public function isEmpty(): bool

0 commit comments

Comments
 (0)