Menu

Error Identifier: parameter.superglobal

← Back to parameter.*

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);

function doFoo($_GET): void
{
}

Why is it reported? #

PHP superglobal variables ($_GET, $_POST, $_SERVER, $_FILES, $_COOKIE, $_SESSION, $_REQUEST, $_ENV, $GLOBALS) have special meaning in the language. Using one of these names as a function or method parameter shadows the superglobal, making the global value inaccessible inside the function and creating confusing code. PHP itself may also produce unexpected behaviour when a superglobal name is reused as a parameter.

How to fix it #

Rename the parameter to something descriptive that does not collide with a superglobal:

-function doFoo($_GET): void
+function doFoo(array $queryParams): void
 {
 }

Non-ignorable error #

This error cannot be ignored using @phpstan-ignore or the ignoreErrors configuration. Non-ignorable errors indicate code that would cause a crash or a fatal error at runtime, or a fundamental problem in the analysed code that must be addressed.

Rules that report this error #

  • PHPStan\Rules\Functions\InvalidParameterNameRule [1]
Theme
A
© 2026 PHPStan s.r.o.