@@ -104,7 +104,7 @@ public function __construct(SplObjectStorage $splos, bool $initialized = false,
104104 /*
105105 $this->dom = $dom;
106106 $this->matches = new \SplObjectStorage();
107- $this->matches->attach ($this->dom);
107+ $this->matches->offsetSet ($this->dom);
108108 */
109109 }
110110
@@ -149,7 +149,7 @@ public function find($selector): DOMTraverser
149149 // fprintf(STDOUT, "Testing %s against %s.\n", $candidate->tagName, $selectorGroup[0]);
150150 if ($ this ->matchesSelector ($ candidate , $ selectorGroup )) {
151151 // $this->debug('Attaching ' . $candidate->nodeName);
152- $ found ->attach ($ candidate );
152+ $ found ->offsetSet ($ candidate );
153153 }
154154 }
155155 }
@@ -477,7 +477,7 @@ protected function initialMatchOnID(SimpleSelector $selector, SplObjectStorage $
477477 /** @var DOMElement $node */
478478 foreach ($ matches as $ node ) {
479479 if ($ node ->getAttribute ('id ' ) === $ id ) {
480- $ found ->attach ($ node );
480+ $ found ->offsetSet ($ node );
481481 }
482482
483483 $ nl = $ this ->initialXpathQuery ($ xpath , $ node , $ baseQuery );
@@ -524,7 +524,7 @@ protected function initialMatchOnClasses(SimpleSelector $selector, SplObjectStor
524524 if ($ node ->hasAttribute ('class ' )) {
525525 $ intersect = array_intersect ($ selector ->classes , explode (' ' , $ node ->getAttribute ('class ' )));
526526 if (count ($ intersect ) === count ($ selector ->classes )) {
527- $ found ->attach ($ node );
527+ $ found ->offsetSet ($ node );
528528 }
529529 }
530530
@@ -536,7 +536,7 @@ protected function initialMatchOnClasses(SimpleSelector $selector, SplObjectStor
536536
537537 $ intersect = array_intersect ($ selector ->classes , $ classArray );
538538 if (count ($ intersect ) === count ($ selector ->classes )) {
539- $ found ->attach ($ subNode );
539+ $ found ->offsetSet ($ subNode );
540540 }
541541 }
542542 }
@@ -590,7 +590,7 @@ protected function initialMatchOnElement(SimpleSelector $selector, SplObjectStor
590590 // Capture the case where the initial element is the root element.
591591 if ($ node ->tagName === $ element
592592 || ($ element === '* ' && $ node ->parentNode instanceof DOMDocument)) {
593- $ found ->attach ($ node );
593+ $ found ->offsetSet ($ node );
594594 }
595595 $ nl = $ node ->getElementsByTagName ($ element );
596596 if (! empty ($ nl ) && $ nl instanceof DOMNodeList) {
@@ -634,7 +634,7 @@ protected function initialMatchOnElementNS(SimpleSelector $selector, SplObjectSt
634634 }
635635 }
636636 foreach ($ detach as $ rem ) {
637- $ elements ->detach ($ rem );
637+ $ elements ->offsetUnset ($ rem );
638638 }
639639 $ selector ->ns = null ;
640640
@@ -888,7 +888,7 @@ protected function setMatches($matches)
888888 public function attachNodeList (DOMNodeList $ nodeList , SplObjectStorage $ splos )
889889 {
890890 foreach ($ nodeList as $ item ) {
891- $ splos ->attach ($ item );
891+ $ splos ->offsetSet ($ item );
892892 }
893893 }
894894
0 commit comments