default level used:I am using the higher order proxy methods of collections, for example "map". The error message I get is: Access to an undefined property Illuminate\Support\HigherOrderCollectionProxy::$id.
return collect($room->getLights())->map(function (HueLight $hueLight) {
return Light::whereExternalId($hueLight->getId())->first();
})->map->id;
Thanks for reporting this. We don't support Higher Order Proxy functions, yet.
Just to add another example, it's not only about attributes, also methods:
$post->attachments->map->getAttributes()->all();
yields
Call to an undefined method
Illuminate\Support\HigherOrderCollectionProxy::getAttributes().
Yes, I've seen this error message.
This can be solved by the PHPStan generics to some extent. But there would be some edge cases I think.
I would accept a PR that adds a support for this :+1:
I would accept a PR that adds a support for this 馃憤
I created a plugin that fixes this, and extracted it to a package over here today. Do I clean up the package and add it as a dependency, or is porting the code directly to this repository preferable?
@nmokkenstorm I'd prefer the functionality inside the Larastan. With proper implementation and tests. Feel free to make a PR :+1:
I would gladly see @nmokkenstorm's extension in Larastan 鉂わ笍
Most helpful comment
@nmokkenstorm I'd prefer the functionality inside the Larastan. With proper implementation and tests. Feel free to make a PR :+1: