Menu

← Back to function.*

Error Identifier: function.internal

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;

function doFoo(): void
{
	\SomeLibrary\internalHelper();
}

Where \SomeLibrary\internalHelper() is declared as:

namespace SomeLibrary;

/** @internal */
function internalHelper(): void
{
}

Why is it reported? #

The function being called is marked with the @internal PHPDoc tag. Internal functions are not part of the public API and are intended to be used only within the package or root namespace where they are defined. Calling an internal function from outside its root namespace creates a dependency on an implementation detail that may change or be removed without notice in future versions.

How to fix it #

Use a public API function provided by the library instead:

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

 function doFoo(): void
 {
-	\SomeLibrary\internalHelper();
+	\SomeLibrary\publicHelper();
 }

If no public alternative exists, contact the library maintainer to request a public API for the functionality, or implement the needed functionality directly in the application code.

How to ignore this error #

You can use the identifier function.internal to ignore this error using a comment:

// @phpstan-ignore function.internal
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: function.internal

Rules that report this error #

  • PHPStan\Rules\InternalTag\RestrictedInternalFunctionUsageExtension [1] [2]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.