Skip to content

Commit a259025

Browse files
authored
Simplify QuerySimulation (#685)
1 parent 6956068 commit a259025

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/QueryReflection/QuerySimulation.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
use PHPStan\ShouldNotHappenException;
88
use PHPStan\Type\Accessory\AccessoryType;
99
use PHPStan\Type\ArrayType;
10-
use PHPStan\Type\BooleanType;
1110
use PHPStan\Type\ConstantScalarType;
1211
use PHPStan\Type\ErrorType;
13-
use PHPStan\Type\FloatType;
14-
use PHPStan\Type\IntegerType;
1512
use PHPStan\Type\IntersectionType;
1613
use PHPStan\Type\MixedType;
1714
use PHPStan\Type\ObjectType;
@@ -43,22 +40,15 @@ public static function simulateParamValueType(Type $paramType, bool $preparedPar
4340
return self::simulateParamValueType($paramType->getItemType(), $preparedParam);
4441
}
4542

46-
$integerType = new IntegerType();
47-
if ($integerType->isSuperTypeOf($paramType)->yes()) {
48-
return '1';
49-
}
50-
51-
$booleanType = new BooleanType();
52-
if ($booleanType->isSuperTypeOf($paramType)->yes()) {
53-
return '1';
54-
}
55-
56-
if ($paramType->isNumericString()->yes()) {
43+
if (
44+
$paramType->isInteger()->yes()
45+
|| $paramType->isBoolean()->yes()
46+
|| $paramType->isNumericString()->yes()
47+
) {
5748
return '1';
5849
}
5950

60-
$floatType = new FloatType();
61-
if ($floatType->isSuperTypeOf($paramType)->yes()) {
51+
if ($paramType->isFloat()->yes()) {
6252
return '1.0';
6353
}
6454

0 commit comments

Comments
 (0)