aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2025-03-04 14:23:21 +0100
committerGitHub <noreply@github.com>2025-03-04 14:23:21 +0100
commit42d752f7679ebd8c34c8932aaa64d1f9a92be02d (patch)
tree781f696535e9300cc005aad7e10aa5eee78c57a9 /tests/lib
parentbeb12e9be3a3c235ab1552cc3f66f442820f19d6 (diff)
parent6594d7d96d7695567bbc42d882c3bfebfbab97a3 (diff)
downloadnextcloud-server-42d752f7679ebd8c34c8932aaa64d1f9a92be02d.tar.gz
nextcloud-server-42d752f7679ebd8c34c8932aaa64d1f9a92be02d.zip
Merge pull request #51116 from nextcloud/enh/noid/nullable-range
feat(AppFramework): extend range check to optional parameters
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
index e0748d89f7f..00ae4792824 100644
--- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
+++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php
@@ -43,9 +43,11 @@ class MiddleController extends BaseController {
/**
* @psalm-param int<-4, 42> $rangedOne
* @psalm-param int<min, max> $rangedTwo
+ * @psalm-param int<1, 6>|null $rangedThree
+ * @psalm-param ?int<-70, -30> $rangedFour
* @return void
*/
- public function test4(int $rangedOne, int $rangedTwo) {
+ public function test4(int $rangedOne, int $rangedTwo, ?int $rangedThree, ?int $rangedFour) {
}
}
@@ -239,5 +241,13 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
$rangeInfo2 = $reader->getRange('rangedTwo');
$this->assertSame(PHP_INT_MIN, $rangeInfo2['min']);
$this->assertSame(PHP_INT_MAX, $rangeInfo2['max']);
+
+ $rangeInfo3 = $reader->getRange('rangedThree');
+ $this->assertSame(1, $rangeInfo3['min']);
+ $this->assertSame(6, $rangeInfo3['max']);
+
+ $rangeInfo3 = $reader->getRange('rangedFour');
+ $this->assertSame(-70, $rangeInfo3['min']);
+ $this->assertSame(-30, $rangeInfo3['max']);
}
}