Skip to content

Commit 1ed0769

Browse files
refactor: Apply rector changes
Signed-off-by: GitHub <noreply@github.com>
1 parent cde3780 commit 1ed0769

File tree

8 files changed

+30
-24
lines changed

8 files changed

+30
-24
lines changed

apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testAfterPutNotFoundException(): void {
4747
$this->server->expects($this->once())
4848
->method('on')
4949
->willReturnCallback(
50-
function ($method, $callback) use (&$afterPut) {
50+
function ($method, $callback) use (&$afterPut): void {
5151
$this->assertSame('afterMethod:PUT', $method);
5252
$afterPut = $callback;
5353
});
@@ -70,7 +70,7 @@ public function testAfterPut(?string $ownerId, bool $expectOwnerIdHeader,
7070
$this->server->expects($this->once())
7171
->method('on')
7272
->willReturnCallback(
73-
function ($method, $callback) use (&$afterPut) {
73+
function ($method, $callback) use (&$afterPut): void {
7474
$this->assertSame('afterMethod:PUT', $method);
7575
$afterPut = $callback;
7676
});
@@ -92,7 +92,7 @@ function ($method, $callback) use (&$afterPut) {
9292
$expectPermissionsHeader,
9393
$expectOwnerIdHeader,
9494
$matcher,
95-
$ownerId, $permissions) {
95+
$ownerId, $permissions): void {
9696
$invocationNumber = $matcher->numberOfInvocations();
9797
if ($invocationNumber === 0) {
9898
throw new LogicException('No invocations were expected');

tests/lib/AppFramework/Http/DispatcherTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function setUp(): void {
123123

124124
$this->request = $this->createMock(Request::class);
125125

126-
$this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
126+
$this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class));
127127

128128
$this->dispatcher = new Dispatcher(
129129
$this->http,

tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use OCP\AppFramework\Http\Response;
1313
use OCP\IRequest;
1414
use OCP\Security\Bruteforce\IThrottler;
15+
use OCP\Server;
1516
use Psr\Log\LoggerInterface;
1617
use Test\AppFramework\Middleware\Security\Mock\BruteForceMiddlewareController;
1718
use Test\TestCase;
@@ -30,7 +31,7 @@ class BruteForceMiddlewareTest extends TestCase {
3031
protected function setUp(): void {
3132
parent::setUp();
3233

33-
$this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
34+
$this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class));
3435
$this->throttler = $this->createMock(IThrottler::class);
3536
$this->request = $this->createMock(IRequest::class);
3637
$this->logger = $this->createMock(LoggerInterface::class);

tests/lib/AppFramework/Middleware/Security/CORSMiddlewareTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use OCP\IRequest;
2121
use OCP\IRequestId;
2222
use OCP\Security\Bruteforce\IThrottler;
23+
use OCP\Server;
2324
use PHPUnit\Framework\MockObject\MockObject;
2425
use Psr\Log\LoggerInterface;
2526
use Test\AppFramework\Middleware\Security\Mock\CORSMiddlewareController;
@@ -33,7 +34,7 @@ class CORSMiddlewareTest extends \Test\TestCase {
3334

3435
protected function setUp(): void {
3536
parent::setUp();
36-
$this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
37+
$this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class));
3738
$this->session = $this->createMock(Session::class);
3839
$this->throttler = $this->createMock(IThrottler::class);
3940
$this->logger = $this->createMock(LoggerInterface::class);

tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use OCP\ISession;
1919
use OCP\IUser;
2020
use OCP\IUserSession;
21+
use OCP\Server;
2122
use Psr\Log\LoggerInterface;
2223
use Test\AppFramework\Middleware\Security\Mock\PasswordConfirmationMiddlewareController;
2324
use Test\TestCase;
@@ -45,7 +46,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase {
4546
private Manager $userManager;
4647

4748
protected function setUp(): void {
48-
$this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
49+
$this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class));
4950
$this->session = $this->createMock(ISession::class);
5051
$this->userSession = $this->createMock(IUserSession::class);
5152
$this->user = $this->createMock(IUser::class);

tests/lib/AppFramework/Middleware/Security/RateLimitingMiddlewareTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use OCP\ISession;
2323
use OCP\IUser;
2424
use OCP\IUserSession;
25+
use OCP\Server;
2526
use PHPUnit\Framework\MockObject\MockObject;
2627
use Psr\Log\LoggerInterface;
2728
use Test\AppFramework\Middleware\Security\Mock\RateLimitingMiddlewareController;
@@ -45,7 +46,7 @@ protected function setUp(): void {
4546

4647
$this->request = $this->createMock(IRequest::class);
4748
$this->userSession = $this->createMock(IUserSession::class);
48-
$this->reflector = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
49+
$this->reflector = new ControllerMethodReflector(Server::get(LoggerInterface::class));
4950
$this->limiter = $this->createMock(Limiter::class);
5051
$this->session = $this->createMock(ISession::class);
5152
$this->appConfig = $this->createMock(IAppConfig::class);

tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use OCP\IUser;
3939
use OCP\IUserSession;
4040
use OCP\Security\Ip\IRemoteAddress;
41+
use OCP\Server;
4142
use PHPUnit\Framework\MockObject\MockObject;
4243
use Psr\Log\LoggerInterface;
4344
use Test\AppFramework\Middleware\Security\Mock\NormalController;
@@ -72,7 +73,7 @@ protected function setUp(): void {
7273
'test',
7374
$this->request
7475
);
75-
$this->reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
76+
$this->reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
7677
$this->logger = $this->createMock(LoggerInterface::class);
7778
$this->navigationManager = $this->createMock(INavigationManager::class);
7879
$this->urlGenerator = $this->createMock(IURLGenerator::class);

tests/lib/AppFramework/Utility/ControllerMethodReflectorTest.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Test\AppFramework\Utility;
1010

1111
use OC\AppFramework\Utility\ControllerMethodReflector;
12+
use OCP\Server;
1213
use Psr\Log\LoggerInterface;
1314

1415
class BaseController {
@@ -70,7 +71,7 @@ class ControllerMethodReflectorTest extends \Test\TestCase {
7071
* @Annotation
7172
*/
7273
public function testReadAnnotation(): void {
73-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
74+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
7475
$reader->reflect(
7576
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
7677
'testReadAnnotation'
@@ -83,7 +84,7 @@ public function testReadAnnotation(): void {
8384
* @Annotation(parameter=value)
8485
*/
8586
public function testGetAnnotationParameterSingle(): void {
86-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
87+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
8788
$reader->reflect(
8889
self::class,
8990
__FUNCTION__
@@ -96,7 +97,7 @@ public function testGetAnnotationParameterSingle(): void {
9697
* @Annotation(parameter1=value1, parameter2=value2,parameter3=value3)
9798
*/
9899
public function testGetAnnotationParameterMultiple(): void {
99-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
100+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
100101
$reader->reflect(
101102
self::class,
102103
__FUNCTION__
@@ -112,7 +113,7 @@ public function testGetAnnotationParameterMultiple(): void {
112113
* @param test
113114
*/
114115
public function testReadAnnotationNoLowercase(): void {
115-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
116+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
116117
$reader->reflect(
117118
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
118119
'testReadAnnotationNoLowercase'
@@ -128,7 +129,7 @@ public function testReadAnnotationNoLowercase(): void {
128129
* @param int $test
129130
*/
130131
public function testReadTypeIntAnnotations(): void {
131-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
132+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
132133
$reader->reflect(
133134
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
134135
'testReadTypeIntAnnotations'
@@ -146,7 +147,7 @@ public function arguments3($a, float $b, int $c, $d) {
146147
}
147148

148149
public function testReadTypeIntAnnotationsScalarTypes(): void {
149-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
150+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
150151
$reader->reflect(
151152
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
152153
'arguments3'
@@ -164,7 +165,7 @@ public function testReadTypeIntAnnotationsScalarTypes(): void {
164165
* @param double $test something special
165166
*/
166167
public function testReadTypeDoubleAnnotations(): void {
167-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
168+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
168169
$reader->reflect(
169170
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
170171
'testReadTypeDoubleAnnotations'
@@ -178,7 +179,7 @@ public function testReadTypeDoubleAnnotations(): void {
178179
* @param string $foo
179180
*/
180181
public function testReadTypeWhitespaceAnnotations(): void {
181-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
182+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
182183
$reader->reflect(
183184
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
184185
'testReadTypeWhitespaceAnnotations'
@@ -191,7 +192,7 @@ public function testReadTypeWhitespaceAnnotations(): void {
191192
public function arguments($arg, $arg2 = 'hi') {
192193
}
193194
public function testReflectParameters(): void {
194-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
195+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
195196
$reader->reflect(
196197
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
197198
'arguments'
@@ -204,7 +205,7 @@ public function testReflectParameters(): void {
204205
public function arguments2($arg) {
205206
}
206207
public function testReflectParameters2(): void {
207-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
208+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
208209
$reader->reflect(
209210
'\Test\AppFramework\Utility\ControllerMethodReflectorTest',
210211
'arguments2'
@@ -215,15 +216,15 @@ public function testReflectParameters2(): void {
215216

216217

217218
public function testInheritance(): void {
218-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
219+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
219220
$reader->reflect('Test\AppFramework\Utility\EndController', 'test');
220221

221222
$this->assertTrue($reader->hasAnnotation('Annotation'));
222223
}
223224

224225

225226
public function testInheritanceOverride(): void {
226-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
227+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
227228
$reader->reflect('Test\AppFramework\Utility\EndController', 'test2');
228229

229230
$this->assertTrue($reader->hasAnnotation('NoAnnotation'));
@@ -232,14 +233,14 @@ public function testInheritanceOverride(): void {
232233

233234

234235
public function testInheritanceOverrideNoDocblock(): void {
235-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
236+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
236237
$reader->reflect('Test\AppFramework\Utility\EndController', 'test3');
237238

238239
$this->assertFalse($reader->hasAnnotation('Annotation'));
239240
}
240241

241242
public function testRangeDetectionPsalm(): void {
242-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
243+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
243244
$reader->reflect('Test\AppFramework\Utility\EndController', 'test4');
244245

245246
$rangeInfo1 = $reader->getRange('rangedOne');
@@ -260,7 +261,7 @@ public function testRangeDetectionPsalm(): void {
260261
}
261262

262263
public function testRangeDetectionNative(): void {
263-
$reader = new ControllerMethodReflector(\OCP\Server::get(LoggerInterface::class));
264+
$reader = new ControllerMethodReflector(Server::get(LoggerInterface::class));
264265
$reader->reflect('Test\AppFramework\Utility\EndController', 'test5');
265266

266267
$rangeInfo1 = $reader->getRange('rangedOne');

0 commit comments

Comments
 (0)