Cast result from ExpressionLanguage eval to bool
This commit is contained in:
parent
72a9dfa267
commit
d4f01e8d2e
|
@ -82,7 +82,7 @@ class Indexable implements IndexableInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($callback instanceof Expression) {
|
if ($callback instanceof Expression) {
|
||||||
return $this->getExpressionLanguage()->evaluate($callback, array(
|
return (bool) $this->getExpressionLanguage()->evaluate($callback, array(
|
||||||
'object' => $object,
|
'object' => $object,
|
||||||
$this->getExpressionVar($object) => $object,
|
$this->getExpressionVar($object) => $object,
|
||||||
));
|
));
|
||||||
|
|
|
@ -73,6 +73,8 @@ class IndexableTest extends \PHPUnit_Framework_TestCase
|
||||||
array('entity.maybeIndex()', true),
|
array('entity.maybeIndex()', true),
|
||||||
array('!object.isIndexable() && entity.property == "abc"', true),
|
array('!object.isIndexable() && entity.property == "abc"', true),
|
||||||
array('entity.property != "abc"', false),
|
array('entity.property != "abc"', false),
|
||||||
|
array('["array", "values"]', true),
|
||||||
|
array('[]', false)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue