Menu

← Back to paramLaterInvokedCallable.*

Error Identifier: paramLaterInvokedCallable.nonCallable

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

class EventEmitter
{
	/**
	 * @param-later-invoked-callable $listener
	 */
	public function on(string $event, string $listener): void
	{
	}
}

Why is it reported? #

The @param-later-invoked-callable PHPDoc tag is applied to a parameter whose native type is not callable. This tag is used to tell PHPStan that the callable parameter will be invoked later (not during the current function call), which affects how PHPStan narrows types inside the callable.

In the example above, the parameter $listener has a native type of string, which is not a callable type. The @param-later-invoked-callable tag only makes sense on parameters that accept callable values such as callable, Closure, or a callable-typed parameter.

How to fix it #

Change the parameter type to a callable type:

 <?php declare(strict_types = 1);
 
 class EventEmitter
 {
 	/**
 	 * @param-later-invoked-callable $listener
 	 */
-	public function on(string $event, string $listener): void
+	public function on(string $event, callable $listener): void
 	{
 	}
 }

Or remove the @param-later-invoked-callable tag if the parameter is not intended to be callable:

 <?php declare(strict_types = 1);
 
 class EventEmitter
 {
-	/**
-	 * @param-later-invoked-callable $listener
-	 */
 	public function on(string $event, string $listener): void
 	{
 	}
 }

How to ignore this error #

You can use the identifier paramLaterInvokedCallable.nonCallable to ignore this error using a comment:

// @phpstan-ignore paramLaterInvokedCallable.nonCallable
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: paramLaterInvokedCallable.nonCallable

Rules that report this error #

  • PHPStan\Rules\PhpDoc\IncompatibleParamImmediatelyInvokedCallableRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.