Skip to content

Commit 6e263d0

Browse files
committed
[BCB] Remove TypeUtils::getDirectClassNames()
1 parent 426d948 commit 6e263d0

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

UPGRADING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,4 @@ Instead of `PHPStanTestCase::createBroker()`, call `PHPStanTestCase::createRefle
256256
* Remove `TypeUtils::getConstantStrings()`, use [`Type::getConstantStrings()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getConstantStrings) instead
257257
* Remove `TypeUtils::getConstantTypes()` and `getAnyConstantTypes()`, use [`Type::isConstantValue()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_isConstantValue) or [`Type::generalize()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_generalize)
258258
* Remove `TypeUtils::generalizeType()`, use [`Type::generalize()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_generalize) instead
259+
* Remove `TypeUtils::getDirectClassNames()`, use [`Type::getObjectClassNames()`](https://apiref.phpstan.org/2.0.x/PHPStan.Type.Type.html#_getObjectClassNames) instead.

src/Type/TypeUtils.php

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
use PHPStan\Type\Generic\TemplateType;
1212
use PHPStan\Type\Generic\TemplateUnionType;
1313
use function array_merge;
14-
use function array_unique;
15-
use function array_values;
1614

1715
/**
1816
* @api
@@ -28,31 +26,6 @@ public static function getConstantIntegers(Type $type): array
2826
return self::map(ConstantIntegerType::class, $type, false);
2927
}
3028

31-
/**
32-
* @return list<string>
33-
*
34-
* @deprecated Use Type::getObjectClassNames() instead.
35-
*/
36-
public static function getDirectClassNames(Type $type): array
37-
{
38-
if ($type instanceof TypeWithClassName) {
39-
return [$type->getClassName()];
40-
}
41-
42-
if ($type instanceof UnionType || $type instanceof IntersectionType) {
43-
$classNames = [];
44-
foreach ($type->getTypes() as $innerType) {
45-
foreach (self::getDirectClassNames($innerType) as $n) {
46-
$classNames[] = $n;
47-
}
48-
}
49-
50-
return array_values(array_unique($classNames));
51-
}
52-
53-
return [];
54-
}
55-
5629
/**
5730
* @return IntegerRangeType[]
5831
*/

0 commit comments

Comments
 (0)