Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WI-63901 increased PHPStan rule level limit #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kevinbreit
Copy link

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

@kevinbreit
Copy link
Author

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.

@devnix
Copy link

devnix commented Nov 25, 2024

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.

@kevinbreit
Copy link
Author

kevinbreit commented Nov 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants