Skip to content

Commit

Permalink
minor #18212 [DomCrawler] Use XML_ELEMENT_NODE in nodeType check (rva…
Browse files Browse the repository at this point in the history
…nlaak)

This PR was merged into the 2.3 branch.

Discussion
----------

[DomCrawler] Use XML_ELEMENT_NODE in nodeType check

| Q             | A
| ------------- | ---
| Branch?       | 2.3+
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Making use of the predefined dom constant `XML_ELEMENT_NODE` (which value is `1`) makes more sense while interpreting `parents()` it's functionality. See http://php.net/manual/en/dom.constants.php

Commits
-------

cffea91 Use XML_ELEMENT_NODE in nodeType check
  • Loading branch information
fabpot committed Mar 18, 2016
2 parents d1b8414 + cffea91 commit a5d9414
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/DomCrawler/Crawler.php
Expand Up @@ -455,7 +455,7 @@ public function parents()
$nodes = array();

while ($node = $node->parentNode) {
if (1 === $node->nodeType) {
if (XML_ELEMENT_NODE === $node->nodeType) {
$nodes[] = $node;
}
}
Expand Down

0 comments on commit a5d9414

Please sign in to comment.