8000 minor #16073 Fix the DomCrawler tests (stof) · symfony/symfony@a6d5c33 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6d5c33

Browse files
committed
minor #16073 Fix the DomCrawler tests (stof)
This PR was merged into the 2.8 branch. Discussion ---------- Fix the DomCrawler tests | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a This fixes the tests by applying changes from #16057 and #16058 in the right order in ``addNode`` Commits ------- e6feed2 Fix the DomCrawler tests
2 parents 584cfc2 + e6feed2 commit a6d5c33

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
@@ -313,14 +313,6 @@ public function addNodes(array $nodes)
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