phpstorm-phpstan-plugin icon indicating copy to clipboard operation
phpstorm-phpstan-plugin copied to clipboard

WI-63901 increased PHPStan rule level limit

Open kevinbreit opened this issue 1 year ago • 3 comments

Updated Spinner Level for Rule to 9 based on WI-63901 - PHPStan: update Rule Level behavio

kevinbreit avatar Sep 30 '24 20:09 kevinbreit

Level 10 appeared in PHPStan 2.0: https://phpstan.org/user-guide/rule-levels

Maybe we could check the PHPStan-version to set the correct max-level? Otherwise we give it to the user to select the correct level.

I am not familiar with plugin development so I don't know if there can be project specific UI-settings.

kevinbreit avatar Nov 25 '24 11:11 kevinbreit

You can put an arbitrary integer, and PHPStan will automatically understand it as the maximum number inside the range of levels if it is higher than the maximum level.

I would only limit the field to a range of positive integers, and defer the behavior to PHPStan itself.

devnix avatar Nov 25 '24 12:11 devnix

I tried letting PHPStan set the highest level automatically in PHPStan 2.0.2 and 1.12.11 with composer. If I use a non existent level, PHPStan throws an error:

vendor/bin/phpstan analyse --level=12
Note: Using configuration file /var/www/html/www/phpstan.dist.neon.
Level config file phar:///var/www/html/www/vendor/phpstan/phpstan/phpstan.phar/conf/config.level12.neon was not found.

If I use the key max, as documented, I use the max level.

But I agree with you about setting the minimum level to 0 and no max. If the user sets it higher than the max-level and PHPStan throws an error, the plugin should throw an error in the IDE notifications. Also we never have to update the spinner again.

Also my Intellij-Licence expired and I will not buy a new one. Maybe someone should compile the Plugin and test it.

I can't test if Integer.MAX_VALUE would work instead of 99 and I am not experienced with Java at all, so I can't tell if it would work with that. But I committed 99 for now.

kevinbreit avatar Nov 25 '24 18:11 kevinbreit