File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
src/Symfony/Component/DomCrawler Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments