Skip to content

Commit 184bfe1

Browse files
committed
bool validator now supports 1 and 0 as well
1 parent ffee4a5 commit 184bfe1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

app/helpers/MetaFormats/Validators/VBool.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ class VBool
1212

1313
public function validate(mixed $value)
1414
{
15-
// support stringified values as well
16-
return MetaFormatHelper::checkType($value, PhpTypes::Bool) || $value == "true" || $value == "false";
15+
// support stringified values as well as 0 and 1
16+
return MetaFormatHelper::checkType($value, PhpTypes::Bool)
17+
|| $value == 0
18+
|| $value == 1
19+
|| $value == "true"
20+
|| $value == "false";
1721
}
1822
}

0 commit comments

Comments
 (0)