@@ -8,6 +8,7 @@ class HelloWorld
8
8
{
9
9
private const NUMERIC_STRING_1 = "1 " ;
10
10
private const NUMERIC_STRING_NEGATIVE_1 = "-1 " ;
11
+
11
12
public function doFoo ()
12
13
{
13
14
assertType ("array{''} " , preg_split ('/-/ ' , '' ));
@@ -39,6 +40,9 @@ public function doWithError() {
39
40
40
41
public function doWithVariables (string $ pattern , string $ subject , int $ offset , int $ flags ): void
41
42
{
43
+ assertType ("array{'1', '2', '3'}|array{'1-2-3'} " , preg_split ('/-/ ' , '1-2-3 ' , $ this ->generate ()));
44
+ assertType ("array{'1', '2', '3'}|array{'1-2-3'} " , preg_split ('/-/ ' , '1-2-3 ' , $ this ->generate (), $ this ->generate ()));
45
+
42
46
assertType ('list<array{string, int<0, max>}|string>|false ' , preg_split ($ pattern , $ subject , $ offset , $ flags ));
43
47
assertType ('list<array{string, int<0, max>}|string>|false ' , preg_split ("// " , $ subject , $ offset , $ flags ));
44
48
@@ -50,6 +54,13 @@ public function doWithVariables(string $pattern, string $subject, int $offset, i
50
54
assertType ('list<array{string, int<0, max>}>|false ' , preg_split ($ pattern , $ subject , $ offset , PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE ));
51
55
}
52
56
57
+ /**
58
+ * @return 1|'17'
59
+ */
60
+ private function generate (): int |string {
61
+ return (rand () % 2 === 0 ) ? 1 : "17 " ;
62
+ }
63
+
53
64
/**
54
65
* @param non-empty-string $nonEmptySubject
55
66
*/
0 commit comments