Skip to content

Commit

Permalink
Fix "IntVal" considering boolean values as valid
Browse files Browse the repository at this point in the history
The commit 54d17ab tried to fix the that "IntVal" would pass with values
that are not considered as an integer, but it does not change

Even thought the commit 54d17ab fixes part of the wrong behaviour it
left out the filter for boolean values.

Co-authored-by: Henrique Moody <[email protected]>
  • Loading branch information
Adam Benson and henriquemoody committed Jun 28, 2018
1 parent 54d17ab commit f5ca4a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Rules/IntVal.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class IntVal extends AbstractRule
{
public function validate($input)
{
if (is_float($input)) {
if (is_float($input) || is_bool($input)) {
return false;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/unit/Rules/IntValTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public function providerForNotInt()
['1.0'],
[1.0],
[' '],
[true],
[false],
['Foo'],
['1.44'],
[1e-5],
Expand Down

0 comments on commit f5ca4a2

Please sign in to comment.