Skip to content

Commit 4eed24f

Browse files
committed
Remove unnecessary empty usages
1 parent 78c5a7d commit 4eed24f

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

Constraints/ImageValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function validate(mixed $value, Constraint $constraint): void
5252

5353
$size = @getimagesize($value);
5454

55-
if (empty($size) || (0 === $size[0]) || (0 === $size[1])) {
55+
if (!$size || (0 === $size[0]) || (0 === $size[1])) {
5656
$this->context->buildViolation($constraint->sizeNotDetectedMessage)
5757
->setCode(Image::SIZE_NOT_DETECTED_ERROR)
5858
->addViolation();

Constraints/NotBlankValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function validate(mixed $value, Constraint $constraint): void
3535
$value = ($constraint->normalizer)($value);
3636
}
3737

38-
if (false === $value || (empty($value) && '0' != $value)) {
38+
if (false === $value || (!$value && '0' != $value)) {
3939
$this->context->buildViolation($constraint->message)
4040
->setParameter('{{ value }}', $this->formatValue($value))
4141
->setCode(NotBlank::IS_BLANK_ERROR)

Constraints/Regex.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ public function getHtmlPattern(): ?string
9191
{
9292
// If htmlPattern is specified, use it
9393
if (null !== $this->htmlPattern) {
94-
return empty($this->htmlPattern)
95-
? null
96-
: $this->htmlPattern;
94+
return $this->htmlPattern ?: null;
9795
}
9896

9997
// Quit if delimiters not at very beginning/end (e.g. when options are passed)

0 commit comments

Comments
 (0)