idea-php-laravel-plugin
idea-php-laravel-plugin copied to clipboard
Support Laravel collections "Higher Order Messages" feature
It would be great to catch keywords listed there to get autocompletion and refactoring lookup support of collection items methods, like
$users->each->markAs|// <ctrl-space>
$users->each->markAsVip(); // Shift-F6 may rename method in-place
It's very hard to implement.
$users = User::where('votes', '>', 500)->get();
// $users here is just an object of class Collection.
// PhpStorm can't understand that it's a collection of User objects...
$users->each->markAsVip();
@adelf sure, it is not easy to implement. But not seems impossible for me.
Anyway, having an ability to recognize resulting type of collection items returned by find*** would be useful by itself. But it deserves a separate task, of course.
This task is not for catching any collections usage scenarios. But catching at least following
$collection = collect([$foo, $bar]);
$collection->each->/* ctrl + space shows all possible members autocompletions */;
would be already very useful.
Unfortunately, i have no experience in Java, otherwise i'd help to research this idea solution. :/
Isn't this made easier by https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata ? I'm thinking especially of 'elementType'