Sort operation must accept empty context
Closed this issue · 1 comments
kitsunet commented
Must accept an empty context in canEvaluate
as you cannot know if the operations before deliver an empty result set.
Something like this:
/**
* {@inheritdoc}
*
* @param array (or array-like object) $context onto which this operation should be applied
* @return boolean TRUE if the operation can be applied onto the $context, FALSE otherwise
*/
public function canEvaluate($context)
{
if (count($context) === 0) {
return true;
}
foreach ($context as $contextNode) {
if (!$contextNode instanceof NodeInterface) {
return false;
}
}
return true;
}
Weissheiten commented
fixed with commit 2b1a415