Menu

Error Identifier: class.implementsInternalInterface

← Back to class.*

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 Vendor {
	/** @internal */
	interface InternalInterface {}
}

namespace App {
	class MyClass implements \Vendor\InternalInterface {}
}

Why is it reported? #

The interface in the implements clause is marked as @internal by its defining library. Internal symbols are implementation details that can change or be removed without notice in any release. Implementing an internal interface from a third-party package creates a fragile dependency that may break unexpectedly.

How to fix it #

Use a public (non-internal) interface provided by the library instead:

-class MyClass implements \Vendor\InternalInterface {}
+class MyClass implements \Vendor\PublicInterface {}

If no public alternative exists, consider whether the library provides a different extension mechanism, such as extending a base class or using composition.

How to ignore this error #

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

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

Rules that report this error #

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