Skip to content

Commit d7ce7ec

Browse files
authored
Merge pull request #346 from W0rma/fix-php85-spl-object-storage-deprecation
Fix SplObjectStorage deprecation warning in PHP 8.5
2 parents 4f19c54 + d1209a5 commit d7ce7ec

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
beStrictAboutCoverageMetadata="true"
88
beStrictAboutOutputDuringTests="true"
99
displayDetailsOnPhpunitDeprecations="true"
10+
displayDetailsOnTestsThatTriggerDeprecations="true"
1011
failOnRisky="true"
1112
failOnWarning="true">
1213
<testsuites>

src/Serializer/Metadata/InlineDeferrer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ public function __construct()
2020

2121
public function handleItems(object $object, array $items, SerializationContext $context): array
2222
{
23-
if ($this->deferredData->contains($object)) {
23+
if ($this->deferredData->offsetExists($object)) {
2424
$items = array_merge($this->deferredData->offsetGet($object), $items);
25-
$this->deferredData->detach($object);
25+
$this->deferredData->offsetUnset($object);
2626
}
2727

2828
$parentObjectInlining = $this->getParentObjectInlining($object, $context);
2929
if (null === $parentObjectInlining) {
3030
return $items;
3131
}
3232

33-
if ($this->deferredData->contains($parentObjectInlining)) {
33+
if ($this->deferredData->offsetExists($parentObjectInlining)) {
3434
$items = array_merge($items, $this->deferredData->offsetGet($parentObjectInlining));
3535
}
3636

3737
// We need to defer the links serialization to the $parentObject
38-
$this->deferredData->attach($parentObjectInlining, $items);
38+
$this->deferredData->offsetSet($parentObjectInlining, $items);
3939

4040
return [];
4141
}

0 commit comments

Comments
 (0)