|
13 | 13 | use PHPStan\Type\Constant\ConstantArrayType; |
14 | 14 | use PHPStan\Type\Constant\ConstantBooleanType; |
15 | 15 | use PHPStan\Type\Constant\ConstantIntegerType; |
| 16 | +use PHPStan\Type\Constant\ConstantStringType; |
16 | 17 | use PHPStan\Type\ErrorType; |
17 | 18 | use PHPStan\Type\FloatType; |
18 | 19 | use PHPStan\Type\GeneralizePrecision; |
19 | 20 | use PHPStan\Type\IntegerType; |
20 | 21 | use PHPStan\Type\IntersectionType; |
21 | 22 | use PHPStan\Type\IsSuperTypeOfResult; |
| 23 | +use PHPStan\Type\NullType; |
22 | 24 | use PHPStan\Type\ObjectWithoutClassType; |
23 | | -use PHPStan\Type\StaticTypeFactory; |
24 | 25 | use PHPStan\Type\StringType; |
25 | 26 | use PHPStan\Type\Traits\MaybeCallableTypeTrait; |
26 | 27 | use PHPStan\Type\Traits\NonArrayTypeTrait; |
@@ -352,8 +353,13 @@ public function isScalar(): TrinaryLogic |
352 | 353 |
|
353 | 354 | public function looseCompare(Type $type, PhpVersion $phpVersion): BooleanType |
354 | 355 | { |
355 | | - $falseyTypes = StaticTypeFactory::falsey(); |
356 | | - if ($falseyTypes->isSuperTypeOf($type)->yes()) { |
| 356 | + $dominated = TypeCombinator::union( |
| 357 | + new NullType(), |
| 358 | + new ConstantBooleanType(false), |
| 359 | + new ConstantStringType(''), |
| 360 | + new ConstantArrayType([], []), |
| 361 | + ); |
| 362 | + if ($dominated->isSuperTypeOf($type)->yes()) { |
357 | 363 | return new ConstantBooleanType(false); |
358 | 364 | } |
359 | 365 |
|
|
0 commit comments