Menu

Error Identifier: enum.implementsInternalInterface

← Back to enum.*

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

/** @internal */
interface InternalContract
{
}

enum Status implements InternalContract
{
	case Active;
	case Inactive;
}

Why is it reported? #

The enum implements an interface that is marked as @internal. Internal interfaces are not meant to be used outside of the package that defines them. The library author may change or remove the interface without considering it a breaking change.

How to fix it #

Stop implementing the internal interface and use a public interface provided by the library instead:

-enum Status implements InternalContract
+enum Status implements PublicContract
 {
 	case Active;
 	case Inactive;
 }

If no suitable public interface exists, contact the library maintainers to request one.

How to ignore this error #

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

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

Rules that report this error #

  • PHPStan\Rules\InternalTag\RestrictedInternalClassNameUsageExtension [1]
Theme
A
© 2026 PHPStan s.r.o.