Skip to content

Commit c507bd3

Browse files
committed
[BCB] Remove TypeUtils::getConstantArrays()
1 parent 3d2f492 commit c507bd3

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

UPGRADING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,3 +252,4 @@ Instead of `PHPStanTestCase::createBroker()`, call `PHPStanTestCase::createRefle
252252
* Use `getFirstIterable*Type` and `getLastIterable*Type` instead
253253
* Remove `ConstantArrayType::generalizeToArray()`
254254
* Remove `TypeUtils::getArrays()`, use [`Type::getArrays()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getArrays) instead
255+
* Remove `TypeUtils::getConstantArrays()`, use [`Type::getConstantArrays()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getConstantArrays) instead

src/Type/TypeUtils.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,6 @@
2121
final class TypeUtils
2222
{
2323

24-
/**
25-
* @return ConstantArrayType[]
26-
*
27-
* @deprecated Use PHPStan\Type\Type::getConstantArrays() instead and handle optional keys if necessary.
28-
*/
29-
public static function getConstantArrays(Type $type): array
30-
{
31-
if ($type instanceof ConstantArrayType) {
32-
return $type->getAllArrays();
33-
}
34-
35-
if ($type instanceof UnionType) {
36-
$matchingTypes = [];
37-
foreach ($type->getTypes() as $innerType) {
38-
if (!$innerType instanceof ConstantArrayType) {
39-
return [];
40-
}
41-
foreach (self::getConstantArrays($innerType) as $innerInnerType) {
42-
$matchingTypes[] = $innerInnerType;
43-
}
44-
}
45-
46-
return $matchingTypes;
47-
}
48-
49-
return [];
50-
}
51-
5224
/**
5325
* @return ConstantStringType[]
5426
*

0 commit comments

Comments
 (0)