nvlad / yii2support

Yii2 Support for PhpStorm / IntelliJ IDEA
https://plugins.jetbrains.com/idea/plugin/9388-yii2-support
Other
295 stars 52 forks source link

Unused Element on Classes and Methods #232

Open yepes opened 5 years ago

yepes commented 5 years ago

Hey guys,

With the new version of PHP Storm I'm getting tons of "Unused Element" for the Controller Class declaration and for the methods inside those classes. It's a bit annoying. I don't know if that's something that could be avoided using this plugin or not. I mean, I don't wanna turn completely off the inspection in the IDE

This is from a freshly created basic app template:

Screen Shot 2019-08-06 at 14 09 00

Screen Shot 2019-08-06 at 14 16 47

What steps will reproduce the problem?

Install the latests PHP Storm version

What is the expected result?

Do not throw the Unused Element.

What do you get instead?

Unused Element

Additional info

Q A
IDE Name PhpStorm
IDE Version 2019.2
Plugin version 0.10.57.23
Yii App Template basic
mplattner commented 5 years ago

I have the same problem. It (mostly?) affects action methods in controllers - they are obviously never called directly from within the code, but only executed when a user (HTTP) request is routed to the method.

yepes commented 5 years ago

To remove the inspection only for one action, you just put this before the method: /* @noinspection PhpUnused /

You can also use it before the class definition, so it removes the inspection for every inspection.