| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 29 | 3 | public function query($xpath, DOMNode $scope = null, $registerNodeNS = null) |
|
| 30 | { |
||
| 31 | 3 | set_error_handler([$this, 'onQueryError']); |
|
| 32 | |||
| 33 | 3 | $result = parent::query($xpath, $scope, $registerNodeNS); |
|
| 34 | |||
| 35 | 3 | restore_error_handler(); |
|
| 36 | |||
| 37 | 3 | if ($this->errors) { |
|
|
|
|||
| 38 | 2 | throw new InvalidArgumentException(sprintf('XPath error for %s (%s)', $xpath, current($this->errors))); |
|
| 39 | } |
||
| 40 | |||
| 41 | 1 | return $result; |
|
| 42 | } |
||
| 43 | } |
||
| 44 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.