Skip to content

Commit 75e06bd

Browse files
committed
Get rid of last instanceof in extension
1 parent 4556931 commit 75e06bd

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
@@ -1467,12 +1467,6 @@ parameters:
14671467
count: 1
14681468
path: src/Type/Php/ArrayKeyExistsFunctionTypeSpecifyingExtension.php
14691469

1470-
-
1471-
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantArrayType is error\-prone and deprecated\. Use Type\:\:getConstantArrays\(\) instead\.$#'
1472-
identifier: phpstanApi.instanceofType
1473-
count: 1
1474-
path: src/Type/Php/ArrayMergeFunctionDynamicReturnTypeExtension.php
1475-
14761470
-
14771471
message: '#^Doing instanceof PHPStan\\Type\\Constant\\ConstantBooleanType is error\-prone and deprecated\. Use Type\:\:isTrue\(\) or Type\:\:isFalse\(\) instead\.$#'
14781472
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)