@@ -49,6 +49,16 @@ public function test3() {
4949 */
5050 public function test4 (int $ rangedOne , int $ rangedTwo , ?int $ rangedThree , ?int $ rangedFour ) {
5151 }
52+
53+ /**
54+ * @param int<-4, 42> $rangedOne
55+ * @param int<min, max> $rangedTwo
56+ * @param int<1, 6>|null $rangedThree
57+ * @param ?int<-70, -30> $rangedFour
58+ * @return void
59+ */
60+ public function test5 (int $ rangedOne , int $ rangedTwo , ?int $ rangedThree , ?int $ rangedFour ) {
61+ }
5262}
5363
5464class EndController extends MiddleController {
@@ -230,7 +240,7 @@ public function testInheritanceOverrideNoDocblock(): void {
230240 $ this ->assertFalse ($ reader ->hasAnnotation ('Annotation ' ));
231241 }
232242
233- public function testRangeDetection (): void {
243+ public function testRangeDetectionPsalm (): void {
234244 $ reader = new ControllerMethodReflector ();
235245 $ reader ->reflect ('Test\AppFramework\Utility\EndController ' , 'test4 ' );
236246
@@ -250,4 +260,25 @@ public function testRangeDetection(): void {
250260 $ this ->assertSame (-70 , $ rangeInfo3 ['min ' ]);
251261 $ this ->assertSame (-30 , $ rangeInfo3 ['max ' ]);
252262 }
263+
264+ public function testRangeDetectionNative (): void {
265+ $ reader = new ControllerMethodReflector ();
266+ $ reader ->reflect ('Test\AppFramework\Utility\EndController ' , 'test5 ' );
267+
268+ $ rangeInfo1 = $ reader ->getRange ('rangedOne ' );
269+ $ this ->assertSame (-4 , $ rangeInfo1 ['min ' ]);
270+ $ this ->assertSame (42 , $ rangeInfo1 ['max ' ]);
271+
272+ $ rangeInfo2 = $ reader ->getRange ('rangedTwo ' );
273+ $ this ->assertSame (PHP_INT_MIN , $ rangeInfo2 ['min ' ]);
274+ $ this ->assertSame (PHP_INT_MAX , $ rangeInfo2 ['max ' ]);
275+
276+ $ rangeInfo3 = $ reader ->getRange ('rangedThree ' );
277+ $ this ->assertSame (1 , $ rangeInfo3 ['min ' ]);
278+ $ this ->assertSame (6 , $ rangeInfo3 ['max ' ]);
279+
280+ $ rangeInfo3 = $ reader ->getRange ('rangedFour ' );
281+ $ this ->assertSame (-70 , $ rangeInfo3 ['min ' ]);
282+ $ this ->assertSame (-30 , $ rangeInfo3 ['max ' ]);
283+ }
253284}
0 commit comments