[Config] Move from magic loading of all PHPStan extensions, their bootstrap files etc. under control with explicit file listing#4769
Merged
TomasVotruba merged 3 commits intomainfrom Aug 11, 2023
Conversation
Member
adc50d7 to
2f41c82
Compare
e9f5669 to
d94dc15
Compare
…rap fils etc under control with explicit file listing
d94dc15 to
094fdaf
Compare
2da54d5 to
530feb2
Compare
This was referenced Aug 16, 2023
Contributor
|
since this PR, we have to configure rector in the "old manual way" while in tandem use PHPStan with the more comfortable autoloading way. configuring extensions manually is a mess.. the PR describes the main motivation is keeping up with PHPStan on this topic and fixing things when PHPStan moves forward.. maybe we can instead change PHPStan in a way, that rector can re-use the implementation instead of duplicate the logic. @ondrejmirtes do you agree we could add the extension installer related parts to PHPStan |
Contributor
|
@clxmstaab Please open a GitHub issue on PHPStan's side and describe in detail what you want to achieve. |
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.
At the start, we required explicit custom configuration for PHPStan being registered in
phpstan-for-rector.neon.In some point we added magic loading of all phpstan extensions, like PHPStan does. The problem is, the more complex the extension became, the more feature we had to mimic from PHPStan container - rectorphp/rector#7795
Instead of continuing in this trend, we better move back to explicit registration of condig in phpstan.neon and let PHPStan container factory handle the job 👍
That way it's clear what is being used in Rector and what not.
Rector extension rules should not depend on PHPStan extension much, as they should handle upgrades of known type declaratoins. For inspiration on those rules, check https://github.com/rectorphp/rector-symfony