Skip to content

Commit 6d96285

Browse files
authored
Dont use empty() (#8)
* Dont use `empty()` * cs
1 parent e37545d commit 6d96285

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/EntityExistValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public function __construct(EntityManagerInterface $entityManager)
2323

2424
public function validate($value, Constraint $constraint): void
2525
{
26-
if (empty($value)) {
27-
return;
28-
}
29-
3026
if (!$constraint instanceof EntityExist) {
3127
throw new \LogicException(\sprintf('You can only pass %s constraint to this validator.', EntityExist::class));
3228
}
3329

30+
if (null === $value || '' === $value) {
31+
return;
32+
}
33+
3434
if (empty($constraint->entity)) {
3535
throw new \LogicException(\sprintf('Must set "entity" on "%s" validator', EntityExist::class));
3636
}

0 commit comments

Comments
 (0)