Skip to content

Commit 9519592

Browse files
derrabusnicolas-grekas
authored andcommitted
Fix inconsistent return points.
1 parent ca927e6 commit 9519592

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

Crawler.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,9 +1053,7 @@ private function relativize($xpath)
10531053
*/
10541054
public function getNode($position)
10551055
{
1056-
if (isset($this->nodes[$position])) {
1057-
return $this->nodes[$position];
1058-
}
1056+
return isset($this->nodes[$position]) ? $this->nodes[$position] : null;
10591057
}
10601058

10611059
/**
@@ -1115,7 +1113,7 @@ private function createDOMXPath(\DOMDocument $document, array $prefixes = [])
11151113
/**
11161114
* @param string $prefix
11171115
*
1118-
* @return string
1116+
* @return string|null
11191117
*
11201118
* @throws \InvalidArgumentException
11211119
*/
@@ -1128,9 +1126,7 @@ private function discoverNamespace(\DOMXPath $domxpath, $prefix)
11281126
// ask for one namespace, otherwise we'd get a collection with an item for each node
11291127
$namespaces = $domxpath->query(sprintf('(//namespace::*[name()="%s"])[last()]', $this->defaultNamespacePrefix === $prefix ? '' : $prefix));
11301128

1131-
if ($node = $namespaces->item(0)) {
1132-
return $node->nodeValue;
1133-
}
1129+
return ($node = $namespaces->item(0)) ? $node->nodeValue : null;
11341130
}
11351131

11361132
/**

Field/FormField.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ public function getLabel()
7272
}
7373

7474
$labels = $xpath->query('ancestor::label[1]', $this->node);
75-
if ($labels->length > 0) {
76-
return $labels->item(0);
77-
}
75+
76+
return $labels->length > 0 ? $labels->item(0) : null;
7877
}
7978

8079
/**

0 commit comments

Comments
 (0)