Menu

← Back to staticProperty.*

Error Identifier: staticProperty.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);

namespace App;

// Defined in a third-party package:
// namespace ThirdParty;
// /** @internal */
// interface Config {
//     public static string $defaultValue;
// }

use ThirdParty\Config;

$value = Config::$defaultValue;

Why is it reported? #

A static property is being accessed on an interface that is marked as @internal. Internal interfaces are not part of the public API of the package that defines them. They may change or be removed in any version without notice.

This error can occur in two scenarios:

  • The interface itself is internal, and a static property is accessed on it.
  • The static property is accessed on a class, but the declaring class of the property is an internal interface.

How to fix it #

Use the public API of the package instead of accessing static properties on internal interfaces:

 <?php declare(strict_types = 1);
 
 namespace App;

-use ThirdParty\Config;
+use ThirdParty\PublicConfig;

-$value = Config::$defaultValue;
+$value = PublicConfig::$defaultValue;

If the interface is internal to your own project, the error will not be reported when accessing it from within the same root namespace.

How to ignore this error #

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

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

Rules that report this error #

  • PHPStan\Rules\InternalTag\RestrictedInternalClassNameUsageExtension [1]
  • PHPStan\Rules\InternalTag\RestrictedInternalPropertyUsageExtension [1] [2]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.