8000 Fix the DomCrawler tests · symfony/symfony@e6feed2 · GitHub
[go: up one dir, main page]

Skip to content

Commit e6feed2

Browse files
committed
Fix the DomCrawler tests
1 parent 584cfc2 commit e6feed2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Symfony/Component/DomCrawler/Crawler.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
313313
*/
314314
public function addNode(\DOMNode $node)
315315
{
316-
if (null !== $this->document && $this->document !== $node->ownerDocument) {
317-
@trigger_error('Attaching DOM nodes from multiple documents in a Crawler is deprecated as of 2.8 and will be forbidden in 3.0.', E_USER_DEPRECATED);
318-
}
319-
320-
if (null === $this->document) {
321-
$this->document = $node->ownerDocument;
322-
}
323-
324316
if ($node instanceof \DOMDocument) {
325317
$node = $node->documentElement;
326318
}
@@ -329,6 +321,14 @@ public function addNode(\DOMNode $node)
329321
throw new \InvalidArgumentException(sprintf('Nodes set in a Crawler must be DOMElement or DOMDocument instances, "%s" given.', get_class($node)));
330322
}
331323

324+
if (null !== $this->document && $this->document !== $node->ownerDocument) {
325+
@trigger_error('Attaching DOM nodes from multiple documents in a Crawler is deprecated as of 2.8 and will be forbidden in 3.0.', E_USER_DEPRECATED);
326+
}
327+
328+
if (null === $this->document) {
329+
$this->document = $node->ownerDocument;
330+
}
331+
332332
parent::attach($node);
333333
}
334334

0 commit comments

Comments
 (0)
0