From 8ac24caf74c6583aadd1e485a3153619f40c2543 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 31 Jul 2026 07:34:11 +0200 Subject: [PATCH] Improve `#[InstanceofDeprecated]` message of EnumCaseObjectType --- phpstan-baseline.neon | 6 +++--- src/Type/Enum/EnumCaseObjectType.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 02b99ed61bb..35780732270 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1078,7 +1078,7 @@ parameters: path: src/Type/Constant/OversizedArrayBuilder.php - - rawMessage: 'Doing instanceof PHPStan\Type\Enum\EnumCaseObjectType is error-prone and deprecated. Use Type::getEnumCases() instead.' + rawMessage: 'Doing instanceof PHPStan\Type\Enum\EnumCaseObjectType is error-prone and deprecated. Use Type::getEnumCaseObject() or Type::getEnumCases() instead.' identifier: phpstanApi.instanceofType count: 2 path: src/Type/Enum/EnumCaseObjectType.php @@ -1432,7 +1432,7 @@ parameters: path: src/Type/IntersectionType.php - - rawMessage: 'Doing instanceof PHPStan\Type\Enum\EnumCaseObjectType is error-prone and deprecated. Use Type::getEnumCases() instead.' + rawMessage: 'Doing instanceof PHPStan\Type\Enum\EnumCaseObjectType is error-prone and deprecated. Use Type::getEnumCaseObject() or Type::getEnumCases() instead.' identifier: phpstanApi.instanceofType count: 1 path: src/Type/IntersectionType.php @@ -1762,7 +1762,7 @@ parameters: path: src/Type/UnionTypeHelper.php - - rawMessage: 'Doing instanceof PHPStan\Type\Enum\EnumCaseObjectType is error-prone and deprecated. Use Type::getEnumCases() instead.' + rawMessage: 'Doing instanceof PHPStan\Type\Enum\EnumCaseObjectType is error-prone and deprecated. Use Type::getEnumCaseObject() or Type::getEnumCases() instead.' identifier: phpstanApi.instanceofType count: 2 path: src/Type/UnionTypeHelper.php diff --git a/src/Type/Enum/EnumCaseObjectType.php b/src/Type/Enum/EnumCaseObjectType.php index ca0e976e787..ef5596500ca 100644 --- a/src/Type/Enum/EnumCaseObjectType.php +++ b/src/Type/Enum/EnumCaseObjectType.php @@ -32,7 +32,7 @@ use function sprintf; /** @api */ -#[InstanceofDeprecated(insteadUse: 'Type::getEnumCases()')] +#[InstanceofDeprecated(insteadUse: 'Type::getEnumCaseObject() or Type::getEnumCases()')] class EnumCaseObjectType extends ObjectType {