You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[DX] Add RequiredPolyfillInterface to some rule to enable then, once the project is using polyfill package #8368
We upgrade to PHP 8.0 features, that benefit from this package. It must be manually checked what Rector rules should be extended, as this polyfill only adds helper for few functions, not all PHP 8.0 features.
To enable such a rule, it must require RequiredPolyfillInterface contract:
changed the title [-][DX] Add MinRequiredPolyfillInterface to some rule to enable then, once the project is using polyfill package[/-][+][DX] Add RequiredPolyfillInterface to some rule to enable then, once the project is using polyfill package[/+]on Dec 18, 2023
This PR is such an underrated feature. You can basically set the PhpVersion to the minimum version your code must support, for example for us it is PHP 7.4. But we seek to migrate to PHP 8.2, so we set the targeted rules to UP_TO_PHP_82.
One would think that rector would automatically exclude all rules that are not PHP 7.4 compatible, but no. If you use a polyfill like symfony/polyfill-php80, symfony/polyfill-php81 and symfony/polyfill-php82 rector will enable some rules like StrStartsWithRector and StrContainsRector.
Anyway, thanks for that! Call me impressed. Cheers 👋
Activity
[-][DX] Add MinRequiredPolyfillInterface to some rule to enable then, once the project is using polyfill package[/-][+][DX] Add RequiredPolyfillInterface to some rule to enable then, once the project is using polyfill package[/+]fredericgboutin-yapla commentedon Apr 22, 2024
This PR is such an underrated feature. You can basically set the PhpVersion to the minimum version your code must support, for example for us it is PHP 7.4. But we seek to migrate to PHP 8.2, so we set the targeted rules to
UP_TO_PHP_82.One would think that rector would automatically exclude all rules that are not PHP 7.4 compatible, but no. If you use a polyfill like
symfony/polyfill-php80,symfony/polyfill-php81andsymfony/polyfill-php82rector will enable some rules likeStrStartsWithRectorandStrContainsRector.Anyway, thanks for that! Call me impressed. Cheers 👋
TomasVotruba commentedon Apr 22, 2024
Thank you Frederic for kind words 🙏 Spread the word to help out the community to learn about those features 🥳
github-actions commentedon Feb 8, 2026
This issue has been automatically locked because it has been closed for 150 days. Please open a new issue if you have a similar problem.