mirror of
https://github.com/php/phd.git
synced 2026-03-23 22:52:05 +01:00
Replace deprecated SplObjectStorage::attach() usage for PHP 8.5 (#223)
* Replace deprecated SplObjectStorage::attach()/detach() usage for PHP 8.5 --------- Co-authored-by: lacatoire <louis-arnaud.catoire@external.drivalia.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user