Using Symfony PHP polyfills

The comment by @daniellienert in https://github.com/neos/flow-development-collection/pull/2434#discussion_r599318551 made me think…

Well, this is on purpose. The method is provided by symfony/polyfill-php80 which is required through symfony/console.

I (and probably others) think “oh, that would be a nice function to use” or stumble over “ah, is this available in all PHP versions we care support?”. Now, would those polyfill packages be a solution? It would:

  • make us think less
  • avoid errors due to unavailable functions
  • allow to “code for the future” already

The fact we have them already means we could require them explictly and then use them. In any case, adding replace statements as documented might be a good idea,

Opnions?

In any case, adding replace statements as documented might be a good idea,

Though we probably need to add those to the Neos.Flow package itself as well

Regarding requiring the polyfills and making use of them - I’m a bit torn. Yes it allows to code for the future, but only within a select subspace - polyfills e.g. can’t provide union types, attributes or constructor property promotion. So one still has to think (or rather look) very carefully what to use and what not. Hence I think the benefit is rather shallow after all. I wouldn’t block adding them though

Huh, didn’t know we have those replace lines already. But, useless for anyone not using the dev collection. :wink:

The changes from https://github.com/neos/flow-development-collection/pull/2331 and https://github.com/neos/flow-development-collection/commit/db457678bab43acf934ad6ff02cf3b8bb5df4848 must go into neos/flow and from there be propagated to the collection manifest using the ComposerManifestMerger script.

I’ll take care…

Good the changes are still in, btw… the merger would have thrown them out. If you ever change the collection manifest only with out touching another package file or the .composer.json template, you are missing something…