Menu

← Back to callable.*

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

function doFoo(int $value): void
{
	$value();
}

Why is it reported? #

An expression that is not callable is being invoked as a function. In the example above, $value is an int, which cannot be called as a function. Attempting to invoke a non-callable type will cause a runtime error.

How to fix it #

Ensure the variable being invoked is actually a callable type:

 <?php declare(strict_types = 1);
 
-function doFoo(int $value): void
+function doFoo(callable $value): void
 {
 	$value();
 }

How to ignore this error #

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

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

Rules that report this error #

  • PHPStan\Rules\Functions\CallCallablesRule [1] [2]
  • PHPStan\Rules\Functions\FunctionCallableRule [1] [2]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.