[Intl] Add PHP 8.5 `IntlListFormatter` to ICU polyfill
Adds a new polyfill to symfony/polyfill-intl-icu that provides the functionality of the new IntlListFormatter to PHP 7.2 and later.
Closes GH-530.
// cc @BogdanUngureanu, I could use your inputs/review here :)
This should be added in symfony/polyfill-intl-icu (with the other formatters) instead of being a new package IMO
It only supports
enlocale. However, PHP applications that require this package can extend the namespaced polyfill (\Symfony\Polyfill\Intl\ListFormatter\IntlListFormatter) and add their own list patterns by extending the static variable (\Symfony\Polyfill\Intl\ListFormatter\IntlListFormatter::$listPatterns) that holds these patterns.
Extending the internal class is not covered by BC and is not a supported use case. Projects wanting the full support for ICU formatting should install ext-intl.
@Ayesh do you plan to finish this PR (by taking review comments into account) ?
Thank you for your review Christophe. I will try and submit fixed addressing the reviewed points by this weekend.
Thank you for your reviews.
I changed the PR, so that this now proposes to add IntlListFormatter to the ICU package. I also agree that it makes more sense, as opposed to having a separate installable package.
I also made it so that the class is self-contained, and not extendable anymore (making protected elements private, formatting pattern changed to a const, etc).