Skip to content

Commit

Permalink
disallow string type in GreaterThan and LessThan
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Smeets committed Oct 15, 2020
1 parent 444fcb1 commit 89e1efe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Constraint/Constraints/GreaterThan.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function configureOptions(OptionsResolver $resolver): void
{
$resolver
->setRequired(['value'])
->setAllowedTypes('value', ['numeric', 'string'])
->setAllowedTypes('value', ['numeric'])
;
}
}
2 changes: 1 addition & 1 deletion Constraint/Constraints/LessThan.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function configureOptions(OptionsResolver $resolver): void
{
$resolver
->setRequired(['value'])
->setAllowedTypes('value', ['numeric', 'string'])
->setAllowedTypes('value', ['numeric'])
;
}
}
2 changes: 1 addition & 1 deletion Tests/Constraint/Constraints/GreaterThanOrEqualTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void
$this->expectException(InvalidOptionsException::class);

new ParsleyAssert\GreaterThanOrEqual([
'value' => [],
'value' => 'foo',
]);
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraint/Constraints/GreaterThanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void
$this->expectException(InvalidOptionsException::class);

new ParsleyAssert\GreaterThan([
'value' => [],
'value' => 'foo',
]);
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/Constraint/Constraints/LessThanOrEqualTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void
$this->expectException(InvalidOptionsException::class);

new ParsleyAssert\LessThanOrEqual([
'value' => [],
'value' => 'foo',
]);
}

Expand Down Expand Up @@ -58,7 +58,7 @@ public function testNormalization(): void

// string
$constraint = new ParsleyAssert\LessThanOrEqual([
'value' => 10,
'value' => '10',
]);

$this->assertSame([
Expand Down
4 changes: 2 additions & 2 deletions Tests/Constraint/Constraints/LessThanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testInvalidConfiguration(): void
$this->expectException(InvalidOptionsException::class);

new ParsleyAssert\LessThan([
'value' => [],
'value' => 'foo',
]);
}

Expand Down Expand Up @@ -58,7 +58,7 @@ public function testNormalization(): void

// string
$constraint = new ParsleyAssert\LessThan([
'value' => "10",
'value' => '10',
]);

$this->assertSame([
Expand Down

0 comments on commit 89e1efe

Please sign in to comment.