Skip to content

Commit cb2b32f

Browse files
committed
Add comment implicitly casts non-numeric
1 parent 87f72ad commit cb2b32f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Database/Validator/Structure.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,15 @@ public function isValid($document): bool
269269
break;
270270

271271
case Database::VAR_INTEGER:
272+
// We need both Integer and Range because Range implicitly casts non-numeric values
272273
$validators[] = new Integer();
273274
$max = $size >= 8 ? Database::BIG_INT_MAX : Database::INT_MAX;
274275
$min = $signed ? -$max : 0;
275276
$validators[] = new Range($min, $max, Database::VAR_INTEGER);
276277
break;
277278

278279
case Database::VAR_FLOAT:
280+
// We need both Float and Range because Range implicitly casts non-numeric values
279281
$validators[] = new FloatValidator();
280282
$min = $signed ? -Database::DOUBLE_MAX : 0;
281283
$validators[] = new Range($min, Database::DOUBLE_MAX, Database::VAR_FLOAT);

0 commit comments

Comments
 (0)