magento/magento-coding-standard

Individual polyfill packages should be used instead of symfony/polyfill

stof opened this issue · 5 comments

stof commented

Currently, this package depends on symfony/polyfill instead of the individual symfony/polyfill-* packages.
This package installing the whole mono-repo is discouraged as it installs much more stuff than necessary.

The Symfony team (which I'm a member of) recommends using the individual packages instead. If we were starting it today, we would not even publish the symfony/polyfill package on Packagist at all, keeping it a development-only mono-repo.

Currently, this even triggers a weird behavior in Composer. See composer/composer#11641

Hi @stof. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

stof commented

Based on the commit that introduced it (2ea3c39), the package that is needed is symfony/polyfill-php80 as the feature used is str_starts_with

We can probably drop the polyfill requirement again, because support was dropped for PHP < 8.1 in 8d37ab7

stof commented

in such case, the requirement is indeed useless (this is another benefit of requiring individual polyfills as it would have been clear that symfony/polyfill-php80 is a useless dependency when requiring PHP 8+)

Thanks @stof and @hostep. I agree that I added the wrong dependency. Sorry about that. Let's get #468 merged to solve this.