Skip to content
Snippets Groups Projects
Unverified Commit 717c33f4 authored by Tim van Dijen's avatar Tim van Dijen Committed by GitHub
Browse files

Fix implicit array-to-boolean convertion

Scrutinizer:
The expression $result of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.
parent 8d4a2429
Branches
Tags
No related merge requests found
...@@ -50,7 +50,7 @@ class Parser ...@@ -50,7 +50,7 @@ class Parser
public function getValue($xpath, $required = false) public function getValue($xpath, $required = false)
{ {
$result = $this->simplexml->xpath($xpath); $result = $this->simplexml->xpath($xpath);
if (!($result || !is_array($result))) { if (!is_array($result) || empty($result)) {
if ($required) { if ($required) {
throw new \Exception('Could not get value from XML document using the following XPath expression: ' . $xpath); throw new \Exception('Could not get value from XML document using the following XPath expression: ' . $xpath);
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment