Skip to content

Commit dffa34b

Browse files
authored
Support more array types (#687)
1 parent 31a21b6 commit dffa34b

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/QueryReflection/QuerySimulation.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
namespace staabm\PHPStanDba\QueryReflection;
66

77
use PHPStan\ShouldNotHappenException;
8-
use PHPStan\Type\Accessory\AccessoryType;
9-
use PHPStan\Type\ArrayType;
108
use PHPStan\Type\ConstantScalarType;
119
use PHPStan\Type\ErrorType;
1210
use PHPStan\Type\IntersectionType;
@@ -36,8 +34,8 @@ public static function simulateParamValueType(Type $paramType, bool $preparedPar
3634
return (string) $paramType->getValue();
3735
}
3836

39-
if ($paramType instanceof ArrayType) {
40-
return self::simulateParamValueType($paramType->getItemType(), $preparedParam);
37+
if ($paramType->isArray()->yes()) {
38+
return self::simulateParamValueType($paramType->getIterableValueType(), $preparedParam);
4139
}
4240

4341
if (
@@ -92,19 +90,6 @@ public static function simulateParamValueType(Type $paramType, bool $preparedPar
9290
return null;
9391
}
9492

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-
10893
// all types which we can't simulate and render a query unresolvable at analysis time
10994
if ($paramType instanceof MixedType || $paramType instanceof IntersectionType) {
11095
if (QueryReflection::getRuntimeConfiguration()->isDebugEnabled()) {

0 commit comments

Comments
 (0)