@@ -16,33 +16,33 @@ function doMatch(string $s): void
16
16
assertType ('array{}|array{string} ' , $ matches );
17
17
18
18
if (Preg::match ('/Price: (£|€)\d+/ ' , $ s , $ matches )) {
19
- assertType ('array{string, non-empty-string } ' , $ matches );
19
+ assertType ('array{string, \' £ \' | \' € \' } ' , $ matches );
20
20
} else {
21
21
assertType ('array{} ' , $ matches );
22
22
}
23
- assertType ('array{}|array{string, non-empty-string } ' , $ matches );
23
+ assertType ('array{}|array{string, \' £ \' | \' € \' } ' , $ matches );
24
24
25
25
if (Preg::match ('/Price: (£|€)?\d+/ ' , $ s , $ matches )) {
26
- assertType ('array{string, non-empty-string |null} ' , $ matches );
26
+ assertType ('array{string, \' £ \' | \' € \' |null} ' , $ matches );
27
27
} else {
28
28
assertType ('array{} ' , $ matches );
29
29
}
30
- assertType ('array{}|array{string, non-empty-string |null} ' , $ matches );
30
+ assertType ('array{}|array{string, \' £ \' | \' € \' |null} ' , $ matches );
31
31
32
32
// passing the PREG_UNMATCHED_AS_NULL should change nothing compared to above as it is always set
33
33
if (Preg::match ('/Price: (£|€)?\d+/ ' , $ s , $ matches , PREG_UNMATCHED_AS_NULL )) {
34
- assertType ('array{string, non-empty-string |null} ' , $ matches );
34
+ assertType ('array{string, \' £ \' | \' € \' |null} ' , $ matches );
35
35
} else {
36
36
assertType ('array{} ' , $ matches );
37
37
}
38
- assertType ('array{}|array{string, non-empty-string |null} ' , $ matches );
38
+ assertType ('array{}|array{string, \' £ \' | \' € \' |null} ' , $ matches );
39
39
40
40
if (Preg::isMatch ('/Price: (?<currency>£|€)\d+/ ' , $ s , $ matches )) {
41
- assertType ('array{0: string, currency: non-empty-string , 1: non-empty-string } ' , $ matches );
41
+ assertType ('array{0: string, currency: \' £ \' | \' € \' , 1: \' £ \' | \' € \' } ' , $ matches );
42
42
} else {
43
43
assertType ('array{} ' , $ matches );
44
44
}
45
- assertType ('array{}|array{0: string, currency: non-empty-string , 1: non-empty-string } ' , $ matches );
45
+ assertType ('array{}|array{0: string, currency: \' £ \' | \' € \' , 1: \' £ \' | \' € \' } ' , $ matches );
46
46
}
47
47
48
48
function doMatchStrictGroups (string $ s ): void
@@ -55,18 +55,18 @@ function doMatchStrictGroups(string $s): void
55
55
assertType ('array{}|array{string} ' , $ matches );
56
56
57
57
if (Preg::matchStrictGroups ('/Price: (£|€)\d+/ ' , $ s , $ matches )) {
58
- assertType ('array{string, non-empty-string } ' , $ matches );
58
+ assertType ('array{string, \' £ \' | \' € \' } ' , $ matches );
59
59
} else {
60
60
assertType ('array{} ' , $ matches );
61
61
}
62
- assertType ('array{}|array{string, non-empty-string } ' , $ matches );
62
+ assertType ('array{}|array{string, \' £ \' | \' € \' } ' , $ matches );
63
63
64
64
if (Preg::isMatchStrictGroups ('/Price: (?<test>£|€)\d+/ ' , $ s , $ matches )) {
65
- assertType ('array{0: string, test: non-empty-string , 1: non-empty-string } ' , $ matches );
65
+ assertType ('array{0: string, test: \' £ \' | \' € \' , 1: \' £ \' | \' € \' } ' , $ matches );
66
66
} else {
67
67
assertType ('array{} ' , $ matches );
68
68
}
69
- assertType ('array{}|array{0: string, test: non-empty-string , 1: non-empty-string } ' , $ matches );
69
+ assertType ('array{}|array{0: string, test: \' £ \' | \' € \' , 1: \' £ \' | \' € \' } ' , $ matches );
70
70
}
71
71
72
72
function doMatchStrictGroupsUnsafe (string $ s ): void
@@ -98,21 +98,21 @@ function doMatchAllStrictGroups(string $s): void
98
98
assertType ('array{}|array{list<string>} ' , $ matches );
99
99
100
100
if (Preg::matchAllStrictGroups ('/Price: (£|€)\d+/ ' , $ s , $ matches )) {
101
- assertType ('array{list<string>, list<non-empty-string >} ' , $ matches );
101
+ assertType ('array{list<string>, list< \' £ \' | \' € \' >} ' , $ matches );
102
102
} else {
103
103
assertType ('array{} ' , $ matches );
104
104
}
105
- assertType ('array{}|array{list<string>, list<non-empty-string >} ' , $ matches );
105
+ assertType ('array{}|array{list<string>, list< \' £ \' | \' € \' >} ' , $ matches );
106
106
107
107
if (Preg::isMatchAllStrictGroups ('/Price: (?<test>£|€)\d+/ ' , $ s , $ matches )) {
108
- assertType ('array{0: list<string>, test: list<non-empty-string >, 1: list<non-empty-string >} ' , $ matches );
108
+ assertType ('array{0: list<string>, test: list< \' £ \' | \' € \' >, 1: list< \' £ \' | \' € \' >} ' , $ matches );
109
109
} else {
110
110
assertType ('array{} ' , $ matches );
111
111
}
112
- assertType ('array{}|array{0: list<string>, test: list<non-empty-string >, 1: list<non-empty-string >} ' , $ matches );
112
+ assertType ('array{}|array{0: list<string>, test: list< \' £ \' | \' € \' >, 1: list< \' £ \' | \' € \' >} ' , $ matches );
113
113
114
114
if (Preg::isMatchAllStrictGroups ('/Price: (?<test>£|€)?\d+/ ' , $ s , $ matches )) {
115
- assertType ('array{0: list<string>, test: list<non-empty-string >, 1: list<non-empty-string >} ' , $ matches );
115
+ assertType ('array{0: list<string>, test: list< \' £ \' | \' € \' >, 1: list< \' £ \' | \' € \' >} ' , $ matches );
116
116
}
117
117
}
118
118
0 commit comments