From 5d705c2676cbc85d9f94e212e796f776fcbf59fc Mon Sep 17 00:00:00 2001 From: Louis-Arnaud <20201470+lacatoire@users.noreply.github.com> Date: Fri, 12 Dec 2025 19:21:31 +0100 Subject: [PATCH] Replace deprecated SplObjectStorage::attach() usage for PHP 8.5 (#223) * Replace deprecated SplObjectStorage::attach()/detach() usage for PHP 8.5 --------- Co-authored-by: lacatoire --- phpdotnet/phd/ObjectStorage.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phpdotnet/phd/ObjectStorage.php b/phpdotnet/phd/ObjectStorage.php index 1d5218d..d7c7d75 100644 --- a/phpdotnet/phd/ObjectStorage.php +++ b/phpdotnet/phd/ObjectStorage.php @@ -3,19 +3,20 @@ namespace phpdotnet\phd; 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); + + $this->offsetSet($object, $info); } }