Review main Merged

73623[TASK] Replace most symfony/polyfill-* packages

Christian Kuhn CR +2 V +2 Hard +34 −671 updated 02/21/22, 18:20

Commit message

The patch adds a couple of 'replace' entries for
common symfony/polyfill-* packages that are
obsolote due to our PHP version requirements
and PHP required extensions.

This is the recommended way as outlined
in symfony docs [1] at the moment.

Going this way in composer.json is semantically
wrong - TYPO3 does not in fact provide the
php functions in question itself. However, there
is currently no more elegant way to tell composer
that packages are obsolete automatically when
certain platform dependencies are met.

In the end, we don't really want to maintain
this list, but decided to still go with it with
v12 for now since the number of 'obsolete'
dependecies pile up and avoiding these packages
in projects can be a flat security advantage
(less code = less risk) and is environmental
more friendly.

[1] https://github.com/symfony/polyfill/#design

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
  • Verified V +2 Done
    • Benni Mack +2
    • Stefan Bürk +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 1012

  1. Christian Kuhn uploaded patch set 1 02/20/22, 19:59

  2. Stefan Bürk voted on patch set 1 V +1 CR +1 02/20/22, 20:06

  3. core-ci voted on patch set 1 V +1 02/20/22, 20:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23958

  4. Benjamin Franzke commented on patch set 1 02/20/22, 20:18

    Not a friend of this personally, I therefore abstain from voting. For reference, quoting a discussion about this last year: Christian Kuhn Mar 7th, 2021 at 17:37 question on v11 symfony/polyfill-php [70, 72, 73] packages: with v11 being >=php 7.4, those are essentially useless. we could consider to drop those by setting 'provide' (or replace?) in root composer.json and sysext/core/composer.json. do you think it's worth it for the sake of slightly less dependencies? any better idea, or not worth the effort? (thumbs up = set as 'provide') (edited) Helmut Hummel 11 months ago I voted negative for the following reasons: Adding the replaces (provide would be wrong), means we are adding them to our list of dependencies. Even if it means we don't want them to be installed, we must maintain this list Adding a replace for this purpose is a hack. It declares our package is a replacement for these packages, which in fact it is not. Even if it likely does not matter in practice, as we require PHP 7.4, we add a declaration which is semantically wrong. Such hacks are imho fine to optimize individual projects, but not for a generic library That said, I wouldn't mind if these replacements are added anyway. Helmut Hummel 11 months ago One argument for adding the replaces is, that installing TYPO3 with Composer will consume less resources (bandwidth, processing power, storage). So might be worth doing it nontheless Benjamin Franzke 11 months ago I agree with Helmut, it is semantically wrong although we'd like to have the features. Now, IMO, this is actually an upstream bug. It would be much better if symfony/polyfill-* packages would all be available in multiple (major) versions: The current polyfill package for >=php71 One no-op package for the polyfilled PHP version upwards Basically as we did with https://packagist.org/packages/typo3/symfony-psr-event-dispatcher-adapter – that's the only proper way to declare conditional dependencies with composer. So would be awesome if symfony releases v2 versions for all polyfill packages. The v2 version would then be an empty package (no-op), only compatible with the php versions that are about to be polyfilled. Because we use platform php >=7.4 we could then use the empty/no-op packages.
  5. Stefan Bürk commented on patch set 1 02/20/22, 20:33

    Reply

    In the end composer is lacking a feature so a package can say: "install me only if not defined criteria/dependencies are met, like php version or extensions etc". Than symfony could say for there polyfill packages that they are only meant to be installed if NOT php version AND extension are existing. Thus, who ever requires this polyfill can do this as require/dev-require, but got ignored if exclude/ignore criteria is meet. The goal of these replace line's is to avoid installation of these packages as php and extension requirement is met through core hard requriement (and not suggested/dev depenendcy), avoiding the installation of these obsolete packages. Don't get how a seperate package could help here, as we do not require these polyfills directly anymore - and solving the installation of these packages through maintaining and requireing further packages would make this goal a big non-sense. (even if it is a provided empty package by symfony). Or do you mean to add these "replace" lines in a "meta packages" and include that ? (typo3/avoid-superflous-symfony-polyfill-extensions with these replace lines ) ? Not sure if there is a proposal to composer, maybe we should add one (for the mid/long term) .. anyway, we should have a solution avoiding the installation of these packackes with less eford as possible ... having a dedicated package means we need to hava a further package which is not controllable through the mono-repo and needs seperate pr's and roundtrips with versioning etc ...
  6. Christian Kuhn uploaded patch set 2 02/21/22, 17:44

  7. core-ci voted on patch set 2 V +1 02/21/22, 17:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/24002

  8. Stefan Bürk voted on patch set 2 V +1 CR +1 02/21/22, 17:58

  9. Benni Mack commented on patch set 2 V +2 CR +2 02/21/22, 18:01

    I does feel "wrong" in the first place, but I agree with stefan that this is something composer (3.x?) could integrate at some point. Creating "no-op packages" also is something we need to maintain, I don't think we should do this for the time being. So let's continue with this one and see if composer will come up with a better approach for us. I don't think this will bite us in the near future for the time being.
  10. Benni Mack merged patch set 3 02/21/22, 18:01

  11. Benjamin Franzke commented on patch set 3 02/21/22, 18:19

    Reply

    I didn't want (nor said) that *we* implement two packages, but rather that symfony takes care of that. anyway, doesn't matter now.
  12. Benni Mack commented on patch set 3 02/21/22, 18:20

    Reply

    gotcha, thanks for the clarification.