Skip to content

Commit

Permalink
add float type to integerish assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
acasademont authored and ondrejmirtes committed Jan 31, 2021
1 parent 2873b44 commit 1657403
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
18 changes: 3 additions & 15 deletions src/Type/WebMozartAssert/AssertTypeSpecifyingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,9 @@ private static function getExpressionResolvers(): array
);
},
'integerish' => function (Scope $scope, Arg $value): \PhpParser\Node\Expr {
return new \PhpParser\Node\Expr\BinaryOp\BooleanOr(
new \PhpParser\Node\Expr\BinaryOp\BooleanAnd(
new \PhpParser\Node\Expr\FuncCall(
new \PhpParser\Node\Name('is_string'),
[$value]
),
new \PhpParser\Node\Expr\FuncCall(
new \PhpParser\Node\Name('is_numeric'),
[$value]
)
),
new \PhpParser\Node\Expr\FuncCall(
new \PhpParser\Node\Name('is_int'),
[$value]
)
return new \PhpParser\Node\Expr\FuncCall(
new \PhpParser\Node\Name('is_numeric'),
[$value]
);
},
'numeric' => function (Scope $scope, Arg $value): \PhpParser\Node\Expr {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function testExtension(): void
116,
],
[
'Variable $ad is: int|(string&numeric)',
'Variable $ad is: float|int|(string&numeric)',
119,
],
[
Expand Down

0 comments on commit 1657403

Please sign in to comment.