Closure::fromCallable is very useful when you want to pass a private method as callback. The sniff should recognize such method as used.
class Foo
{
public function test()
{
array_map(\Closure::fromCallable([$this, 'map']), []);
}
private function map($item)
{
// ...
}
}
If you prepare PR, I'm willing to merge it. However I don't want to invest my time for supporting the old way [$this, 'map'].
You should really rewrite the code in the example to:
array_map(function ($item) {
return $this->map($item);
}, []);
That's the syntax I used before. It's too much writing and forces you to repeat all the parameters. No thanks.
@enumag Yet it's cleaner for most IDEs, static analysis tools and refactoring tools
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
If you prepare PR, I'm willing to merge it. However I don't want to invest my time for supporting the old way
[$this, 'map'].You should really rewrite the code in the example to: