From 39928fd42d11da4abaf316c1de4ea24aac700d23 Mon Sep 17 00:00:00 2001 From: lcatoire Date: Fri, 10 Jul 2026 18:43:35 +0200 Subject: [PATCH 1/3] feat(intl): ajoute la documentation de la classe IntlListFormatter (PHP 8.5) --- appendices/migration85/new-classes.xml | 7 + reference/intl/book.xml | 1 + reference/intl/intllistformatter.xml | 178 ++++++++++++++++++ .../intl/intllistformatter/construct.xml | 117 ++++++++++++ reference/intl/intllistformatter/format.xml | 90 +++++++++ 5 files changed, 393 insertions(+) create mode 100644 reference/intl/intllistformatter.xml create mode 100644 reference/intl/intllistformatter/construct.xml create mode 100644 reference/intl/intllistformatter/format.xml diff --git a/appendices/migration85/new-classes.xml b/appendices/migration85/new-classes.xml index d47bed152f20..86fa4e0360c5 100644 --- a/appendices/migration85/new-classes.xml +++ b/appendices/migration85/new-classes.xml @@ -29,6 +29,13 @@ + + Intl + + IntlListFormatter + + + URI diff --git a/reference/intl/book.xml b/reference/intl/book.xml index 611d0b91cf5f..1bc40b551197 100644 --- a/reference/intl/book.xml +++ b/reference/intl/book.xml @@ -133,6 +133,7 @@ &reference.intl.intlrulebasedbreakiterator; &reference.intl.intlcodepointbreakiterator; &reference.intl.intldatepatterngenerator; + &reference.intl.intllistformatter; &reference.intl.intlpartsiterator; &reference.intl.uconverter; diff --git a/reference/intl/intllistformatter.xml b/reference/intl/intllistformatter.xml new file mode 100644 index 000000000000..fc5884527796 --- /dev/null +++ b/reference/intl/intllistformatter.xml @@ -0,0 +1,178 @@ + + + + The IntlListFormatter class + IntlListFormatter + + + + +
+ &reftitle.intro; + + Formats, orders, and punctuates a list of items according to locale-specific rules. + Requires ICU 67 or later. + +
+ + +
+ &reftitle.classsynopsis; + + + + + IntlListFormatter + + + &Constants; + + public + const + int + IntlListFormatter::TYPE_AND + + + public + const + int + IntlListFormatter::TYPE_OR + + + public + const + int + IntlListFormatter::TYPE_UNITS + + + public + const + int + IntlListFormatter::WIDTH_WIDE + + + public + const + int + IntlListFormatter::WIDTH_SHORT + + + public + const + int + IntlListFormatter::WIDTH_NARROW + + + &Methods; + + + + + + + + + +
+ +
+ &reftitle.constants; + + + IntlListFormatter::TYPE_AND + + + Formats a list using conjunction (e.g. "A, B, and C"). + + + + + IntlListFormatter::TYPE_OR + + + Formats a list using disjunction (e.g. "A, B, or C"). + + + + + IntlListFormatter::TYPE_UNITS + + + Formats a list of units (e.g. "3 ft, 7 in"). + + + + + IntlListFormatter::WIDTH_WIDE + + + Uses the widest (most verbose) list format, typically with conjunctions spelled out in full. + + + + + IntlListFormatter::WIDTH_SHORT + + + Uses a short list format, typically using abbreviations. + + + + + IntlListFormatter::WIDTH_NARROW + + + Uses the narrowest list format, with minimal punctuation. + + + + +
+ +
+ &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 8.5.0 + + The class was added. + + + + + +
+ +
+ + &reference.intl.entities.intllistformatter; + +
+ diff --git a/reference/intl/intllistformatter/construct.xml b/reference/intl/intllistformatter/construct.xml new file mode 100644 index 000000000000..f00b5c8f12ca --- /dev/null +++ b/reference/intl/intllistformatter/construct.xml @@ -0,0 +1,117 @@ + + + + + IntlListFormatter::__construct + Creates a new IntlListFormatter instance + + + + &reftitle.description; + + public IntlListFormatter::__construct + stringlocale + inttypeIntlListFormatter::TYPE_AND + intwidthIntlListFormatter::WIDTH_WIDE + + + Creates a new IntlListFormatter instance for the given locale. + + + + + &reftitle.parameters; + + + locale + + + The locale to use for formatting. + + + + + type + + + The list type. One of the IntlListFormatter::TYPE_* constants: + IntlListFormatter::TYPE_AND, + IntlListFormatter::TYPE_OR, or + IntlListFormatter::TYPE_UNITS. + + + + + width + + + The list width. One of the IntlListFormatter::WIDTH_* constants: + IntlListFormatter::WIDTH_WIDE, + IntlListFormatter::WIDTH_SHORT, or + IntlListFormatter::WIDTH_NARROW. + + + + + + + + &reftitle.errors; + + Throws an IntlException if the formatter cannot be created + (e.g. invalid locale or ICU version is below 67). + + + + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 8.5.0 + + The class was added. + + + + + + + + + &reftitle.seealso; + + + IntlListFormatter::format + + + + + + diff --git a/reference/intl/intllistformatter/format.xml b/reference/intl/intllistformatter/format.xml new file mode 100644 index 000000000000..800c232cf677 --- /dev/null +++ b/reference/intl/intllistformatter/format.xml @@ -0,0 +1,90 @@ + + + + + IntlListFormatter::format + Format a list of items + + + + &reftitle.description; + + public stringfalseIntlListFormatter::format + arraylist + + + Formats a list of items as a locale-appropriate string. + + + + + &reftitle.parameters; + + + list + + + An array of strings to format as a list. + + + + + + + + &reftitle.returnvalues; + + The formatted list as a string, or &false; on failure. + + + + + &reftitle.examples; + + <methodname>IntlListFormatter::format</methodname> example + +format(['one', 'two', 'three']); +// one, two, and three + +$fmt = new IntlListFormatter('en_US', IntlListFormatter::TYPE_OR, IntlListFormatter::WIDTH_WIDE); +echo $fmt->format(['one', 'two', 'three']); +// one, two, or three +?> +]]> + + + + + + &reftitle.seealso; + + + IntlListFormatter::__construct + + + + + + From 8b19aca49f562483d01d1a3de78859774844f807 Mon Sep 17 00:00:00 2001 From: Louis-Arnaud Date: Fri, 10 Jul 2026 23:13:51 +0200 Subject: [PATCH 2/3] Apply DocBook style check: para->simpara, exceptionname --- reference/intl/book.xml | 18 +++++++-------- .../intl/intllistformatter/construct.xml | 22 +++++++++---------- reference/intl/intllistformatter/format.xml | 12 +++++----- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/reference/intl/book.xml b/reference/intl/book.xml index 1bc40b551197..664685fe385b 100644 --- a/reference/intl/book.xml +++ b/reference/intl/book.xml @@ -9,26 +9,26 @@ &reftitle.intro; - + Internationalization extension (further is referred as Intl) is a wrapper for ICU library, enabling PHP programmers to perform various locale-aware operations including but not limited to formatting, transliteration, encoding conversion, calendar operations, UCA-conformant collation, locating text boundaries and working with locale identifiers, timezones and graphemes. - + - + It tends to closely follow ICU APIs, so that people having experience working with ICU in either C/C++ or Java could easily use the PHP API. Also, this way ICU documentation would be useful to understand various ICU functions. - + - + Intl consists of several modules, each of them exposes the corresponding ICU API: - + @@ -98,13 +98,13 @@ Links - Miscellaneous ICU docs + Miscellaneous ICU docs - ICU User Guide + ICU User Guide - Unicode Collation Algorithm + Unicode Collation Algorithm diff --git a/reference/intl/intllistformatter/construct.xml b/reference/intl/intllistformatter/construct.xml index f00b5c8f12ca..c469bab5a9f8 100644 --- a/reference/intl/intllistformatter/construct.xml +++ b/reference/intl/intllistformatter/construct.xml @@ -14,9 +14,9 @@ inttypeIntlListFormatter::TYPE_AND intwidthIntlListFormatter::WIDTH_WIDE - + Creates a new IntlListFormatter instance for the given locale. - + @@ -25,31 +25,31 @@ locale - + The locale to use for formatting. - + type - + The list type. One of the IntlListFormatter::TYPE_* constants: IntlListFormatter::TYPE_AND, IntlListFormatter::TYPE_OR, or IntlListFormatter::TYPE_UNITS. - + width - + The list width. One of the IntlListFormatter::WIDTH_* constants: IntlListFormatter::WIDTH_WIDE, IntlListFormatter::WIDTH_SHORT, or IntlListFormatter::WIDTH_NARROW. - + @@ -57,10 +57,10 @@ &reftitle.errors; - - Throws an IntlException if the formatter cannot be created + + Throws an IntlException if the formatter cannot be created (e.g. invalid locale or ICU version is below 67). - + diff --git a/reference/intl/intllistformatter/format.xml b/reference/intl/intllistformatter/format.xml index 800c232cf677..007bc4f7ec65 100644 --- a/reference/intl/intllistformatter/format.xml +++ b/reference/intl/intllistformatter/format.xml @@ -12,9 +12,9 @@ public stringfalseIntlListFormatter::format arraylist - + Formats a list of items as a locale-appropriate string. - + @@ -23,9 +23,9 @@ list - + An array of strings to format as a list. - + @@ -33,9 +33,9 @@ &reftitle.returnvalues; - + The formatted list as a string, or &false; on failure. - + From 5ffc64c426ef5a82b2e7ca99fdcd942aaccd7d94 Mon Sep 17 00:00:00 2001 From: Louis-Arnaud Date: Wed, 22 Jul 2026 09:22:28 +0200 Subject: [PATCH 3/3] Unwrap simplelist from para in seealso --- reference/intl/intllistformatter/construct.xml | 8 +++----- reference/intl/intllistformatter/format.xml | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/reference/intl/intllistformatter/construct.xml b/reference/intl/intllistformatter/construct.xml index c469bab5a9f8..e80d7d8d28b1 100644 --- a/reference/intl/intllistformatter/construct.xml +++ b/reference/intl/intllistformatter/construct.xml @@ -87,11 +87,9 @@ &reftitle.seealso; - - - IntlListFormatter::format - - + + IntlListFormatter::format + diff --git a/reference/intl/intllistformatter/format.xml b/reference/intl/intllistformatter/format.xml index 007bc4f7ec65..a26abe885a96 100644 --- a/reference/intl/intllistformatter/format.xml +++ b/reference/intl/intllistformatter/format.xml @@ -60,11 +60,9 @@ echo $fmt->format(['one', 'two', 'three']); &reftitle.seealso; - - - IntlListFormatter::__construct - - + + IntlListFormatter::__construct +