8000 Replace ctype_digit check with just a lower than comparison · symfonyaml/symfony@1b26cf2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b26cf2

Browse files
author
symfonyaml
committed
Replace ctype_digit check with just a lower than comparison
1 parent cf56118 commit 1b26cf2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Symfony/Component/Validator/Constraints/VideoValidator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function validate(mixed $value, Constraint $constraint): void
6969
$height = $dimensions->getHeight();
7070

7171
if ($constraint->minWidth) {
72-
if (!ctype_digit((string) $constraint->minWidth)) {
72+
if ($constraint->minWidth < 0) {
7373
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum width.', $constraint->minWidth));
7474
}
7575

@@ -85,7 +85,7 @@ public function validate(mixed $value, Constraint $constraint): void
8585
}
8686

8787
if ($constraint->maxWidth) {
88-
if (!ctype_digit((string) $constraint->maxWidth)) {
88+
if ($constraint->maxWidth < 0) {
8989
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum width.', $constraint->maxWidth));
9090
}
9191

@@ -101,7 +101,7 @@ public function validate(mixed $value, Constraint $constraint): void
101101
}
102102

103103
if ($constraint->minHeight) {
104-
if (!ctype_digit((string) $constraint->minHeight)) {
104+
if ($constraint->minHeight < 0) {
105105
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum height.', $constraint->minHeight));
106106
}
107107

@@ -117,7 +117,7 @@ public function validate(mixed $value, Constraint $constraint): void
117117
}
118118

119119
if ($constraint->maxHeight) {
120-
if (!ctype_digit((string) $constraint->maxHeight)) {
120+
if ($constraint->maxHeight < 0) {
121121
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum height.', $constraint->maxHeight));
122122
}
123123

@@ -133,7 +133,7 @@ public function validate(mixed $value, Constraint $constraint): void
133133
$pixels = $width * $height;
134134

135135
if (null !== $constraint->minPixels) {
136-
if (!ctype_digit((string) $constraint->minPixels)) {
136+
if ($constraint->minPixels < 0) {
137137
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid minimum amount of pixels.', $constraint->minPixels));
138138
}
139139

@@ -149,7 +149,7 @@ public function validate(mixed $value, Constraint $constraint): void
149149
}
150150

151151
if (null !== $constraint->maxPixels) {
152-
if (!ctype_digit((string) $constraint->maxPixels)) {
152+
if ($constraint->maxPixels < 0) {
153153
throw new ConstraintDefinitionException(\sprintf('"%s" is not a valid maximum amount of pixels.', $constraint->maxPixels));
154154
}
155155

0 commit comments

Comments
 (0)
0