Menu

← Back to enum.*

Error Identifier: enum.implementsDeprecatedEnum

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

<?php declare(strict_types = 1); // lint >= 8.1

/** @deprecated */
interface DeprecatedEnumInterface
{
}

enum Color implements DeprecatedEnumInterface
{
	case Red;
	case Blue;
}

Why is it reported? #

The enum implements an interface that is marked as @deprecated. Depending on deprecated interfaces ties the enum to an API that is planned for removal. This rule is provided by phpstan-deprecation-rules.

How to fix it #

Replace the deprecated interface with its non-deprecated successor:

-enum Color implements DeprecatedEnumInterface
+enum Color implements ReplacementInterface
 {
 	case Red;
 	case Blue;
 }

If no replacement is available, consult the deprecation notice for migration instructions.

How to ignore this error #

You can use the identifier enum.implementsDeprecatedEnum to ignore this error using a comment:

// @phpstan-ignore enum.implementsDeprecatedEnum
codeThatProducesTheError();

You can also use only the identifier key to ignore all errors of the same type in your configuration file in the ignoreErrors parameter:

parameters:
	ignoreErrors:
		-
			identifier: enum.implementsDeprecatedEnum

Rules that report this error #

  • PHPStan\Rules\Deprecations\RestrictedDeprecatedClassNameUsageExtension [1] phpstan/phpstan-deprecation-rules

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.