Skip to content

Commit

Permalink
Don't cast floats to booleans.
Browse files Browse the repository at this point in the history
  • Loading branch information
prwater committed Feb 27, 2019
1 parent ee22720 commit 7ec9fbd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cast.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ public static function toManBool($value, ?bool $default = null): bool
return $default;
}

if ($value===true || $value===1 || $value==='1' || $value===1.0)
if ($value===true || $value===1 || $value==='1')
{
return true;
}

if ($value===false || $value===0 || $value==='0' || $value===0.0)
if ($value===false || $value===0 || $value==='0')
{
return false;
}
Expand Down

0 comments on commit 7ec9fbd

Please sign in to comment.