Skip to content

Commit 1657403

Browse files
acasademontondrejmirtes
authored andcommitted
add float type to integerish assertion
1 parent 2873b44 commit 1657403

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/Type/WebMozartAssert/AssertTypeSpecifyingExtension.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,9 @@ private static function getExpressionResolvers(): array
202202
);
203203
},
204204
'integerish' => function (Scope $scope, Arg $value): \PhpParser\Node\Expr {
205-
return new \PhpParser\Node\Expr\BinaryOp\BooleanOr(
206-
new \PhpParser\Node\Expr\BinaryOp\BooleanAnd(
207-
new \PhpParser\Node\Expr\FuncCall(
208-
new \PhpParser\Node\Name('is_string'),
209-
[$value]
210-
),
211-
new \PhpParser\Node\Expr\FuncCall(
212-
new \PhpParser\Node\Name('is_numeric'),
213-
[$value]
214-
)
215-
),
216-
new \PhpParser\Node\Expr\FuncCall(
217-
new \PhpParser\Node\Name('is_int'),
218-
[$value]
219-
)
205+
return new \PhpParser\Node\Expr\FuncCall(
206+
new \PhpParser\Node\Name('is_numeric'),
207+
[$value]
220208
);
221209
},
222210
'numeric' => function (Scope $scope, Arg $value): \PhpParser\Node\Expr {

tests/Type/WebMozartAssert/AssertTypeSpecifyingExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function testExtension(): void
153153
116,
154154
],
155155
[
156-
'Variable $ad is: int|(string&numeric)',
156+
'Variable $ad is: float|int|(string&numeric)',
157157
119,
158158
],
159159
[

0 commit comments

Comments
 (0)