From 89e1efea3d3bc6e78c7e8bd524cda723625157a3 Mon Sep 17 00:00:00 2001 From: Matthew Smeets Date: Thu, 15 Oct 2020 20:00:18 +0200 Subject: [PATCH] disallow string type in GreaterThan and LessThan --- Constraint/Constraints/GreaterThan.php | 2 +- Constraint/Constraints/LessThan.php | 2 +- Tests/Constraint/Constraints/GreaterThanOrEqualTest.php | 2 +- Tests/Constraint/Constraints/GreaterThanTest.php | 2 +- Tests/Constraint/Constraints/LessThanOrEqualTest.php | 4 ++-- Tests/Constraint/Constraints/LessThanTest.php | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Constraint/Constraints/GreaterThan.php b/Constraint/Constraints/GreaterThan.php index c93be3c..86b44f6 100644 --- a/Constraint/Constraints/GreaterThan.php +++ b/Constraint/Constraints/GreaterThan.php @@ -45,7 +45,7 @@ protected function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['value']) - ->setAllowedTypes('value', ['numeric', 'string']) + ->setAllowedTypes('value', ['numeric']) ; } } diff --git a/Constraint/Constraints/LessThan.php b/Constraint/Constraints/LessThan.php index 75c5865..980cdd5 100644 --- a/Constraint/Constraints/LessThan.php +++ b/Constraint/Constraints/LessThan.php @@ -45,7 +45,7 @@ protected function configureOptions(OptionsResolver $resolver): void { $resolver ->setRequired(['value']) - ->setAllowedTypes('value', ['numeric', 'string']) + ->setAllowedTypes('value', ['numeric']) ; } } diff --git a/Tests/Constraint/Constraints/GreaterThanOrEqualTest.php b/Tests/Constraint/Constraints/GreaterThanOrEqualTest.php index 4aa86b0..54c1f13 100644 --- a/Tests/Constraint/Constraints/GreaterThanOrEqualTest.php +++ b/Tests/Constraint/Constraints/GreaterThanOrEqualTest.php @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void $this->expectException(InvalidOptionsException::class); new ParsleyAssert\GreaterThanOrEqual([ - 'value' => [], + 'value' => 'foo', ]); } diff --git a/Tests/Constraint/Constraints/GreaterThanTest.php b/Tests/Constraint/Constraints/GreaterThanTest.php index ff02b43..a8d0d06 100644 --- a/Tests/Constraint/Constraints/GreaterThanTest.php +++ b/Tests/Constraint/Constraints/GreaterThanTest.php @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void $this->expectException(InvalidOptionsException::class); new ParsleyAssert\GreaterThan([ - 'value' => [], + 'value' => 'foo', ]); } diff --git a/Tests/Constraint/Constraints/LessThanOrEqualTest.php b/Tests/Constraint/Constraints/LessThanOrEqualTest.php index e4d8df9..8b5fe49 100644 --- a/Tests/Constraint/Constraints/LessThanOrEqualTest.php +++ b/Tests/Constraint/Constraints/LessThanOrEqualTest.php @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void $this->expectException(InvalidOptionsException::class); new ParsleyAssert\LessThanOrEqual([ - 'value' => [], + 'value' => 'foo', ]); } @@ -58,7 +58,7 @@ public function testNormalization(): void // string $constraint = new ParsleyAssert\LessThanOrEqual([ - 'value' => 10, + 'value' => '10', ]); $this->assertSame([ diff --git a/Tests/Constraint/Constraints/LessThanTest.php b/Tests/Constraint/Constraints/LessThanTest.php index 48f069c..2e080dc 100644 --- a/Tests/Constraint/Constraints/LessThanTest.php +++ b/Tests/Constraint/Constraints/LessThanTest.php @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void $this->expectException(InvalidOptionsException::class); new ParsleyAssert\LessThan([ - 'value' => [], + 'value' => 'foo', ]); } @@ -58,7 +58,7 @@ public function testNormalization(): void // string $constraint = new ParsleyAssert\LessThan([ - 'value' => "10", + 'value' => '10', ]); $this->assertSame([