|
16 | 16 | use PHPStan\TrinaryLogic; |
17 | 17 | use PHPStan\Type\ArrayType; |
18 | 18 | use PHPStan\Type\BooleanType; |
19 | | -use PHPStan\Type\Constant\ConstantArrayType; |
20 | 19 | use PHPStan\Type\Constant\ConstantBooleanType; |
21 | | -use PHPStan\Type\Constant\ConstantFloatType; |
22 | 20 | use PHPStan\Type\Constant\ConstantIntegerType; |
23 | | -use PHPStan\Type\Constant\ConstantStringType; |
| 21 | +use PHPStan\Type\ConstantScalarType; |
24 | 22 | use PHPStan\Type\ErrorType; |
25 | | -use PHPStan\Type\IntegerType; |
| 23 | +use PHPStan\Type\FloatType; |
26 | 24 | use PHPStan\Type\MixedType; |
27 | 25 | use PHPStan\Type\NullType; |
28 | | -use PHPStan\Type\ObjectWithoutClassType; |
29 | 26 | use PHPStan\Type\StringType; |
30 | 27 | use PHPStan\Type\Type; |
31 | 28 | use PHPStan\Type\UnionType; |
@@ -207,16 +204,18 @@ public function looseCompare(Type $type): BooleanType |
207 | 204 | return new ConstantBooleanType(true); |
208 | 205 | } |
209 | 206 |
|
210 | | - if ($type->isConstantArray()->yes() && $type->isIterableAtLeastOnce()->no()) |
211 | | - { |
| 207 | + if ($type instanceof ConstantScalarType) { |
| 208 | + return new ConstantBooleanType(false); |
| 209 | + } |
| 210 | + |
| 211 | + if ($type->isConstantArray()->yes() && $type->isIterableAtLeastOnce()->no()) { |
212 | 212 | return new ConstantBooleanType(false); |
213 | 213 | } |
214 | 214 |
|
215 | 215 | $looseFalse = new UnionType([ |
216 | | - new ConstantBooleanType(false), |
217 | 216 | new StringType(), |
218 | 217 | new NullType(), |
219 | | - new IntegerType() |
| 218 | + new FloatType(), |
220 | 219 | ]); |
221 | 220 |
|
222 | 221 | if ($looseFalse->isSuperTypeOf($type)->yes()) { |
|
0 commit comments