Skip to content

Commit 573ef62

Browse files
committed
Get rid of last instanceof in extension
1 parent 161d268 commit 573ef62

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,12 +1461,6 @@ parameters:
14611461
count: 1
14621462
path: src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php
14631463

1464-
-
1465-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantArrayType is error\-prone and deprecated\. Use Type\:\:getConstantArrays\(\) instead\.$#'
1466-
identifier: phpstanApi.instanceofType
1467-
count: 1
1468-
path: src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php
1469-
14701464
-
14711465
message: '#^Doing instanceof PHPStan\\Type\\ConstantScalarType is error\-prone and deprecated\. Use Type\:\:isConstantScalarValue\(\) or Type\:\:getConstantScalarTypes\(\) or Type\:\:getConstantScalarValues\(\) instead\.$#'
14721466
identifier: phpstanApi.instanceofType

src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection,
4545
$argType = $scope->getType($arg->value);
4646

4747
if ($arg->unpack) {
48-
if ($argType instanceof ConstantArrayType) {
49-
$argTypesFound = $argType->getValueTypes();
48+
if ($argType->isConstantArray()->yes()) {
49+
$argTypesFound = [];
50+
foreach ($argType->getConstantArrays() as $constantArray) {
51+
foreach ($constantArray->getValueTypes() as $valueType) {
52+
$argTypesFound[] = $valueType;
53+
}
54+
}
5055
} else {
5156
$argTypesFound = [$argType->getIterableValueType()];
5257
}

0 commit comments

Comments
 (0)