Custom autocomplete, usage inspection and goto definitions

I've been scouring the web searching for a way to do this, but haven't found a viable solution yet.

What I'm looking for is basically all or some of the functionality from the Laravel (https://www.jetbrains.com/help/phpstorm/laravel.html) or Symfony (https://www.jetbrains.com/help/phpstorm/symfony-navigating-project.html) plugin, only for a custom made project (without having to make our own plugin):
- Auto-complete for route parameters
- Goto links between routes and controller action
- Usage inspection coupling controller actions with routes

In our project we have a class for generating routes in PHP and TypeScript, both use same parameters, but the issue is the controller actions are being reported as not used (not coupling to route), which we used to solve with @noinspection, but after adding a lot of them we decided to disable the inspection for *Controller files instead, so we don't have to add it for all controller actions.
This solved the "issue" with the inspection giving warnings, but didn't solve the actual problem, since we still can't see if a controller action is actually being used, besides searching for it manually.

So I started searching the web for a solution for this, and stumbled across the Laravel and Symfony plugins that does exactly what we need, only just for their frameworks.

After some more seaching I found the PHP Annotation and PHP Toolbox plugins that looks like it could do the trick.
But after some messing arround with it (their documentation is lacking), I only managed to add static autocomplete for both controller and action part of the route, (our router takes controller as first parameter and action as second), but I didn't manage to get autocomplete suggestions for action based on the given controller (autocomplete suggestions were from all controllers).
Maybe there actually is some way to do this, and I just didn't mess arround enough, but even so this only adds auto suggest for routes, not the coupling to the controller and action being used, which means the controller action will still be reported as not used, and i still cant goto controller from route or vice versa.

To sum up, is there any way to setup PhpStorm according to the following (stubs, settings, plugins, etc.):
- get autocomplete suggestions for custom function/method parameters (somewhat possible with PHP Toolbox, but not good enough afaik)
- define usage inspection based on custom rules (if route is used/setup for controller action, it's being used)
- define custom goto rules (route to controller/action, and vice versa)

1 comment
Comment actions Permalink

Unfortunately, there's nothing much PhpStorm has to offer in this regard.

get autocomplete suggestions for custom function/method parameters

That should be possible with the expectedArguments method of advanced metadata: https://blog.jetbrains.com/phpstorm/2019/02/new-phpstorm-meta-php-features/

But it still won't let you to

get autocomplete suggestions for action based on the given controller (autocomplete suggestions were from all controllers).

So it's not much better than what you achieved with PHP Toolbox.

define usage inspection based on custom rules (if route is used/setup for controller action, it's being used)

define custom goto rules (route to controller/action, and vice versa)

These two, however, are not possible at all.

0

Please sign in to leave a comment.