| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function match($value, $pattern) |
||
| 16 | { |
||
| 17 | $language = new ExpressionLanguage(); |
||
| 18 | preg_match(self::MATCH_PATTERN, $pattern, $matches); |
||
| 19 | $expressionResult = $language->evaluate($matches[1], array('value' => $value)); |
||
| 20 | |||
| 21 | if (!$expressionResult) { |
||
|
|
|||
| 22 | $this->error = sprintf("\"%s\" expression fails for value \"%s\".", $pattern, new StringConverter($value)); |
||
| 23 | } |
||
| 24 | |||
| 25 | return (bool) $expressionResult; |
||
| 26 | } |
||
| 27 | |||
| 36 |
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.