From 4115e6ee887c45760cfa12bcbdb817d9f9527433 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Tue, 25 Nov 2025 13:41:31 +0100 Subject: [PATCH 1/2] Replace deprecated SplObjectStorage::attach()/detach() usage for PHP 8.5 --- phpdotnet/phd/ObjectStorage.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpdotnet/phd/ObjectStorage.php b/phpdotnet/phd/ObjectStorage.php index 1d5218d3..b1a99e13 100644 --- a/phpdotnet/phd/ObjectStorage.php +++ b/phpdotnet/phd/ObjectStorage.php @@ -16,6 +16,12 @@ public function attach(object $object, mixed $info = array()): void { ); } parent::attach($object, $info); + + if (PHP_VERSION_ID < 80500) { + parent::attach($object, $info); + } + + $this->offsetSet($object, $info); } } From ef57fc016fdc6e444f9884fd94bd2ba3a9e65754 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Sun, 30 Nov 2025 16:36:16 +0100 Subject: [PATCH 2/2] remove the old one --- phpdotnet/phd/ObjectStorage.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/phpdotnet/phd/ObjectStorage.php b/phpdotnet/phd/ObjectStorage.php index b1a99e13..d7c7d75c 100644 --- a/phpdotnet/phd/ObjectStorage.php +++ b/phpdotnet/phd/ObjectStorage.php @@ -3,23 +3,18 @@ class ObjectStorage extends \SplObjectStorage { - public function attach(object $object, mixed $info = array()): void { + public function attach(object $object, mixed $info = []): void { if (!($object instanceof Format)) { throw new \InvalidArgumentException( 'Only classess inheriting ' . __NAMESPACE__ . '\\Format supported' ); } if (empty($info)) { - $info = array( + $info = [ \XMLReader::ELEMENT => $object->getElementMap(), \XMLReader::TEXT => $object->getTextMap(), - ); + ]; } - parent::attach($object, $info); - - if (PHP_VERSION_ID < 80500) { - parent::attach($object, $info); - } $this->offsetSet($object, $info); }