@@ -30,8 +30,8 @@ trait Promises
3030 */
3131 protected function addPromise (UuidInterface $ uuid , PromiseInterface $ promise ): self
3232 {
33- if (! $ this ->promises ->contains ($ uuid )) {
34- $ this ->promises ->attach ($ uuid , new ArrayObject ());
33+ if (! $ this ->promises ->offsetExists ($ uuid )) {
34+ $ this ->promises ->offsetSet ($ uuid , new ArrayObject ());
3535 }
3636
3737 $ this ->promises [$ uuid ][] = $ promise ;
@@ -60,7 +60,7 @@ protected function addPromise(UuidInterface $uuid, PromiseInterface $promise): s
6060 */
6161 protected function removePromise (UuidInterface $ uuid , PromiseInterface $ promise ): self
6262 {
63- if (! $ this ->promises ->contains ($ uuid )) {
63+ if (! $ this ->promises ->offsetExists ($ uuid )) {
6464 throw new InvalidArgumentException (
6565 sprintf ('There are no registered promises for UUID %s ' , $ uuid ->toString ())
6666 );
@@ -96,12 +96,12 @@ protected function removePromise(UuidInterface $uuid, PromiseInterface $promise)
9696 */
9797 protected function detachPromises (UuidInterface $ uuid ): array
9898 {
99- if (! $ this ->promises ->contains ($ uuid )) {
99+ if (! $ this ->promises ->offsetExists ($ uuid )) {
100100 return [];
101101 }
102102
103103 $ promises = $ this ->promises [$ uuid ];
104- $ this ->promises ->detach ($ uuid );
104+ $ this ->promises ->offsetUnset ($ uuid );
105105
106106 return $ promises ->getArrayCopy ();
107107 }
0 commit comments