Skip to content

Commit 62a2bdf

Browse files
Etienne V. Labellestaabm
authored andcommitted
Replace instanceof ConstantStringType with getConstantStrings() API
1 parent 4687a8f commit 62a2bdf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Extensions/PdoStatementExecuteTypeSpecifyingExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use PHPStan\Reflection\MethodReflection;
1515
use PHPStan\Type\Constant\ConstantArrayType;
1616
use PHPStan\Type\Constant\ConstantIntegerType;
17-
use PHPStan\Type\Constant\ConstantStringType;
1817
use PHPStan\Type\MethodTypeSpecifyingExtension;
1918
use PHPStan\Type\Type;
2019
use staabm\PHPStanDba\PdoReflection\PdoStatementReflection;
@@ -84,8 +83,9 @@ private function inferStatementType(MethodReflection $methodReflection, MethodCa
8483
$bindArgs = $bindCall->getArgs();
8584
if (\count($bindArgs) >= 2) {
8685
$keyType = $scope->getType($bindArgs[0]->value);
87-
if ($keyType instanceof ConstantIntegerType || $keyType instanceof ConstantStringType) {
88-
$parameterKeys[] = $keyType;
86+
$constantStrings = $keyType->getConstantStrings();
87+
if ($keyType instanceof ConstantIntegerType || [] !== $constantStrings) {
88+
$parameterKeys[] = [] !== $constantStrings ? $constantStrings[0] : $keyType;
8989
$parameterValues[] = $scope->getType($bindArgs[1]->value);
9090
}
9191
}

0 commit comments

Comments
 (0)