src/Sylius/Bundle/CoreBundle/Validator/Constraints/HasEnabledEntityValidator.php
private function isLastEnabledEntity($result, $entity): bool
    {
        return !$result || 0 === count($result)
        || (1 === count($result) && $entity === ($result instanceof \Iterator ? $result->current() : current($result)));
    }
private function isLastEnabledEntity($result, $entity): bool
    {
        return !$result || 0 === count($result)
        || (1 === count($result) && $entity === ($result instanceof \Iterator ? $result->current() : current($result)));
    }
private function isLastEnabledEntity ( $ result , $ entity ) : bool { return ! $ result || 0 === count ( $ result ) || ( 1 === count ( $ result ) && $ entity === ( $ result instanceof \ Iterator ? $ result -> current ( ) : current ( $ result ) ) ) ; }
If no entity matched the query criteria or a single entity matched, which is the same as the entity being
validated, the entity is the last enabled entity available.

@param array|\Iterator $result
@param object $entity
If no entity matched the query criteria or a single entity matched which is the same as the entity being validated the entity is the last enabled entity available .