Menu

Error Identifier: property.internalInterface

← Back to property.*

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 {
		public function execute(): void;
	}
}

namespace App {
	class Foo {
		public \Vendor\InternalInterface $service; // error: Property $service references internal interface Vendor\InternalInterface in its type.
	}
}

Why is it reported? #

A property’s native type declaration references an interface that has been marked as @internal. Internal interfaces are implementation details of their package and are not meant to be used by external code. They may change or be removed without notice in future versions. Using an internal interface in a property type creates a fragile dependency on implementation details.

How to fix it #

Replace the internal interface with the package’s public API:

 namespace App {
 	class Foo {
-		public \Vendor\InternalInterface $service;
+		public \Vendor\PublicInterface $service;
 	}
 }

If no public alternative exists, contact the library maintainers to request a public API for the functionality.

How to ignore this error #

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

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

Rules that report this error #

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