diff --git a/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php index 84a99f0c52d21..fc19ed590a0cc 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php @@ -47,7 +47,7 @@ public function testAfterPutNotFoundException(): void { $this->server->expects($this->once()) ->method('on') ->willReturnCallback( - function ($method, $callback) use (&$afterPut) { + function ($method, $callback) use (&$afterPut): void { $this->assertSame('afterMethod:PUT', $method); $afterPut = $callback; }); @@ -70,7 +70,7 @@ public function testAfterPut(?string $ownerId, bool $expectOwnerIdHeader, $this->server->expects($this->once()) ->method('on') ->willReturnCallback( - function ($method, $callback) use (&$afterPut) { + function ($method, $callback) use (&$afterPut): void { $this->assertSame('afterMethod:PUT', $method); $afterPut = $callback; }); @@ -92,7 +92,7 @@ function ($method, $callback) use (&$afterPut) { $expectPermissionsHeader, $expectOwnerIdHeader, $matcher, - $ownerId, $permissions) { + $ownerId, $permissions): void { $invocationNumber = $matcher->numberOfInvocations(); if ($invocationNumber === 0) { throw new LogicException('No invocations were expected'); diff --git a/tests/lib/AppFramework/Http/DispatcherTest.php b/tests/lib/AppFramework/Http/DispatcherTest.php index 03a1242dd1fef..023e984a9b7f1 100644 --- a/tests/lib/AppFramework/Http/DispatcherTest.php +++ b/tests/lib/AppFramework/Http/DispatcherTest.php @@ -123,7 +123,7 @@ protected function setUp(): void { $this->request = $this->createMock(Request::class); - $this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $this->dispatcher = new Dispatcher( $this->http, diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index e386cb82d2cfa..4c4ece1b135e7 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -12,6 +12,7 @@ use OCP\AppFramework\Http\Response; use OCP\IRequest; use OCP\Security\Bruteforce\IThrottler; +use OCP\Server; use Psr\Log\LoggerInterface; use Test\AppFramework\Middleware\Security\Mock\BruteForceMiddlewareController; use Test\TestCase; @@ -30,7 +31,7 @@ class BruteForceMiddlewareTest extends TestCase { protected function setUp(): void { parent::setUp(); - $this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $this->throttler = $this->createMock(IThrottler::class); $this->request = $this->createMock(IRequest::class); $this->logger = $this->createMock(LoggerInterface::class); diff --git a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php index 0b47174553f47..dfc1c04b637fc 100644 --- a/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php @@ -20,6 +20,7 @@ use OCP\IRequest; use OCP\IRequestId; use OCP\Security\Bruteforce\IThrottler; +use OCP\Server; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\AppFramework\Middleware\Security\Mock\CORSMiddlewareController; @@ -33,7 +34,7 @@ class CORSMiddlewareTest extends \Test\TestCase { protected function setUp(): void { parent::setUp(); - $this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $this->session = $this->createMock(Session::class); $this->throttler = $this->createMock(IThrottler::class); $this->logger = $this->createMock(LoggerInterface::class); diff --git a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php index e0d1c254c9dbf..bf0de064d96c2 100644 --- a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php @@ -18,6 +18,7 @@ use OCP\ISession; use OCP\IUser; use OCP\IUserSession; +use OCP\Server; use Psr\Log\LoggerInterface; use Test\AppFramework\Middleware\Security\Mock\PasswordConfirmationMiddlewareController; use Test\TestCase; @@ -45,7 +46,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase { private Manager $userManager; protected function setUp(): void { - $this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $this->session = $this->createMock(ISession::class); $this->userSession = $this->createMock(IUserSession::class); $this->user = $this->createMock(IUser::class); diff --git a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php index beb9424424f7b..cd2f952d4da6c 100644 --- a/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php @@ -22,6 +22,7 @@ use OCP\ISession; use OCP\IUser; use OCP\IUserSession; +use OCP\Server; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\AppFramework\Middleware\Security\Mock\RateLimitingMiddlewareController; @@ -45,7 +46,7 @@ protected function setUp(): void { $this->request = $this->createMock(IRequest::class); $this->userSession = $this->createMock(IUserSession::class); - $this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $this->limiter = $this->createMock(Limiter::class); $this->session = $this->createMock(ISession::class); $this->appConfig = $this->createMock(IAppConfig::class); diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index b47144621898e..fbb76573324c9 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -38,6 +38,7 @@ use OCP\IUser; use OCP\IUserSession; use OCP\Security\Ip\IRemoteAddress; +use OCP\Server; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; use Test\AppFramework\Middleware\Security\Mock\NormalController; @@ -72,7 +73,7 @@ protected function setUp(): void { 'test', $this->request ); - $this->reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $this->reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $this->logger = $this->createMock(LoggerInterface::class); $this->navigationManager = $this->createMock(INavigationManager::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); diff --git a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php index 56e3070f5dc68..d5413f8a86296 100644 --- a/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php +++ b/tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php @@ -9,6 +9,7 @@ namespace Test\AppFramework\Utility; use OC\AppFramework\Utility\ControllerMethodReflector; +use OCP\Server; use Psr\Log\LoggerInterface; class BaseController { @@ -70,7 +71,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase { * @Annotation */ public function testReadAnnotation(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotation' @@ -83,7 +84,7 @@ public function testReadAnnotation(): void { * @Annotation(parameter=value) */ public function testGetAnnotationParameterSingle(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( self::class, __FUNCTION__ @@ -96,7 +97,7 @@ public function testGetAnnotationParameterSingle(): void { * @Annotation(parameter1=value1, parameter2=value2,parameter3=value3) */ public function testGetAnnotationParameterMultiple(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( self::class, __FUNCTION__ @@ -112,7 +113,7 @@ public function testGetAnnotationParameterMultiple(): void { * @param test */ public function testReadAnnotationNoLowercase(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadAnnotationNoLowercase' @@ -128,7 +129,7 @@ public function testReadAnnotationNoLowercase(): void { * @param int $test */ public function testReadTypeIntAnnotations(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeIntAnnotations' @@ -146,7 +147,7 @@ public function arguments3($a, float $b, int $c, $d) { } public function testReadTypeIntAnnotationsScalarTypes(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments3' @@ -164,7 +165,7 @@ public function testReadTypeIntAnnotationsScalarTypes(): void { * @param double $test something special */ public function testReadTypeDoubleAnnotations(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeDoubleAnnotations' @@ -178,7 +179,7 @@ public function testReadTypeDoubleAnnotations(): void { * @param string $foo */ public function testReadTypeWhitespaceAnnotations(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'testReadTypeWhitespaceAnnotations' @@ -191,7 +192,7 @@ public function testReadTypeWhitespaceAnnotations(): void { public function arguments($arg, $arg2 = 'hi') { } public function testReflectParameters(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments' @@ -204,7 +205,7 @@ public function testReflectParameters(): void { public function arguments2($arg) { } public function testReflectParameters2(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect( '\Test\AppFramework\Utility\ControllerMethodReflectorTest', 'arguments2' @@ -215,7 +216,7 @@ public function testReflectParameters2(): void { public function testInheritance(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect('Test\AppFramework\Utility\EndController', 'test'); $this->assertTrue($reader->hasAnnotation('Annotation')); @@ -223,7 +224,7 @@ public function testInheritance(): void { public function testInheritanceOverride(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect('Test\AppFramework\Utility\EndController', 'test2'); $this->assertTrue($reader->hasAnnotation('NoAnnotation')); @@ -232,14 +233,14 @@ public function testInheritanceOverride(): void { public function testInheritanceOverrideNoDocblock(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect('Test\AppFramework\Utility\EndController', 'test3'); $this->assertFalse($reader->hasAnnotation('Annotation')); } public function testRangeDetectionPsalm(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect('Test\AppFramework\Utility\EndController', 'test4'); $rangeInfo1 = $reader->getRange('rangedOne'); @@ -260,7 +261,7 @@ public function testRangeDetectionPsalm(): void { } public function testRangeDetectionNative(): void { - $reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class)); + $reader = new ControllerMethodReflector(Server::get(LoggerInterface::class)); $reader->reflect('Test\AppFramework\Utility\EndController', 'test5'); $rangeInfo1 = $reader->getRange('rangedOne');