diff --git a/src/BooleanParser.php b/src/BooleanParser.php index e333a07..16f4b4e 100644 --- a/src/BooleanParser.php +++ b/src/BooleanParser.php @@ -6,7 +6,13 @@ class BooleanParser extends AbstractValueParser { protected function parse($value) { - return strtoupper($value) === 'TRUE' || strtoupper($value) === '1'; + if (strtoupper($value) === 'TRUE' || $value === '1') { + return true; + } + if (strtoupper($value) === 'FALSE' || $value === '0') { + return false; + } + return null; } /** diff --git a/src/YesNoBooleanParser.php b/src/YesNoBooleanParser.php index f19993b..486607c 100644 --- a/src/YesNoBooleanParser.php +++ b/src/YesNoBooleanParser.php @@ -6,7 +6,13 @@ class YesNoBooleanParser extends AbstractValueParser { protected function parse($value) { - return strtoupper($value) === 'YES' || strtoupper($value) === 'Y'; + if (strtoupper($value) === 'YES' || strtoupper($value) === 'Y') { + return true; + } + if (strtoupper($value) === 'NO' || strtoupper($value) === 'N') { + return false; + } + return null; } /**