@@ -12,6 +12,28 @@ echo $formatter->format([1,2,3]) . PHP_EOL;
1212$ formatter = new IntlListFormatter ('EN_US ' );
1313echo $ formatter ->format ([1 ,2 ,3 ]) . PHP_EOL ;
1414
15+ echo $ formatter ->format ([1.2 ,2.3 ,3.4 ]) . PHP_EOL ;
16+
17+ $ item = 'test ' ;
18+ $ item2 = 'test2 ' ;
19+ $ item3 = &$ item ;
20+ $ items = [$ item , $ item2 , $ item3 ];
21+ $ items2 = &$ items ;
22+
23+ echo $ formatter ->format ($ items ) . PHP_EOL ;
24+ echo $ formatter ->format ($ items2 ) . PHP_EOL ;
25+
26+ echo $ formatter ->format ([null , true , false ]) . PHP_EOL ;
27+
28+ $ classItem = new class {
29+ public function __toString () {
30+ return 'foo ' ;
31+ }
32+ };
33+
34+ echo $ formatter ->format ([1 , $ classItem ]) . PHP_EOL ;
35+
36+
1537echo 'FR ' . PHP_EOL ;
1638
1739$ formatter = new IntlListFormatter ('FR ' , IntlListFormatter::TYPE_AND , IntlListFormatter::WIDTH_WIDE );
@@ -20,10 +42,20 @@ echo $formatter->format([1,2,3]) . PHP_EOL;
2042$ formatter = new IntlListFormatter ('FR ' );
2143echo $ formatter ->format ([1 ,2 ,3 ]) . PHP_EOL ;
2244
45+ // Make it clear that numbers are not converted automatically to the locale. Use NumberFormatter for each value.
46+ echo $ formatter ->format ([1.2 ,2.3 ,3.4 ]) . PHP_EOL ;
47+
48+
2349--EXPECT --
2450EN_US
25511 , 2 , and 3
26521 , 2 , and 3
53+ 1.2 , 2.3 , and 3.4
54+ test, test2, and test
55+ test, test2, and test
56+ , 1 , and
57+ 1 and foo
2758FR
28591 , 2 et 3
29- 1 , 2 et 3
60+ 1 , 2 et 3
61+ 1.2 , 2.3 et 3.4
0 commit comments