Menu

← Back to mixin.*

Error Identifier: mixin.internalClass

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 */
class QueryHelper
{
	public function execute(): void {}
}
<?php declare(strict_types = 1);

// In your code:

namespace App;

use SomeLibrary\QueryHelper;

/**
 * @mixin QueryHelper
 */
class Repository
{
}

Why is it reported? #

The @mixin PHPDoc tag references a class that is marked as @internal. Internal types are not meant to be used outside of the package or namespace where they are defined. Depending on internal classes in your @mixin declarations creates a fragile dependency on implementation details that can change without notice.

How to fix it #

Use a public (non-internal) class in the @mixin tag instead:

 /**
- * @mixin QueryHelper
+ * @mixin PublicQueryInterface
  */
 class Repository
 {
 }

If you need the functionality provided by the internal class, check whether the library provides a public API, or implement the methods directly in your class.

How to ignore this error #

You can use the identifier mixin.internalClass to ignore this error using a comment:

// @phpstan-ignore mixin.internalClass
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: mixin.internalClass

Rules that report this error #

  • PHPStan\Rules\InternalTag\RestrictedInternalClassNameUsageExtension [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.