diff --git a/src/Validator/Boolean.php b/src/Validator/Boolean.php index 50c1c986..beb75a9c 100644 --- a/src/Validator/Boolean.php +++ b/src/Validator/Boolean.php @@ -77,14 +77,6 @@ public function isValid($value): bool return true; } - if ($this->loose && ($value === '1' || $value === '0')) { // Accept numeric strings - return true; - } - - if ($this->loose && ($value === 1 || $value === 0)) { // Accept integers - return true; - } - if (\is_bool($value)) { return true; } diff --git a/tests/Validator/BooleanTest.php b/tests/Validator/BooleanTest.php index b1742918..8b62a5aa 100755 --- a/tests/Validator/BooleanTest.php +++ b/tests/Validator/BooleanTest.php @@ -33,10 +33,10 @@ public function testCanValidateLoosely() $this->assertTrue($boolean->isValid(false)); $this->assertTrue($boolean->isValid('false')); $this->assertTrue($boolean->isValid('true')); - $this->assertTrue($boolean->isValid('0')); - $this->assertTrue($boolean->isValid('1')); - $this->assertTrue($boolean->isValid(0)); - $this->assertTrue($boolean->isValid(1)); + $this->assertFalse($boolean->isValid('0')); + $this->assertFalse($boolean->isValid('1')); + $this->assertFalse($boolean->isValid(0)); + $this->assertFalse($boolean->isValid(1)); $this->assertFalse($boolean->isValid(['string', 'string'])); $this->assertFalse($boolean->isValid('string')); $this->assertFalse($boolean->isValid(1.2));