[DOC-CVS] [phd] master: Replace deprecated SplObjectStorage::attach() usage for PHP 8.5 (#223)

[email protected] (Louis-Arnaud via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: haszi
Date: 2025-12-12T19:21:31+01:00

Commit: https://github.com/php/phd/commit/5d705c2676cbc85d9f94e212e796f776fcbf59fc
Raw diff: https://github.com/php/phd/commit/5d705c2676cbc85d9f94e212e796f776fcbf59fc.diff

Replace deprecated SplObjectStorage::attach() usage for PHP 8.5 (#223)

* Replace deprecated SplObjectStorage::attach()/detach() usage for PHP 8.5

---------

Co-authored-by: lacatoire <[email protected]>

Changed paths:
  M  phpdotnet/phd/ObjectStorage.php


Diff:

diff --git a/phpdotnet/phd/ObjectStorage.php b/phpdotnet/phd/ObjectStorage.php
index 1d5218d3..d7c7d75c 100644
--- a/phpdotnet/phd/ObjectStorage.php
+++ b/phpdotnet/phd/ObjectStorage.php
@@ -3,19 +3,20 @@
 
 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);
 	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.