diff --git a/src/Rules/MinLength.php b/src/Rules/MinLength.php index 3ed0b40..6ecc5b5 100755 --- a/src/Rules/MinLength.php +++ b/src/Rules/MinLength.php @@ -63,7 +63,7 @@ public function validate(): bool 'Rule "min_length": the rule value is mandatory' ); } - if (!is_int($this->ruleValues[0])) { + if (!\is_numeric($this->ruleValues[0])) { throw ValidatorException::noIntegerValue($this->ruleValues[0]); } diff --git a/tests/MinLengthTest.php b/tests/MinLengthTest.php index db3811f..bdea502 100755 --- a/tests/MinLengthTest.php +++ b/tests/MinLengthTest.php @@ -82,14 +82,12 @@ public function testValidateNull(): void } /** - * An Empty String ('') value should pass validation (ignored field). - * - * @return void + * A numeric string, e.g. '10', should be accepted as rule value. */ - // public function testValidateEmptyString(): void - // { - // $this->assertTrue($this->validate('', [5])); - // } + public function testValidateNumericString(): void + { + $this->assertFalse($this->validate('text with 23 characters', ['30'])); + } /** * The String ('text with 23 characters') value should violate the rule with min length of 30 characters.