Menu

Error Identifier: argument.parameterRenamedInSubtype

← Back to argument.*

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

interface Logger
{
	public function log(string $message): void;
}

class FileLogger implements Logger
{
	public function log(string $text): void
	{
	}
}

function doLog(Logger $logger): void
{
	$logger->log(message: 'Hello');
}

Why is it reported? #

The call uses a named argument message: based on the parameter name defined in Logger::log(), but FileLogger renames that parameter to $text. If the actual object at runtime is a FileLogger, PHP will throw an Error because it does not recognize the named argument message.

Named arguments in PHP 8.0+ are matched by name, not position. When a subclass or implementation renames a parameter, calls using the parent’s parameter name will fail at runtime for instances of the subclass.

How to fix it #

Rename the parameter in the subtype to match the parent definition:

 class FileLogger implements Logger
 {
-	public function log(string $text): void
+	public function log(string $message): void
 	{
 	}
 }

Alternatively, use positional arguments instead of named arguments:

 function doLog(Logger $logger): void
 {
-	$logger->log(message: 'Hello');
+	$logger->log('Hello');
 }

How to ignore this error #

You can use the identifier argument.parameterRenamedInSubtype to ignore this error using a comment:

// @phpstan-ignore argument.parameterRenamedInSubtype
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: argument.parameterRenamedInSubtype

Rules that report this error #

  • PHPStan\Rules\Methods\MethodCallWithPossiblyRenamedNamedArgumentRule [1]
Theme
A
© 2026 PHPStan s.r.o.