| Subject | Details |
| :------------- | :---------------------------------------------------------------------------- |
| Plugin | Php Inspections (EA Ultimate) |
| Language level | PHP 7.4 |
EA suggests replacing the closure fn ($id) => Document::getById($id) inside an array_map() with just 'getById'.
Suggestion:

Applied suggestion:

This is obviously wrong.
It suggests replacing the closure with [Document::class, 'getById'] instead.
PhpStorm 2020.1.4
Build #PS-201.8743.18, built on July 22, 2020
Runtime version: 11.0.7+10-b765.65 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 4.15.0-112-generic
Oops, thank you for reporting @jdreesen, I'll take care of fixing this.
@jdreesen, one question here.
It was intended to work with functions only, so I'm wondering if we should handle methods references at all.
What do you think?
Well, I somehow like to use the array form ([Document::class, 'getById']) instead of closures (fn ($id) => Document::getById($id)) when possible.
But with PHP 7.4 and short closures I'd be totally fine if EA doesn't support this.
After all, closures have advantages over arrays, as they're more explicit (especially with multiple arguments).
Uh, happy to hear that. I also prefer using short closures in this specific case.
Well, I actually like using the short closures everywhere =)
Fixed!
Most helpful comment
Fixed!