Skip to content

Commit d5ae423

Browse files
committed
fix union types
1 parent 8e5c640 commit d5ae423

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/Analyser/TypeSpecifier.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1589,7 +1589,6 @@ private function getConditionalSpecifiedTypes(
15891589
$argumentExpr instanceof Node\Scalar
15901590
|| ($argumentExpr instanceof ConstFetch && in_array(strtolower($argumentExpr->name->toString()), ['true', 'false', 'null'], true))
15911591
)
1592-
&& $targetType->isConstantScalarValue()->yes()
15931592
) {
15941593
return null;
15951594
}

tests/PHPStan/Rules/Comparison/data/check-type-function-call.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ public function test(string $str, float $float)
9999
if (is_numeric($str)) {
100100

101101
}
102-
if (is_numeric('123')) {
102+
$x='123'; if (is_numeric($x)) {
103103

104104
}
105-
if (is_numeric('blabla')) {
105+
$y='blabla'; if (is_numeric($y)) {
106106

107107
}
108108

@@ -715,8 +715,8 @@ class AssertIsNumeric
715715
public function doFoo(string $str, float $float)
716716
{
717717
assert(is_numeric($str));
718-
assert(is_numeric('123'));
719-
assert(is_numeric('blabla'));
718+
$x='123'; assert(is_numeric($x));
719+
$y='blabla'; assert(is_numeric($y));
720720

721721
$isNumeric = $float;
722722
if (doFoo()) {

0 commit comments

Comments
 (0)