Skip to content

Commit 78dc16c

Browse files
committed
fix PHP 8.5 deprecations - fix SplObjectStorage
Method SplObjectStorage::contains() is deprecated since 8.5, use method SplObjectStorage::offsetExists() instead Method SplObjectStorage::detach() is deprecated since 8.5, use method SplObjectStorage::offsetUnset() instead
1 parent cf83f4a commit 78dc16c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Symfony/Doctrine/EventListener/PublishMercureUpdatesListener.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,25 @@ public function postFlush(): void
129129
try {
130130
$creatingObjects = clone $this->createdObjects;
131131
foreach ($creatingObjects as $object) {
132-
if ($this->createdObjects->contains($object)) {
133-
$this->createdObjects->detach($object);
132+
if ($this->createdObjects->offsetExists($object)) {
133+
$this->createdObjects->offsetUnset($object);
134134
}
135135
$this->publishUpdate($object, $creatingObjects[$object], 'create');
136136
}
137137

138138
$updatingObjects = clone $this->updatedObjects;
139139
foreach ($updatingObjects as $object) {
140-
if ($this->updatedObjects->contains($object)) {
141-
$this->updatedObjects->detach($object);
140+
if ($this->updatedObjects->offsetExists($object)) {
141+
$this->updatedObjects->offsetUnset($object);
142142
}
143143
$this->publishUpdate($object, $updatingObjects[$object], 'update');
144144
}
145145

146146
$deletingObjects = clone $this->deletedObjects;
147147
foreach ($deletingObjects as $object) {
148148
$options = $this->deletedObjects[$object];
149-
if ($this->deletedObjects->contains($object)) {
150-
$this->deletedObjects->detach($object);
149+
if ($this->deletedObjects->offsetExists($object)) {
150+
$this->deletedObjects->offsetUnset($object);
151151
}
152152
$this->publishUpdate($object, $deletingObjects[$object], 'delete');
153153
}

0 commit comments

Comments
 (0)