Skip to content

Commit c0335c5

Browse files
committed
made VBool stricter
1 parent 14b11df commit c0335c5

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

app/helpers/MetaFormats/Validators/VBool.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,14 @@
66
use App\Helpers\MetaFormats\PhpTypes;
77

88
/**
9-
* Validates boolean values. Accepts bools, "true", "false", 0 and 1.
9+
* Validates boolean values. Accepts only boolean true and false.
1010
*/
1111
class VBool
1212
{
1313
public const SWAGGER_TYPE = "boolean";
1414

1515
public function validate(mixed $value)
1616
{
17-
// support stringified values as well as 0 and 1
18-
return MetaFormatHelper::checkType($value, PhpTypes::Bool)
19-
|| $value == 0
20-
|| $value == 1
21-
|| $value == "true"
22-
|| $value == "false";
17+
return $value === true || $value === false;
2318
}
2419
}

0 commit comments

Comments
 (0)