Skip to content

Commit

Permalink
Dont use empty() (#8)
Browse files Browse the repository at this point in the history
* Dont use `empty()`

* cs
  • Loading branch information
Nyholm authored Jul 15, 2021
1 parent e37545d commit 6d96285
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/EntityExistValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ public function __construct(EntityManagerInterface $entityManager)

public function validate($value, Constraint $constraint): void
{
if (empty($value)) {
return;
}

if (!$constraint instanceof EntityExist) {
throw new \LogicException(\sprintf('You can only pass %s constraint to this validator.', EntityExist::class));
}

if (null === $value || '' === $value) {
return;
}

if (empty($constraint->entity)) {
throw new \LogicException(\sprintf('Must set "entity" on "%s" validator', EntityExist::class));
}
Expand Down

0 comments on commit 6d96285

Please sign in to comment.