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

[Config] Move from magic loading of all PHPStan extensions, their bootstrap files etc. under control with explicit file listing #4769

Merged
merged 3 commits into from
Aug 11, 2023

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Aug 11, 2023

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 👍

# phpstan-for-rector.neon
includes:
    - vendor/symplify/phpstan-rules/config/symplify-rules.neon

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

@TomasVotruba TomasVotruba changed the title tv make phpstan bootstrapping explicit [Config] Move from magic loading of phpstan extensions, their bootstrap fils etc under control with explicit file listing Aug 11, 2023
@samsonasik
Copy link
Member

/cc @mfrieling @mglaman @staabm @sboden @AlexSkrypnyk @tr33m4n FYI

@TomasVotruba TomasVotruba force-pushed the tv-make-phpstan-bootstrapping-explicit branch from adc50d7 to 2f41c82 Compare August 11, 2023 11:32
@TomasVotruba TomasVotruba changed the title [Config] Move from magic loading of phpstan extensions, their bootstrap fils etc under control with explicit file listing [Config] Move from magic re-loading of all PHPStan extensions, their bootstrap fils etc under control with explicit file listing Aug 11, 2023
@TomasVotruba TomasVotruba changed the title [Config] Move from magic re-loading of all PHPStan extensions, their bootstrap fils etc under control with explicit file listing [Config] Move from magic re-loading of all PHPStan extensions, their bootstrap files etc. under control with explicit file listing Aug 11, 2023
@TomasVotruba TomasVotruba force-pushed the tv-make-phpstan-bootstrapping-explicit branch 2 times, most recently from e9f5669 to d94dc15 Compare August 11, 2023 11:37
…rap fils etc under control with explicit file listing
@TomasVotruba TomasVotruba force-pushed the tv-make-phpstan-bootstrapping-explicit branch from d94dc15 to 094fdaf Compare August 11, 2023 11:44
@TomasVotruba TomasVotruba force-pushed the tv-make-phpstan-bootstrapping-explicit branch from 2da54d5 to 530feb2 Compare August 11, 2023 11:46
@TomasVotruba TomasVotruba changed the title [Config] Move from magic re-loading of all PHPStan extensions, their bootstrap files etc. under control with explicit file listing [Config] Move from magic loading of all PHPStan extensions, their bootstrap files etc. under control with explicit file listing Aug 11, 2023
@TomasVotruba TomasVotruba merged commit 28a64fd into main Aug 11, 2023
45 checks passed
@TomasVotruba TomasVotruba deleted the tv-make-phpstan-bootstrapping-explicit branch August 11, 2023 11:52
@clxmstaab
Copy link
Contributor

clxmstaab commented Aug 16, 2023

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 @api surface?

@ondrejmirtes
Copy link
Contributor

@clxmstaab Please open a GitHub issue on PHPStan's side and describe in detail what you want to achieve.

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.

4 participants