66
77class  HelloWorld
88{
9- 	public  function  inputTypes (int  $ i , float  $ f , string  $ s ) {
9+ 	/** 
10+ 	 * @param int<-1, 5> $intRange 
11+ 	 */ 
12+ 	public  function  inputTypes (int  $ i , float  $ f , string  $ s , int  $ intRange ) {
1013		// https://3v4l.org/iXaDX 
1114		assertType ('numeric-string ' , sprintf ('%.14F ' , $ i ));
1215		assertType ('numeric-string ' , sprintf ('%.14F ' , $ f ));
@@ -19,6 +22,9 @@ public function inputTypes(int $i, float $f, string $s) {
1922		assertType ('numeric-string ' , sprintf ('%14F ' , $ i ));
2023		assertType ('numeric-string ' , sprintf ('%14F ' , $ f ));
2124		assertType ('numeric-string ' , sprintf ('%14F ' , $ s ));
25+ 
26+ 		assertType ("'-1'|'0'|'1'|'2'|'3'|'4'|'5' " , sprintf ('%s ' , $ intRange ));
27+ 		assertType ("' 0'|' 1'|' 2'|' 3'|' 4'|' 5'|'-1' " , sprintf ('%2s ' , $ intRange ));
2228	}
2329
2430	public  function  specifiers (int  $ i ) {
@@ -53,18 +59,27 @@ public function specifiers(int $i) {
5359	 */ 
5460	public  function  positionalArgs ($ mixed , int  $ i , float  $ f , string  $ s , int  $ posInt , int  $ negInt , int  $ nonZeroIntRange , int  $ intRange ) {
5561		// https://3v4l.org/vVL0c 
56- 		assertType ('numeric-string ' , sprintf ('%2$14s ' , $ mixed , $ i ));
57- 		assertType ('non-falsy-string&numeric-string ' , sprintf ('%2$14s ' , $ mixed , $ posInt ));
58- 		assertType ('non-falsy-string&numeric-string ' , sprintf ('%2$14s ' , $ mixed , $ negInt ));
59- 		assertType ('numeric-string ' , sprintf ('%2$14s ' , $ mixed , $ intRange ));
60- 		assertType ('non-falsy-string&numeric-string ' , sprintf ('%2$14s ' , $ mixed , $ nonZeroIntRange ));
61- 
62- 		assertType ("non-falsy-string " , sprintf ('%2$14s ' , $ mixed , 1 ));
63- 		assertType ("non-falsy-string " , sprintf ('%2$14s ' , $ mixed , '1 ' ));
64- 		assertType ("non-falsy-string " , sprintf ('%2$14s ' , $ mixed , 'abc ' ));
62+ 		assertType ('numeric-string ' , sprintf ('%2$6s ' , $ mixed , $ i ));
63+ 		assertType ('non-falsy-string&numeric-string ' , sprintf ('%2$6s ' , $ mixed , $ posInt ));
64+ 		assertType ('non-falsy-string&numeric-string ' , sprintf ('%2$6s ' , $ mixed , $ negInt ));
65+ 		assertType ("'     1'|'     2'|'     3'|'     4'|'     5' " , sprintf ('%2$6s ' , $ mixed , $ nonZeroIntRange ));
66+ 
67+ 		// https://3v4l.org/1ECIq 
68+ 		assertType ('non-falsy-string ' , sprintf ("%2$'#6s " , $ mixed , 1 ));
69+ 		assertType ('non-falsy-string ' , sprintf ("%2$'#6s " , $ mixed , $ i ));
70+ 		assertType ('non-falsy-string ' , sprintf ("%2$'#6s " , $ mixed , $ posInt ));
71+ 		assertType ('non-falsy-string ' , sprintf ("%2$'#6s " , $ mixed , $ negInt ));
72+ 		assertType ("'     0'|'     1'|'     2'|'     3'|'     4'|'     5'|'    -1' " , sprintf ('%2$6s ' , $ mixed , $ intRange ));
73+ 		assertType ('non-falsy-string ' , sprintf ("%2$'#6s " , $ mixed , $ nonZeroIntRange ));
74+ 
75+ 		assertType ("'     1' " , sprintf ('%2$6s ' , $ mixed , 1 ));
76+ 		assertType ("'     1' " , sprintf ('%2$6s ' , $ mixed , '1 ' ));
77+ 		assertType ("'   abc' " , sprintf ('%2$6s ' , $ mixed , 'abc ' ));
78+ 		assertType ("'     0'|'     1'|'     2'|'     3'|'     4'|'     5'|'    -1' " , sprintf ('%2$6s ' , $ mixed , $ intRange ));
6579		assertType ("'1' " , sprintf ('%2$s ' , $ mixed , 1 ));
6680		assertType ("'1' " , sprintf ('%2$s ' , $ mixed , '1 ' ));
6781		assertType ("'abc' " , sprintf ('%2$s ' , $ mixed , 'abc ' ));
82+ 		assertType ("'-1'|'0'|'1'|'2'|'3'|'4'|'5' " , sprintf ('%2$s ' , $ mixed , $ intRange ));
6883
6984		assertType ('numeric-string ' , sprintf ('%2$.14F ' , $ mixed , $ i ));
7085		assertType ('numeric-string ' , sprintf ('%2$.14F ' , $ mixed , $ f ));
0 commit comments