Menu

← Back to requireExtends.*

Error Identifier: requireExtends.internalInterface

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:

namespace SomeLibrary;

/** @internal */
interface InternalInterface
{
}
<?php declare(strict_types = 1);

// In your code:

namespace App;

use SomeLibrary\InternalInterface;

/**
 * @phpstan-require-extends InternalInterface
 */
interface MyInterface
{
}

Why is it reported? #

The @phpstan-require-extends PHPDoc tag references an interface that is marked as @internal. Internal interfaces are not part of the public API of the package that defines them and may change or be removed without notice. Depending on them in a @phpstan-require-extends constraint creates a fragile dependency on implementation details.

How to fix it #

Use a public (non-internal) interface in the @phpstan-require-extends tag:

 /**
- * @phpstan-require-extends InternalInterface
+ * @phpstan-require-extends PublicInterface
  */
 interface MyInterface
 {
 }

If the interface is internal to your own project, the error is not reported when the usage is within the same root namespace. Reorganize your namespaces so that internal types are only used within their own namespace boundary.

How to ignore this error #

You can use the identifier requireExtends.internalInterface to ignore this error using a comment:

// @phpstan-ignore requireExtends.internalInterface
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: requireExtends.internalInterface

Rules that report this error #

  • PHPStan\Rules\InternalTag\RestrictedInternalClassNameUsageExtension [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.