Problem/Motivation
Some of our dependencies pull in polyfill packages such as symfony/polyfill-php72, which are unnecessary as we already have a minimum dependency of PHP 7.3.
Proposed resolution
Add unnecessary polyfills to the "replace" section of composer.json as per https://github.com/symfony/polyfill#design
Remaining tasks
Decide whether to do this in composer.json or core/composer.json.
User interface changes
None
API changes
None (the polyfills do nothing as the functionality is already provided by the minimum version of PHP we use)
Data model changes
None
Release notes snippet
A couple of unneeded polyfills for versions of PHP prior to 7.3 were unnecessarily included in the core-recommended template and the lockfile. These have now been removed.
Comments
Comment #2
longwaveComment #3
jungle+1 to do this in DRUPAL_ROOT/composer.json.
Steps:
replacesection inDRUPAL_ROOT/composer.jsonCOMPOSER_ROOT_VERSION=9.1.x-dev composer update --lock -vvv\Drupal::MINIMUM_PHPis7.3.0Required extensions in
core/composer.json:So, no more to remove?
Comment #4
longwaveLooks good. We don't need random_compat nor polyfills for PHP 7.3 and below as we require PHP 7.3 minimum. We do need the remaining polyfills as the dependencies may use them, and it is better to polyfill than require an extension as some environments might not be able to provide the extensions.
Comment #5
longwaveActually the Symfony docs suggest replacing their polyfills with a version of 1.99, so I think this should become
Comment #6
jungleRe #5, from my understanding,
1.99over there is just an example, It should be1.18.1in our case for symfony ones, but I think "*" is more appropriate here. As we do not want to change the version number frequently when there are new releases.Comment #7
jungleI tried changing them to 1.99, the following exception got:
Comment #8
longwaveThe composer docs aren't quite clear but I thought 1.99 means that
drupal/drupalprovides (or claims to provide) that specific version - so when another package requiressymfony/polyfill-php70:^1.10, 1.99 is a valid match. However, if something requiressymfony/polyfill-php70:^2.0then our version *won't* match and the polyfill would still be installed.However, I also don't see why Symfony would release a 2.0 of any polyfill, or why we would ever need a PHP 7.0 polyfill at all, so I guess "*" is also fine as the version specifier.
Comment #10
catchCommitted df676dc and pushed to 9.1.x. Thanks!
Comment #12
xjmNice!
Comment #13
xjmAdding the release note snippet.