Repository navigation
Conversation
PHPStan recommends to always analyse the whole project: a change in one file can cause errors in other files, and a run on a list of files does not report ignoreErrors entries that no longer match. With the result cache, a run on the whole project is usually not slower. The use_grumphp_paths option of the phpstan task now defaults to false, so PHPStan analyses the paths from its own configuration. The task is now also skipped without use_grumphp_paths when none of the changed files triggers it, instead of running on every commit.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up of #1238. PHPStan recommends to always analyse the whole project (blog post, see also phpstan/phpstan#15704 (comment)): a change in one file can cause errors in other files, e.g. a changed method signature that breaks its callers, and a run on a list of files doesn't report
ignoreErrorsentries that no longer match. With the result cache, a run on the whole project is usually not slower.This PR:
use_grumphp_pathsoption of the phpstan task fromtruetofalse, so PHPStan analyses thepathsfrom its own configuration;use_grumphp_pathswhen none of the changed files triggers it (triggered_by,ignore_patterns,force_patterns). Before, the task ran on every commit withuse_grumphp_paths: false, e.g. also for a commit that only changesREADME.md;BC impact
The new default changes the behaviour for everyone who doesn't set
use_grumphp_paths:pathsin its configuration, otherwise it fails with "At least one path must be specified to analyse".ignore_patternsno longer excludes files from the analysis, only from triggering the task. UseexcludePathsin the PHPStan configuration instead.use_grumphp_paths: truekeeps the old behaviour. If you'd rather not change the default in 2.x, I can split this up: the skip fix can go into 2.x on its own, and the new default into the next major version.Tested manually with PHPStan 2.3.5
grumphp runanalyses the whole project, without file arguments.README.mdskips the task. Before, PHPStan ran and blocked the commit.B.phpalso reports the error inA.php.use_grumphp_paths: true, only the changedB.phpis analysed.New Task Checklist:
phpstan/phpstanis already suggested)use_grumphp_paths,ignore_patterns,force_patternsandtriggered_byindoc/tasks/phpstan.md)test/Unit/Task/PhpStanTest.php)run()method readable?run()method using the configuration correctly?