Turning off error report for some of unused PHP public methods

Hi!

I have a PHP application with a custom dispatcher (no PHP framework is used). It basically parses the URL, includes the file specified in the first URL param and calls a specific method inside that file according to the second URL parameter, and appends the word "Action" to it. For example: https://somesite.test/Users/List would make it include the Users.php, instantiate the Users class and call ListAction method on it.

Now, my problem is, that ListAction is marked as an unused element in PHPStorm. Is there a way, to add a regex exception to that inspection? I wouldn't like to turn this inspection off, but also this is the only inspection reporting issues on my files now.

Thanks,

Zoltan

0
2 comments

Well, looks like I should've used some more Googling... :) I found that I could add entry points for the modules that supports the * pattern. So it looks like I need to add that separately for every file, but that's doable.

Leaving this here for future references...

0

@Zoli

If you will be using such * pattern .. then you may also consider the following:

  1. Create custom Scope that will include all such "unwanted" files/folders
  2. Find that inspection in PhpStorm Inspections screen and activate that scope there
  3. Now turn it off for that scope and leave it on for the rest

https://www.jetbrains.com/help/phpstorm/configuring-inspection-severities.html#severity-in-scope (the screenshot is for different functionality but the place and approach is the same)

0

Please sign in to leave a comment.