9
9
* @param int<3, 10> $threeToTen
10
10
* @param int<10, max> $tenOrMore
11
11
* @param int<-10, -5> $negative
12
+ * @param int<min, -6> $smallerMinusSix
12
13
* @param lowercase-string $lowercase
13
14
*
14
15
* @return void
15
16
*/
16
- function doFoo ($ oneToThree , $ threeToTen , $ tenOrMore , $ negative , int $ i , string $ lowercase ) {
17
+ function doFoo ($ oneToThree , $ threeToTen , $ tenOrMore , $ negative , int $ smallerMinusSix , int $ i , string $ lowercase ) {
17
18
$ s = "world " ;
18
19
if (rand (0 , 1 )) {
19
20
$ s = "hello " ;
@@ -26,10 +27,23 @@ function doFoo($oneToThree, $threeToTen, $tenOrMore, $negative, int $i, string $
26
27
assertType ("'e'|'l'|'o'|'r' " , $ s [$ oneToThree ]);
27
28
assertType ('*ERROR* ' , $ s [$ tenOrMore ]);
28
29
assertType ("''|'d'|'l'|'o' " , $ s [$ threeToTen ]);
29
- assertType ("*ERROR* " , $ s [$ negative ]);
30
+ assertType ("non-empty-string " , $ s [$ negative ]);
31
+ assertType ("*ERROR* " , $ s [$ smallerMinusSix ]);
30
32
31
33
$ longString = "myF5HnJv799kWf8VRI7g97vwnABTwN9y2CzAVELCBfRqyqkdTzXg7BkGXcwuIOscAiT6tSuJGzVZOJnYXvkiKQzYBNjjkCPOzSKXR5YHRlVxV1BetqZz4XOmaH9mtacJ9azNYL6bNXezSBjX13BSZy02SK2udzQLbTPNQwlKadKaNkUxjtWegkb8QDFaXbzH1JENVSLVH0FYd6POBU82X1xu7FDDKYLzwsWJHBGVhG8iugjEGwLj22x5ViosUyKR " ;
32
34
assertType ("non-empty-string " , $ longString [$ i ]);
33
35
34
36
assertType ("lowercase-string&non-empty-string " , $ lowercase [$ i ]);
35
37
}
38
+
39
+ function bug12122 ()
40
+ {
41
+ // see https://3v4l.org/8EMdX
42
+ $ foo = 'fo ' ;
43
+ assertType ('*ERROR* ' , $ foo [2 ]);
44
+ assertType ("'o' " , $ foo [1 ]);
45
+ assertType ("'f' " , $ foo [0 ]);
46
+ assertType ("'o' " , $ foo [-1 ]);
47
+ assertType ("'f' " , $ foo [-2 ]);
48
+ assertType ('*ERROR* ' , $ foo [-3 ]);
49
+ }
0 commit comments