Skip to content

Commit 3d2f492

Browse files
committed
[BCB] Remove TypeUtils::getArrays()
1 parent 6a69561 commit 3d2f492

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

UPGRADING.md

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

src/Type/TypeUtils.php

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

24-
/**
25-
* @return ArrayType[]
26-
*
27-
* @deprecated Use PHPStan\Type\Type::getArrays() instead and handle optional ConstantArrayType keys if necessary.
28-
*/
29-
public static function getArrays(Type $type): array
30-
{
31-
if ($type instanceof ConstantArrayType) {
32-
return $type->getAllArrays();
33-
}
34-
35-
if ($type instanceof ArrayType) {
36-
return [$type];
37-
}
38-
39-
if ($type instanceof UnionType) {
40-
$matchingTypes = [];
41-
foreach ($type->getTypes() as $innerType) {
42-
if (!$innerType instanceof ArrayType) {
43-
return [];
44-
}
45-
foreach (self::getArrays($innerType) as $innerInnerType) {
46-
$matchingTypes[] = $innerInnerType;
47-
}
48-
}
49-
50-
return $matchingTypes;
51-
}
52-
53-
if ($type instanceof IntersectionType) {
54-
$matchingTypes = [];
55-
foreach ($type->getTypes() as $innerType) {
56-
if (!$innerType instanceof ArrayType) {
57-
continue;
58-
}
59-
foreach (self::getArrays($innerType) as $innerInnerType) {
60-
$matchingTypes[] = $innerInnerType;
61-
}
62-
}
63-
64-
return $matchingTypes;
65-
}
66-
67-
return [];
68-
}
69-
7024
/**
7125
* @return ConstantArrayType[]
7226
*

0 commit comments

Comments
 (0)