Current function is not a closure¶
Description¶
The Closure::getCurrent() method may only be called inside a closure or an arrow function.
This error message also applies to methods.
Example¶
<?php
function foo() {
echo Closure::getCurrent();
}
foo();
?>
Solutions¶
Remove the call to
Closure::getCurrent()from the function.Turn the funciton into a closure or an arrow function.