|
5 | 5 | namespace staabm\PHPStanDba\QueryReflection; |
6 | 6 |
|
7 | 7 | use PHPStan\ShouldNotHappenException; |
8 | | -use PHPStan\Type\Accessory\AccessoryType; |
9 | | -use PHPStan\Type\ArrayType; |
10 | 8 | use PHPStan\Type\ConstantScalarType; |
11 | 9 | use PHPStan\Type\ErrorType; |
12 | 10 | use PHPStan\Type\IntersectionType; |
@@ -36,8 +34,8 @@ public static function simulateParamValueType(Type $paramType, bool $preparedPar |
36 | 34 | return (string) $paramType->getValue(); |
37 | 35 | } |
38 | 36 |
|
39 | | - if ($paramType instanceof ArrayType) { |
40 | | - return self::simulateParamValueType($paramType->getItemType(), $preparedParam); |
| 37 | + if ($paramType->isArray()->yes()) { |
| 38 | + return self::simulateParamValueType($paramType->getIterableValueType(), $preparedParam); |
41 | 39 | } |
42 | 40 |
|
43 | 41 | if ( |
@@ -92,19 +90,6 @@ public static function simulateParamValueType(Type $paramType, bool $preparedPar |
92 | 90 | return null; |
93 | 91 | } |
94 | 92 |
|
95 | | - if ($paramType instanceof IntersectionType) { |
96 | | - foreach ($paramType->getTypes() as $type) { |
97 | | - if ($type instanceof AccessoryType) { |
98 | | - continue; |
99 | | - } |
100 | | - |
101 | | - $simulated = self::simulateParamValueType($type, $preparedParam); |
102 | | - if (null !== $simulated) { |
103 | | - return $simulated; |
104 | | - } |
105 | | - } |
106 | | - } |
107 | | - |
108 | 93 | // all types which we can't simulate and render a query unresolvable at analysis time |
109 | 94 | if ($paramType instanceof MixedType || $paramType instanceof IntersectionType) { |
110 | 95 | if (QueryReflection::getRuntimeConfiguration()->isDebugEnabled()) { |
|
0 commit comments