Failed to create closure from callable: %s

Description

This error message signals that the Closure class could not check the availability of the method to create a closure.

In the illustration code, the class A does not exists. The new Closure is checked at calling time of Closure::fromCallable.

The description of the problem is at the end of the error message, and may vary depending on the situation.

Example

<?php

Closure::fromCallable(['a', 'b']);

?>

Literal Examples

  • Failed to create closure from callable: class a does not exist

Solutions

  • Pass the array around, and call Closure::fromCallable at the last moment.

  • Create a hard coded closure.

See Also