@@ -13,7 +13,7 @@ |
||
13 | 13 | use PHPUnit\Framework\MockObject\MockObject; |
14 | 14 | |
15 | 15 | class ReleaseMetadataTest extends \Test\TestCase { |
16 | - private IClientService|MockObject $clientService; |
|
16 | + private IClientService | MockObject $clientService; |
|
17 | 17 | |
18 | 18 | protected function setUp(): void { |
19 | 19 | parent::setUp(); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | ->getMock(); |
94 | 94 | $backend->expects($this->any()) |
95 | 95 | ->method('implementsActions') |
96 | - ->willReturnCallback(function ($actions) use ($implementedActions) { |
|
97 | - return (bool)($actions & $implementedActions); |
|
96 | + ->willReturnCallback(function($actions) use ($implementedActions) { |
|
97 | + return (bool) ($actions & $implementedActions); |
|
98 | 98 | }); |
99 | 99 | return $backend; |
100 | 100 | } |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | $backend->expects($this->any()) |
187 | 187 | ->method('groupExists') |
188 | 188 | ->with('group1') |
189 | - ->willReturnCallback(function () use (&$backendGroupCreated) { |
|
189 | + ->willReturnCallback(function() use (&$backendGroupCreated) { |
|
190 | 190 | return $backendGroupCreated; |
191 | 191 | }); |
192 | 192 | $backend->expects($this->once()) |
193 | 193 | ->method('createGroup') |
194 | - ->willReturnCallback(function () use (&$backendGroupCreated) { |
|
194 | + ->willReturnCallback(function() use (&$backendGroupCreated) { |
|
195 | 195 | $backendGroupCreated = true; |
196 | 196 | return true; |
197 | 197 | }); |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | |
576 | 576 | $backend->expects($this->any()) |
577 | 577 | ->method('inGroup') |
578 | - ->willReturnCallback(function ($uid, $gid) { |
|
578 | + ->willReturnCallback(function($uid, $gid) { |
|
579 | 579 | switch ($uid) { |
580 | 580 | case 'user1': return false; |
581 | 581 | case 'user2': return true; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $this->userManager->expects($this->any()) |
590 | 590 | ->method('searchDisplayName') |
591 | 591 | ->with('user3') |
592 | - ->willReturnCallback(function ($search, $limit, $offset) { |
|
592 | + ->willReturnCallback(function($search, $limit, $offset) { |
|
593 | 593 | switch ($offset) { |
594 | 594 | case 0: return ['user3' => $this->getTestUser('user3'), |
595 | 595 | 'user33' => $this->getTestUser('user33')]; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | }); |
600 | 600 | $this->userManager->expects($this->any()) |
601 | 601 | ->method('get') |
602 | - ->willReturnCallback(function ($uid) { |
|
602 | + ->willReturnCallback(function($uid) { |
|
603 | 603 | switch ($uid) { |
604 | 604 | case 'user1': return $this->getTestUser('user1'); |
605 | 605 | case 'user2': return $this->getTestUser('user2'); |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | |
634 | 634 | $backend->expects($this->any()) |
635 | 635 | ->method('inGroup') |
636 | - ->willReturnCallback(function ($uid, $gid) { |
|
636 | + ->willReturnCallback(function($uid, $gid) { |
|
637 | 637 | switch ($uid) { |
638 | 638 | case 'user1': return false; |
639 | 639 | case 'user2': return true; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | $this->userManager->expects($this->any()) |
649 | 649 | ->method('searchDisplayName') |
650 | 650 | ->with('user3') |
651 | - ->willReturnCallback(function ($search, $limit, $offset) { |
|
651 | + ->willReturnCallback(function($search, $limit, $offset) { |
|
652 | 652 | switch ($offset) { |
653 | 653 | case 0: return ['user3' => $this->getTestUser('user3'), |
654 | 654 | 'user33' => $this->getTestUser('user33')]; |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | }); |
659 | 659 | $this->userManager->expects($this->any()) |
660 | 660 | ->method('get') |
661 | - ->willReturnCallback(function ($uid) { |
|
661 | + ->willReturnCallback(function($uid) { |
|
662 | 662 | switch ($uid) { |
663 | 663 | case 'user1': return $this->getTestUser('user1'); |
664 | 664 | case 'user2': return $this->getTestUser('user2'); |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | |
695 | 695 | $backend->expects($this->any()) |
696 | 696 | ->method('inGroup') |
697 | - ->willReturnCallback(function ($uid) { |
|
697 | + ->willReturnCallback(function($uid) { |
|
698 | 698 | switch ($uid) { |
699 | 699 | case 'user1': return false; |
700 | 700 | case 'user2': return true; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | $this->userManager->expects($this->any()) |
710 | 710 | ->method('searchDisplayName') |
711 | 711 | ->with('user3') |
712 | - ->willReturnCallback(function ($search, $limit, $offset) { |
|
712 | + ->willReturnCallback(function($search, $limit, $offset) { |
|
713 | 713 | switch ($offset) { |
714 | 714 | case 0: |
715 | 715 | return [ |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | }); |
723 | 723 | $this->userManager->expects($this->any()) |
724 | 724 | ->method('get') |
725 | - ->willReturnCallback(function ($uid) { |
|
725 | + ->willReturnCallback(function($uid) { |
|
726 | 726 | switch ($uid) { |
727 | 727 | case 'user1': return $this->getTestUser('user1'); |
728 | 728 | case 'user2': return $this->getTestUser('user2'); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | $backend->expects($this->any()) |
840 | 840 | ->method('getUserGroups') |
841 | 841 | ->with('user1') |
842 | - ->willReturnCallback(function () use (&$expectedGroups) { |
|
842 | + ->willReturnCallback(function() use (&$expectedGroups) { |
|
843 | 843 | return $expectedGroups; |
844 | 844 | }); |
845 | 845 | $backend->expects($this->any()) |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | $backend->expects($this->any()) |
877 | 877 | ->method('getUserGroups') |
878 | 878 | ->with('user1') |
879 | - ->willReturnCallback(function () use (&$expectedGroups) { |
|
879 | + ->willReturnCallback(function() use (&$expectedGroups) { |
|
880 | 880 | return $expectedGroups; |
881 | 881 | }); |
882 | 882 | $backend->expects($this->any()) |
@@ -18,8 +18,8 @@ |
||
18 | 18 | use Test\TestCase; |
19 | 19 | |
20 | 20 | class AppConfigTest extends TestCase { |
21 | - private IConfig|MockObject $config; |
|
22 | - private IAppConfigCore|MockObject $appConfigCore; |
|
21 | + private IConfig | MockObject $config; |
|
22 | + private IAppConfigCore | MockObject $appConfigCore; |
|
23 | 23 | private AppConfig $appConfig; |
24 | 24 | |
25 | 25 | private const TEST_APPID = 'appconfig-test'; |
@@ -50,7 +50,7 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | public function testOutputNotFound(): void { |
53 | - $path = __FILE__ . 'test'; |
|
53 | + $path = __FILE__.'test'; |
|
54 | 54 | $this->output->expects($this->once()) |
55 | 55 | ->method('getHttpResponseCode') |
56 | 56 | ->willReturn(Http::STATUS_OK); |
@@ -489,14 +489,14 @@ discard block |
||
489 | 489 | |
490 | 490 | public function testPutStream(): void { |
491 | 491 | global $data; |
492 | - $data = file_get_contents(__DIR__ . '/../../../data/testimage.png'); |
|
492 | + $data = file_get_contents(__DIR__.'/../../../data/testimage.png'); |
|
493 | 493 | |
494 | 494 | $vars = [ |
495 | 495 | 'put' => $data, |
496 | 496 | 'method' => 'PUT', |
497 | 497 | 'server' => [ |
498 | 498 | 'CONTENT_TYPE' => 'image/png', |
499 | - 'CONTENT_LENGTH' => (string)strlen($data) |
|
499 | + 'CONTENT_LENGTH' => (string) strlen($data) |
|
500 | 500 | ], |
501 | 501 | ]; |
502 | 502 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | public function testGetServerProtocolWithProtoValid(): void { |
804 | 804 | $this->config |
805 | 805 | ->method('getSystemValue') |
806 | - ->willReturnCallback(function ($key, $default) { |
|
806 | + ->willReturnCallback(function($key, $default) { |
|
807 | 807 | if ($key === 'trusted_proxies') { |
808 | 808 | return ['1.2.3.4']; |
809 | 809 | } |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | public function testGetServerProtocolWithHttpsServerValueOn(): void { |
845 | 845 | $this->config |
846 | 846 | ->method('getSystemValue') |
847 | - ->willReturnCallback(function ($key, $default) { |
|
847 | + ->willReturnCallback(function($key, $default) { |
|
848 | 848 | return $default; |
849 | 849 | }); |
850 | 850 | |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | public function testGetServerProtocolWithHttpsServerValueOff(): void { |
866 | 866 | $this->config |
867 | 867 | ->method('getSystemValue') |
868 | - ->willReturnCallback(function ($key, $default) { |
|
868 | + ->willReturnCallback(function($key, $default) { |
|
869 | 869 | return $default; |
870 | 870 | }); |
871 | 871 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | public function testGetServerProtocolWithHttpsServerValueEmpty(): void { |
887 | 887 | $this->config |
888 | 888 | ->method('getSystemValue') |
889 | - ->willReturnCallback(function ($key, $default) { |
|
889 | + ->willReturnCallback(function($key, $default) { |
|
890 | 890 | return $default; |
891 | 891 | }); |
892 | 892 | |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | public function testGetServerProtocolDefault(): void { |
908 | 908 | $this->config |
909 | 909 | ->method('getSystemValue') |
910 | - ->willReturnCallback(function ($key, $default) { |
|
910 | + ->willReturnCallback(function($key, $default) { |
|
911 | 911 | return $default; |
912 | 912 | }); |
913 | 913 | |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | public function testGetServerProtocolBehindLoadBalancers(): void { |
925 | 925 | $this->config |
926 | 926 | ->method('getSystemValue') |
927 | - ->willReturnCallback(function ($key, $default) { |
|
927 | + ->willReturnCallback(function($key, $default) { |
|
928 | 928 | if ($key === 'trusted_proxies') { |
929 | 929 | return ['1.2.3.4']; |
930 | 930 | } |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | public function testInsecureServerHostHttpFromForwardedHeaderSingle(): void { |
1201 | 1201 | $this->config |
1202 | 1202 | ->method('getSystemValue') |
1203 | - ->willReturnCallback(function ($key, $default) { |
|
1203 | + ->willReturnCallback(function($key, $default) { |
|
1204 | 1204 | if ($key === 'trusted_proxies') { |
1205 | 1205 | return ['1.2.3.4']; |
1206 | 1206 | } |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | public function testInsecureServerHostHttpFromForwardedHeaderStacked(): void { |
1230 | 1230 | $this->config |
1231 | 1231 | ->method('getSystemValue') |
1232 | - ->willReturnCallback(function ($key, $default) { |
|
1232 | + ->willReturnCallback(function($key, $default) { |
|
1233 | 1233 | if ($key === 'trusted_proxies') { |
1234 | 1234 | return ['1.2.3.4']; |
1235 | 1235 | } |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | public function testGetServerHostWithOverwriteHost(): void { |
1259 | 1259 | $this->config |
1260 | 1260 | ->method('getSystemValueString') |
1261 | - ->willReturnCallback(function ($key, $default) { |
|
1261 | + ->willReturnCallback(function($key, $default) { |
|
1262 | 1262 | if ($key === 'overwritecondaddr') { |
1263 | 1263 | return ''; |
1264 | 1264 | } elseif ($key === 'overwritehost') { |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | public function testGetServerHostWithTrustedDomain(): void { |
1283 | 1283 | $this->config |
1284 | 1284 | ->method('getSystemValue') |
1285 | - ->willReturnCallback(function ($key, $default) { |
|
1285 | + ->willReturnCallback(function($key, $default) { |
|
1286 | 1286 | if ($key === 'trusted_proxies') { |
1287 | 1287 | return ['1.2.3.4']; |
1288 | 1288 | } elseif ($key === 'trusted_domains') { |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | public function testGetServerHostWithUntrustedDomain(): void { |
1312 | 1312 | $this->config |
1313 | 1313 | ->method('getSystemValue') |
1314 | - ->willReturnCallback(function ($key, $default) { |
|
1314 | + ->willReturnCallback(function($key, $default) { |
|
1315 | 1315 | if ($key === 'trusted_proxies') { |
1316 | 1316 | return ['1.2.3.4']; |
1317 | 1317 | } elseif ($key === 'trusted_domains') { |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | public function testGetServerHostWithNoTrustedDomain(): void { |
1341 | 1341 | $this->config |
1342 | 1342 | ->method('getSystemValue') |
1343 | - ->willReturnCallback(function ($key, $default) { |
|
1343 | + ->willReturnCallback(function($key, $default) { |
|
1344 | 1344 | if ($key === 'trusted_proxies') { |
1345 | 1345 | return ['1.2.3.4']; |
1346 | 1346 | } |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | public function testGetServerHostTrustedDomain(string $expected, $trustedDomain): void { |
1379 | 1379 | $this->config |
1380 | 1380 | ->method('getSystemValue') |
1381 | - ->willReturnCallback(function ($key, $default) use ($trustedDomain) { |
|
1381 | + ->willReturnCallback(function($key, $default) use ($trustedDomain) { |
|
1382 | 1382 | if ($key === 'trusted_proxies') { |
1383 | 1383 | return ['1.2.3.4']; |
1384 | 1384 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function stream_write(string $data): int { |
33 | 33 | $left = substr($GLOBALS[$this->varname], 0, $this->position); |
34 | 34 | $right = substr($GLOBALS[$this->varname], $this->position + strlen($data)); |
35 | - $GLOBALS[$this->varname] = $left . $data . $right; |
|
35 | + $GLOBALS[$this->varname] = $left.$data.$right; |
|
36 | 36 | $this->position += strlen($data); |
37 | 37 | return strlen($data); |
38 | 38 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return array |
45 | 45 | */ |
46 | 46 | public function exec($int, $bool, $foo, $test = 4, $test2 = 1) { |
47 | - $this->registerResponder('text', function ($in) { |
|
47 | + $this->registerResponder('text', function($in) { |
|
48 | 48 | return new JSONResponse(['text' => $in]); |
49 | 49 | }); |
50 | 50 | return [$int, $bool, $test, $test2]; |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | ->method('beforeController'); |
290 | 290 | $this->middlewareDispatcher->expects($this->once()) |
291 | 291 | ->method('afterController') |
292 | - ->willReturnCallback(function ($a, $b, $in) { |
|
292 | + ->willReturnCallback(function($a, $b, $in) { |
|
293 | 293 | return $in; |
294 | 294 | }); |
295 | 295 | $this->middlewareDispatcher->expects($this->once()) |
296 | 296 | ->method('beforeOutput') |
297 | - ->willReturnCallback(function ($a, $b, $in) { |
|
297 | + ->willReturnCallback(function($a, $b, $in) { |
|
298 | 298 | return $in; |
299 | 299 | }); |
300 | 300 | } |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | public function testInjectFromServer(): void { |
52 | - $this->server->registerService(Interface1::class, function () { |
|
52 | + $this->server->registerService(Interface1::class, function() { |
|
53 | 53 | return new ClassA1(); |
54 | 54 | }); |
55 | 55 | |
56 | - $this->server->registerService(ClassB::class, function (SimpleContainer $c) { |
|
56 | + $this->server->registerService(ClassB::class, function(SimpleContainer $c) { |
|
57 | 57 | return new ClassB( |
58 | 58 | $c->query(Interface1::class) |
59 | 59 | ); |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | public function testInjectDepFromServer(): void { |
68 | - $this->server->registerService(Interface1::class, function () { |
|
68 | + $this->server->registerService(Interface1::class, function() { |
|
69 | 69 | return new ClassA1(); |
70 | 70 | }); |
71 | 71 | |
72 | - $this->container->registerService(ClassB::class, function (SimpleContainer $c) { |
|
72 | + $this->container->registerService(ClassB::class, function(SimpleContainer $c) { |
|
73 | 73 | return new ClassB( |
74 | 74 | $c->query(Interface1::class) |
75 | 75 | ); |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | public function testOverwriteDepFromServer(): void { |
84 | - $this->server->registerService(Interface1::class, function () { |
|
84 | + $this->server->registerService(Interface1::class, function() { |
|
85 | 85 | return new ClassA1(); |
86 | 86 | }); |
87 | 87 | |
88 | - $this->container->registerService(Interface1::class, function () { |
|
88 | + $this->container->registerService(Interface1::class, function() { |
|
89 | 89 | return new ClassA2(); |
90 | 90 | }); |
91 | 91 | |
92 | - $this->container->registerService(ClassB::class, function (SimpleContainer $c) { |
|
92 | + $this->container->registerService(ClassB::class, function(SimpleContainer $c) { |
|
93 | 93 | return new ClassB( |
94 | 94 | $c->query(Interface1::class) |
95 | 95 | ); |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | public function testIgnoreOverwriteInServerClass(): void { |
104 | - $this->server->registerService(Interface1::class, function () { |
|
104 | + $this->server->registerService(Interface1::class, function() { |
|
105 | 105 | return new ClassA1(); |
106 | 106 | }); |
107 | 107 | |
108 | - $this->container->registerService(Interface1::class, function () { |
|
108 | + $this->container->registerService(Interface1::class, function() { |
|
109 | 109 | return new ClassA2(); |
110 | 110 | }); |
111 | 111 | |
112 | - $this->server->registerService(ClassB::class, function (SimpleContainer $c) { |
|
112 | + $this->server->registerService(ClassB::class, function(SimpleContainer $c) { |
|
113 | 113 | return new ClassB( |
114 | 114 | $c->query(Interface1::class) |
115 | 115 | ); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | $hashSet = false; |
114 | 114 | $this->session |
115 | 115 | ->method('set') |
116 | - ->willReturnCallback(function ($key, $value) use (&$tokenSet, &$hashSet) { |
|
116 | + ->willReturnCallback(function($key, $value) use (&$tokenSet, &$hashSet) { |
|
117 | 117 | if ($key === 'public_link_authenticated_token' && $value === 'token') { |
118 | 118 | $tokenSet = true; |
119 | 119 | return true; |