Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poly-fill-me-up #23954

Merged
merged 1 commit into from
Jul 18, 2022
Merged

Poly-fill-me-up #23954

merged 1 commit into from
Jul 18, 2022

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Poly-fill-me-up

Before

We have only the 7.3 polyfill

After

symfony/polyfill-php74 for using the PHP 7.4 functions,
symfony/polyfill-php80 for using the PHP 8.0 functions,
symfony/polyfill-php81 for using the PHP 8.1 functions,
symfony/polyfill-php82 for using the PHP 8.2 functions,

Technical Details

https://github.com/symfony/polyfill/blob/main/README.md

Comments

@totten @seamuslee001 @demeritcowboy I feel like the polyfill we have has been great in terms of reducing risk of breakage across versions & allowing us to use some nice upcoming functions - I vote we pull in the rest of the current php-versions

I also probably think we should pull in more intl ones since it would have helped KonaDave with his brickmoney this week - but left out of scope

@civibot
Copy link

civibot bot commented Jul 6, 2022

(Standard links)

@civibot civibot bot added the master label Jul 6, 2022
@demeritcowboy
Copy link
Contributor

Note the intl one is english only, and there was some catch-22 about it - I think because it's specified as a requirement in composer.json, so it tells you you need intl before you can install the polyfill.

But otherwise this seems ok.

@eileenmcnaughton
Copy link
Contributor Author

OK - I think we don't need to bring intl into scope then if it's not an easy win

@totten
Copy link
Member

totten commented Jul 7, 2022

I guess I'm OK with this too.

I wish we could pick/choose a bit more precisely:

  • str_starts_with(), array_key_first(), array_is_list(), is_countable(), etc. -- These all seem like good, straight-up polyfills. AFAICS, they are work-a-likes in most (all?) common situations. If somebody starts using one these without giving a thought to the compatibility matrix, that's fine.
  • JsonException, ValueError, Stringable, Attribute, etc. -- These are more, eh. I don't think they are drop-in replacements. If you write code on new PHP which uses one of these classes -- and if you run it on old PHP+polyfill -- then it probably won't work. These feel like specialist tools that might help some folks get out of a weird jam. ("We wrote a subclass of JsonException for our own use, and we need to avoid class-loading errors, and we don't care if json_decode() ever throws JsonException.") These polyfills might obfuscate some error conditions, and I'd just-as-soon leave them out... but I also can't point to a real/major harm of including them. And I'm sure lots of people live with them peacefully.

@eileenmcnaughton
Copy link
Contributor Author

This has gone stale - I think it would be good to get MOP before I re-do it as it is stale-prone

@seamuslee001 seamuslee001 merged commit 245f095 into civicrm:master Jul 18, 2022
@seamuslee001 seamuslee001 deleted the poly branch July 18, 2022 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants