Menu

← Back to enum.*

Error Identifier: enum.implementsInternalClass

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

// In package vendor/some-library:

/** @internal */
class InternalService
{
}

// In your code:

enum Status implements InternalService // error
{
	case Active;
}

Why is it reported? #

The enum implements a class that is marked as @internal. Internal classes are not meant to be used outside of the package that defines them, as they may change or be removed without notice. Additionally, a class cannot be used in an implements clause at all – only interfaces can.

How to fix it #

Use only public (non-internal) interfaces in the implements clause of your enum:

 <?php declare(strict_types = 1);
 
-enum Status implements InternalService
+enum Status implements PublicInterface
 {
 	case Active;
 }

How to ignore this error #

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

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

Rules that report this error #

  • PHPStan\Rules\InternalTag\RestrictedInternalClassNameUsageExtension [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.