Menu

← Back to enum.*

Error Identifier: enum.implementsInternalEnum

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);

namespace App;

use Some\Internal\StatusEnum;

enum MyStatus implements StatusEnum
{
	case Active;
	case Inactive;
}

Why is it reported? #

The enum implements an internal enum from another namespace or package. Types marked with @internal are not meant to be used outside of the package or root namespace where they are defined. Using an internal enum in the implements clause creates a dependency on an implementation detail that may change without notice in future versions.

How to fix it #

Use the public (non-internal) interface or contract provided by the package instead:

 <?php declare(strict_types = 1);
 
 namespace App;

-use Some\Internal\StatusEnum;
+use Some\PublicStatusInterface;

-enum MyStatus implements StatusEnum
+enum MyStatus implements PublicStatusInterface
 {
 	case Active;
 	case Inactive;
 }

If no public alternative exists, contact the package maintainer to request a public API, or define a local interface in the application code.

How to ignore this error #

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

// @phpstan-ignore enum.implementsInternalEnum
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.implementsInternalEnum

Rules that report this error #

  • PHPStan\Rules\InternalTag\RestrictedInternalClassNameUsageExtension [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.