@@ -10,15 +10,32 @@ class Foo {
10
10
* @param non-empty-string $nonE
11
11
* @param literal-string $literal
12
12
* @param 'foo'|'Foo' $edgeUnion
13
+ * @param MB_CASE_UPPER|MB_CASE_LOWER|MB_CASE_TITLE|MB_CASE_FOLD|MB_CASE_UPPER_SIMPLE|MB_CASE_LOWER_SIMPLE|MB_CASE_TITLE_SIMPLE|MB_CASE_FOLD_SIMPLE $caseMode
14
+ * @param 'aKV'|'hA'|'AH'|'K'|'KV'|'RNKV' $kanaMode
15
+ * @param mixed $mixed
13
16
*/
14
- public function bar ($ numericS , $ nonE , $ literal , $ edgeUnion ) {
17
+ public function bar ($ numericS , $ nonE , $ literal , $ edgeUnion, $ caseMode , $ kanaMode , $ mixed ) {
15
18
assertType ("'abc' " , strtolower ('ABC ' ));
16
19
assertType ("'ABC' " , strtoupper ('abc ' ));
17
20
assertType ("'abc' " , mb_strtolower ('ABC ' ));
18
21
assertType ("'ABC' " , mb_strtoupper ('abc ' ));
22
+ assertType ("'abc' " , mb_strtolower ('ABC ' , 'UTF-8 ' ));
23
+ assertType ("'ABC' " , mb_strtoupper ('abc ' , 'UTF-8 ' ));
24
+ assertType ("'abc' " , mb_strtolower ('Abc ' ));
25
+ assertType ("'ABC' " , mb_strtoupper ('Abc ' ));
19
26
assertType ("'aBC' " , lcfirst ('ABC ' ));
20
27
assertType ("'Abc' " , ucfirst ('abc ' ));
21
28
assertType ("'Hello World' " , ucwords ('hello world ' ));
29
+ assertType ("'Hello|World' " , ucwords ('hello|world ' , "| " ));
30
+ assertType ("'ČESKÁ REPUBLIKA' " , mb_convert_case ('Česká republika ' , MB_CASE_UPPER ));
31
+ assertType ("'česká republika' " , mb_convert_case ('Česká republika ' , MB_CASE_LOWER ));
32
+ assertType ("non-falsy-string " , mb_convert_case ('Česká republika ' , $ mixed ));
33
+ assertType ("'ČESKÁ REPUBLIKA'|'Česká Republika'|'česká republika' " , mb_convert_case ('Česká republika ' , $ caseMode ));
34
+ assertType ("'Abc123アイウガギグばびぶ漢字' " , mb_convert_kana ('Abc123アイウガギグばびぶ漢字 ' ));
35
+ assertType ("'Abc123アイウガギグばびぶ漢字' " , mb_convert_kana ('Abc123アイウガギグばびぶ漢字 ' , 'aKV ' ));
36
+ assertType ("'Abc123アイウガギグバビブ漢字' " , mb_convert_kana ('Abc123アイウガギグばびぶ漢字 ' , 'hA ' ));
37
+ assertType ("'Abc123アガば漢'|'Abc123あか゛ば漢'|'Abc123アカ゛ば漢'|'Abc123アガば漢'|'Abc123アガバ漢' " , mb_convert_kana ('Abc123アガば漢 ' , $ kanaMode ));
38
+ assertType ("non-falsy-string " , mb_convert_kana ('Abc123アガば漢 ' , $ mixed ));
22
39
23
40
assertType ("numeric-string " , strtolower ($ numericS ));
24
41
assertType ("numeric-string " , strtoupper ($ numericS ));
@@ -27,6 +44,11 @@ public function bar($numericS, $nonE, $literal, $edgeUnion) {
27
44
assertType ("numeric-string " , lcfirst ($ numericS ));
28
45
assertType ("numeric-string " , ucfirst ($ numericS ));
29
46
assertType ("numeric-string " , ucwords ($ numericS ));
47
+ assertType ("numeric-string " , mb_convert_case ($ numericS , MB_CASE_UPPER ));
48
+ assertType ("numeric-string " , mb_convert_case ($ numericS , MB_CASE_LOWER ));
49
+ assertType ("numeric-string " , mb_convert_case ($ numericS , $ mixed ));
50
+ assertType ("numeric-string " , mb_convert_kana ($ numericS ));
51
+ assertType ("numeric-string " , mb_convert_kana ($ numericS , $ mixed ));
30
52
31
53
assertType ("non-empty-string " , strtolower ($ nonE ));
32
54
assertType ("non-empty-string " , strtoupper ($ nonE ));
@@ -35,6 +57,11 @@ public function bar($numericS, $nonE, $literal, $edgeUnion) {
35
57
assertType ("non-empty-string " , lcfirst ($ nonE ));
36
58
assertType ("non-empty-string " , ucfirst ($ nonE ));
37
59
assertType ("non-empty-string " , ucwords ($ nonE ));
60
+ assertType ("non-empty-string " , mb_convert_case ($ nonE , MB_CASE_UPPER ));
61
+ assertType ("non-empty-string " , mb_convert_case ($ nonE , MB_CASE_LOWER ));
62
+ assertType ("non-empty-string " , mb_convert_case ($ nonE , $ mixed ));
63
+ assertType ("non-empty-string " , mb_convert_kana ($ nonE ));
64
+ assertType ("non-empty-string " , mb_convert_kana ($ nonE , $ mixed ));
38
65
39
66
assertType ("string " , strtolower ($ literal ));
40
67
assertType ("string " , strtoupper ($ literal ));
@@ -43,18 +70,21 @@ public function bar($numericS, $nonE, $literal, $edgeUnion) {
43
70
assertType ("string " , lcfirst ($ literal ));
44
71
assertType ("string " , ucfirst ($ literal ));
45
72
assertType ("string " , ucwords ($ literal ));
73
+ assertType ("string " , mb_convert_case ($ literal , MB_CASE_UPPER ));
74
+ assertType ("string " , mb_convert_case ($ literal , MB_CASE_LOWER ));
75
+ assertType ("string " , mb_convert_case ($ literal , $ mixed ));
76
+ assertType ("string " , mb_convert_kana ($ literal ));
77
+ assertType ("string " , mb_convert_kana ($ literal , $ mixed ));
46
78
47
79
assertType ("'foo' " , lcfirst ($ edgeUnion ));
48
80
}
49
81
50
82
public function foo () {
51
- // calls with a 2nd arg could be more precise, but there was no use-case yet to support it
52
- assertType ("non-falsy-string " , mb_strtolower ('ABC ' , 'UTF-8 ' ));
53
- assertType ("non-falsy-string " , mb_strtoupper ('abc ' , 'UTF-8 ' ));
54
- assertType ("non-falsy-string " , ucwords ('hello|world! ' , "| " ));
55
-
56
83
// invalid char conversions still lead to non-falsy-string
57
84
assertType ("non-falsy-string " , mb_strtolower ("\xfe\xff\x65\xe5\x67\x2c\x8a\x9e" , 'CP1252 ' ));
58
-
85
+ // valid char sequence, but not support non ASCII / UTF-8 encodings
86
+ assertType ("non-falsy-string " , mb_convert_kana ("\x95\x5c\x8c\xbb" , 'SJIS-win ' ));
87
+ // invalid UTF-8 sequence
88
+ assertType ("non-falsy-string " , mb_convert_kana ("\x95\x5c\x8c\xbb" , 'UTF-8 ' ));
59
89
}
60
90
}
0 commit comments