symfony / polyfill

PHP polyfills
https://symfony.com
MIT License
2.69k stars 135 forks source link

Replace lower PHP versions #368

Closed ro0NL closed 3 years ago

ro0NL commented 3 years ago

Hi,

Im wondering if there's a way to embed/require/include previous PHP versions in a later one.

As such we'd only need to require the wanted version, or replace our current version. Rather than

        "symfony/polyfill-php54": "*",
        "symfony/polyfill-php55": "*",
        "symfony/polyfill-php56": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*"

PHP-CS-Fixer does a similar thing basically: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/1b656b57d4ab35c80d5c5c3b60b1e360ba713018/src/RuleSet/Sets/PHP80MigrationSet.php#L27

WDYT?

jderusse commented 3 years ago

Something like https://github.com/composer-fallback/php-80.symfony-polyfill ?

I started working on such thing but did finished it.

See generator https://github.com/composer-fallback/generator/blob/master/manifest.json

ro0NL commented 3 years ago

by not finished you mean it doesnt actually install symfony/polyfill-php80 yet (say on a php74/composer2 machine) .. i'm looking where the magic happens :sweat_smile:

Package operations: 1 install, 0 updates, 0 removals
  - Installing composer-fallback/php-80.symfony-polyfill (1.0)

However, i think my root issue remains. To actually polyfill php8, you need the previous ones as well, which ultimately has to be solved here at the package level.

jderusse commented 3 years ago

by not finished you mean it doesnt actually install symfony/polyfill-php80 yet (say on a php74/composer2 machine) .. i'm looking where the magic happens 😅

nope, I mean it only support few PHP version/extension

The magic is: it installs the polyfill if you run PHP<=7.4 and install nothing if you run with PHP 8.

This meta package is designed for all project/libraries that rely on a function provided by either php8 OR symfony/polyfill-php8.

ro0NL commented 3 years ago

i cannot think of a proposal to fix

        "symfony/polyfill-php54": "*",
        "symfony/polyfill-php55": "*",
        "symfony/polyfill-php56": "*",
        "symfony/polyfill-php70": "*",
        "symfony/polyfill-php71": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*"