@@ -33,7 +33,8 @@ |
||
33 | 33 | $request |
34 | 34 | ->expects($this->exactly(2)) |
35 | 35 | ->method('withAttribute') |
36 | - ->willReturnCallback(function (string $key, string $value) use ($matcher, $tokenStorage) { |
|
36 | + ->willReturnCallback(function (string $key, string $value) use ($matcher, $tokenStorage) |
|
37 | + { |
|
37 | 38 | match ($matcher->numberOfInvocations()) { |
38 | 39 | 1 => $this->assertInstanceOf(AuthContextInterface::class, $value), |
39 | 40 | 2 => $this->assertSame($tokenStorage, $value), |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | $http->setHandler( |
28 | 28 | static function (ServerRequestInterface $request): void { |
29 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
29 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
30 | 30 | echo 'no token'; |
31 | - } else { |
|
31 | + }else{ |
|
32 | 32 | echo $request->getAttribute('authContext')->getToken()->getID(); |
33 | 33 | echo ':'; |
34 | 34 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | $http->setHandler( |
52 | 52 | static function (ServerRequestInterface $request): void { |
53 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
53 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
54 | 54 | echo 'no token'; |
55 | - } else { |
|
55 | + }else{ |
|
56 | 56 | echo $request->getAttribute('authContext')->getToken()->getID(); |
57 | 57 | echo ':'; |
58 | 58 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | |
74 | 74 | $http->setHandler( |
75 | 75 | static function (ServerRequestInterface $request): void { |
76 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
76 | + if ($request->getAttribute('authContext')->getToken() === null){ |
|
77 | 77 | echo 'no token'; |
78 | - } else { |
|
78 | + }else{ |
|
79 | 79 | echo $request->getAttribute('authContext')->getToken()->getID(); |
80 | 80 | echo ':'; |
81 | 81 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | ); |
104 | 104 | $response = $http->handle( |
105 | - new ServerRequest('GET', '',['X-Auth-Token' => 'bad'], 'php://input') |
|
105 | + new ServerRequest('GET', '', ['X-Auth-Token' => 'bad'], 'php://input') |
|
106 | 106 | ); |
107 | 107 | |
108 | 108 | self::assertEmpty($response->getHeader('X-Auth-Token')); |
@@ -26,9 +26,12 @@ discard block |
||
26 | 26 | |
27 | 27 | $http->setHandler( |
28 | 28 | static function (ServerRequestInterface $request): void { |
29 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
29 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
30 | + { |
|
30 | 31 | echo 'no token'; |
31 | - } else { |
|
32 | + } |
|
33 | + else |
|
34 | + { |
|
32 | 35 | echo $request->getAttribute('authContext')->getToken()->getID(); |
33 | 36 | echo ':'; |
34 | 37 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -50,9 +53,12 @@ discard block |
||
50 | 53 | |
51 | 54 | $http->setHandler( |
52 | 55 | static function (ServerRequestInterface $request): void { |
53 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
56 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
57 | + { |
|
54 | 58 | echo 'no token'; |
55 | - } else { |
|
59 | + } |
|
60 | + else |
|
61 | + { |
|
56 | 62 | echo $request->getAttribute('authContext')->getToken()->getID(); |
57 | 63 | echo ':'; |
58 | 64 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -73,9 +79,12 @@ discard block |
||
73 | 79 | |
74 | 80 | $http->setHandler( |
75 | 81 | static function (ServerRequestInterface $request): void { |
76 | - if ($request->getAttribute('authContext')->getToken() === null) { |
|
82 | + if ($request->getAttribute('authContext')->getToken() === null) |
|
83 | + { |
|
77 | 84 | echo 'no token'; |
78 | - } else { |
|
85 | + } |
|
86 | + else |
|
87 | + { |
|
79 | 88 | echo $request->getAttribute('authContext')->getToken()->getID(); |
80 | 89 | echo ':'; |
81 | 90 | echo json_encode($request->getAttribute('authContext')->getToken()->getPayload()); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | private readonly TokenStorageInterface $tokenStorage, |
34 | 34 | private readonly TransportRegistry $transportRegistry, |
35 | 35 | private readonly ?EventDispatcherInterface $eventDispatcher = null, |
36 | - ) { |
|
36 | + ){ |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | |
55 | 55 | private function initContext(Request $request, AuthContextInterface $authContext): AuthContextInterface |
56 | 56 | { |
57 | - foreach ($this->transportRegistry->getTransports() as $name => $transport) { |
|
57 | + foreach ($this->transportRegistry->getTransports() as $name => $transport){ |
|
58 | 58 | $tokenID = $transport->fetchToken($request); |
59 | - if ($tokenID === null) { |
|
59 | + if ($tokenID === null){ |
|
60 | 60 | continue; |
61 | 61 | } |
62 | 62 | |
63 | 63 | $token = $this->tokenStorage->load($tokenID); |
64 | - if ($token === null) { |
|
64 | + if ($token === null){ |
|
65 | 65 | continue; |
66 | 66 | } |
67 | 67 | |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | |
76 | 76 | private function closeContext(Request $request, Response $response, AuthContextInterface $authContext): Response |
77 | 77 | { |
78 | - if ($authContext->getToken() === null) { |
|
78 | + if ($authContext->getToken() === null){ |
|
79 | 79 | return $response; |
80 | 80 | } |
81 | 81 | |
82 | 82 | $transport = $this->transportRegistry->getTransport($authContext->getTransport()); |
83 | 83 | |
84 | - if ($authContext->isClosed()) { |
|
84 | + if ($authContext->isClosed()){ |
|
85 | 85 | $this->tokenStorage->delete($authContext->getToken()); |
86 | 86 | |
87 | 87 | return $transport->removeToken( |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function testCookieQueueInRequestAttribute(): void |
53 | 53 | { |
54 | 54 | $core = $this->httpCore([CookiesMiddleware::class]); |
55 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
55 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
56 | 56 | $this->assertInstanceOf(CookieQueue::class, $r->getAttribute(CookieQueue::ATTRIBUTE)); |
57 | 57 | return 'all good'; |
58 | 58 | }); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function testSetEncryptedCookie(): void |
66 | 66 | { |
67 | 67 | $core = $this->httpCore([CookiesMiddleware::class]); |
68 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
68 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
69 | 69 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
70 | 70 | |
71 | 71 | return 'all good'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | public function testSetNotProtectedCookie(): void |
87 | 87 | { |
88 | 88 | $core = $this->httpCore([CookiesMiddleware::class]); |
89 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
89 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
90 | 90 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('PHPSESSID', 'value'); |
91 | 91 | |
92 | 92 | return 'all good'; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function testDecrypt(): void |
105 | 105 | { |
106 | 106 | $core = $this->httpCore([CookiesMiddleware::class]); |
107 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
107 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
108 | 108 | return $r->getCookieParams()['name']; |
109 | 109 | }); |
110 | 110 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function testDecryptArray(): void |
119 | 119 | { |
120 | 120 | $core = $this->httpCore([CookiesMiddleware::class]); |
121 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
121 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
122 | 122 | return $r->getCookieParams()['name'][0]; |
123 | 123 | }); |
124 | 124 | |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | public function testDecryptBroken(): void |
133 | 133 | { |
134 | 134 | $core = $this->httpCore([CookiesMiddleware::class]); |
135 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
135 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
136 | 136 | return $r->getCookieParams()['name']; |
137 | 137 | }); |
138 | 138 | |
139 | - $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value') . 'BROKEN'; |
|
139 | + $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value').'BROKEN'; |
|
140 | 140 | |
141 | 141 | $response = $this->get($core, '/', [], [], ['name' => $value]); |
142 | 142 | $this->assertSame(200, $response->getStatusCode()); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | public function testDelete(): void |
147 | 147 | { |
148 | 148 | $core = $this->httpCore([CookiesMiddleware::class]); |
149 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
149 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
150 | 150 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
151 | 151 | $r->getAttribute(CookieQueue::ATTRIBUTE)->delete('name'); |
152 | 152 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | ])); |
172 | 172 | |
173 | 173 | $core = $this->httpCore([CookiesMiddleware::class]); |
174 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
174 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
175 | 175 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
176 | 176 | |
177 | 177 | return 'all good'; |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ])); |
196 | 196 | |
197 | 197 | $core = $this->httpCore([CookiesMiddleware::class]); |
198 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
198 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
199 | 199 | return $r->getCookieParams()['name']; |
200 | 200 | }); |
201 | 201 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ])); |
216 | 216 | |
217 | 217 | $core = $this->httpCore([CookiesMiddleware::class]); |
218 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
218 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
219 | 219 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
220 | 220 | |
221 | 221 | return 'all good'; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $cookies = $this->fetchCookies($response); |
229 | 229 | $this->assertArrayHasKey('name', $cookies); |
230 | 230 | |
231 | - $core->setHandler(function ($r) { |
|
231 | + $core->setHandler(function ($r){ |
|
232 | 232 | return $r->getCookieParams()['name']; |
233 | 233 | }); |
234 | 234 | |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | { |
284 | 284 | $result = []; |
285 | 285 | |
286 | - foreach ($response->getHeaders() as $line) { |
|
286 | + foreach ($response->getHeaders() as $line){ |
|
287 | 287 | $cookie = explode('=', implode('', $line)); |
288 | 288 | $result[$cookie[0]] = rawurldecode(substr( |
289 | 289 | (string)$cookie[1], |
@@ -52,7 +52,8 @@ discard block |
||
52 | 52 | public function testCookieQueueInRequestAttribute(): void |
53 | 53 | { |
54 | 54 | $core = $this->httpCore([CookiesMiddleware::class]); |
55 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
55 | + $core->setHandler(function (ServerRequestInterface $r) |
|
56 | + { |
|
56 | 57 | $this->assertInstanceOf(CookieQueue::class, $r->getAttribute(CookieQueue::ATTRIBUTE)); |
57 | 58 | return 'all good'; |
58 | 59 | }); |
@@ -65,7 +66,8 @@ discard block |
||
65 | 66 | public function testSetEncryptedCookie(): void |
66 | 67 | { |
67 | 68 | $core = $this->httpCore([CookiesMiddleware::class]); |
68 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
69 | + $core->setHandler(function (ServerRequestInterface $r) |
|
70 | + { |
|
69 | 71 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
70 | 72 | |
71 | 73 | return 'all good'; |
@@ -86,7 +88,8 @@ discard block |
||
86 | 88 | public function testSetNotProtectedCookie(): void |
87 | 89 | { |
88 | 90 | $core = $this->httpCore([CookiesMiddleware::class]); |
89 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
91 | + $core->setHandler(function (ServerRequestInterface $r) |
|
92 | + { |
|
90 | 93 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('PHPSESSID', 'value'); |
91 | 94 | |
92 | 95 | return 'all good'; |
@@ -104,7 +107,8 @@ discard block |
||
104 | 107 | public function testDecrypt(): void |
105 | 108 | { |
106 | 109 | $core = $this->httpCore([CookiesMiddleware::class]); |
107 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
110 | + $core->setHandler(function (ServerRequestInterface $r) |
|
111 | + { |
|
108 | 112 | return $r->getCookieParams()['name']; |
109 | 113 | }); |
110 | 114 | |
@@ -118,7 +122,8 @@ discard block |
||
118 | 122 | public function testDecryptArray(): void |
119 | 123 | { |
120 | 124 | $core = $this->httpCore([CookiesMiddleware::class]); |
121 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
125 | + $core->setHandler(function (ServerRequestInterface $r) |
|
126 | + { |
|
122 | 127 | return $r->getCookieParams()['name'][0]; |
123 | 128 | }); |
124 | 129 | |
@@ -132,7 +137,8 @@ discard block |
||
132 | 137 | public function testDecryptBroken(): void |
133 | 138 | { |
134 | 139 | $core = $this->httpCore([CookiesMiddleware::class]); |
135 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
140 | + $core->setHandler(function (ServerRequestInterface $r) |
|
141 | + { |
|
136 | 142 | return $r->getCookieParams()['name']; |
137 | 143 | }); |
138 | 144 | |
@@ -146,7 +152,8 @@ discard block |
||
146 | 152 | public function testDelete(): void |
147 | 153 | { |
148 | 154 | $core = $this->httpCore([CookiesMiddleware::class]); |
149 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
155 | + $core->setHandler(function (ServerRequestInterface $r) |
|
156 | + { |
|
150 | 157 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
151 | 158 | $r->getAttribute(CookieQueue::ATTRIBUTE)->delete('name'); |
152 | 159 | |
@@ -171,7 +178,8 @@ discard block |
||
171 | 178 | ])); |
172 | 179 | |
173 | 180 | $core = $this->httpCore([CookiesMiddleware::class]); |
174 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
181 | + $core->setHandler(function (ServerRequestInterface $r) |
|
182 | + { |
|
175 | 183 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
176 | 184 | |
177 | 185 | return 'all good'; |
@@ -195,7 +203,8 @@ discard block |
||
195 | 203 | ])); |
196 | 204 | |
197 | 205 | $core = $this->httpCore([CookiesMiddleware::class]); |
198 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
206 | + $core->setHandler(function (ServerRequestInterface $r) |
|
207 | + { |
|
199 | 208 | return $r->getCookieParams()['name']; |
200 | 209 | }); |
201 | 210 | |
@@ -215,7 +224,8 @@ discard block |
||
215 | 224 | ])); |
216 | 225 | |
217 | 226 | $core = $this->httpCore([CookiesMiddleware::class]); |
218 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
227 | + $core->setHandler(function (ServerRequestInterface $r) |
|
228 | + { |
|
219 | 229 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
220 | 230 | |
221 | 231 | return 'all good'; |
@@ -228,7 +238,8 @@ discard block |
||
228 | 238 | $cookies = $this->fetchCookies($response); |
229 | 239 | $this->assertArrayHasKey('name', $cookies); |
230 | 240 | |
231 | - $core->setHandler(function ($r) { |
|
241 | + $core->setHandler(function ($r) |
|
242 | + { |
|
232 | 243 | return $r->getCookieParams()['name']; |
233 | 244 | }); |
234 | 245 | |
@@ -283,7 +294,8 @@ discard block |
||
283 | 294 | { |
284 | 295 | $result = []; |
285 | 296 | |
286 | - foreach ($response->getHeaders() as $line) { |
|
297 | + foreach ($response->getHeaders() as $line) |
|
298 | + { |
|
287 | 299 | $cookie = explode('=', implode('', $line)); |
288 | 300 | $result[$cookie[0]] = rawurldecode(substr( |
289 | 301 | (string)$cookie[1], |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | self::expectExceptionMessageMatches('/Call to undefined method/i'); |
55 | 55 | |
56 | - $root->invoke(static function (#[Proxy] EmptyInterface $proxy) { |
|
56 | + $root->invoke(static function (#[Proxy] EmptyInterface $proxy){ |
|
57 | 57 | $proxy->bar(name: 'foo'); // Possible to run |
58 | 58 | }); |
59 | 59 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $proxy = $$var; |
94 | 94 | self::assertSame(['foo', 'bar', 'baz', 69], $proxy->extraVariadic('foo', 'bar', 'baz', 69)); |
95 | 95 | self::assertSame( |
96 | - ['foo' => 'foo','zap' => 'bar', 'gas' => 69], |
|
96 | + ['foo' => 'foo', 'zap' => 'bar', 'gas' => 69], |
|
97 | 97 | $proxy->extraVariadic(foo: 'foo', zap: 'bar', gas: 69), |
98 | 98 | ); |
99 | 99 | }); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $root->bindSingleton(MockInterface::class, Stub\MockInterfaceImpl::class); |
179 | 179 | $root->bindSingleton(EmptyInterface::class, Stub\MockInterfaceImpl::class); |
180 | 180 | |
181 | - $mock = $root->invoke(static fn(#[Proxy] MockInterface|EmptyInterface $mock) => $mock); |
|
181 | + $mock = $root->invoke(static fn(#[Proxy] MockInterface | EmptyInterface $mock) => $mock); |
|
182 | 182 | |
183 | 183 | self::assertInstanceOf(MockInterfaceImpl::class, $mock); |
184 | 184 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | \set_error_handler(static function (int $errno, string $error) use ($interface): void { |
233 | 233 | self::assertSame( |
234 | - \sprintf('Using `%s` outside of the `foo` scope is deprecated and will be ' . |
|
234 | + \sprintf('Using `%s` outside of the `foo` scope is deprecated and will be '. |
|
235 | 235 | 'impossible in version 4.0.', $interface), |
236 | 236 | $error |
237 | 237 | ); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | { |
289 | 289 | \set_error_handler(static function (int $errno, string $error) use ($interface): void { |
290 | 290 | self::assertSame( |
291 | - \sprintf('Using `%s` outside of the `a` scope is deprecated and will be ' . |
|
291 | + \sprintf('Using `%s` outside of the `a` scope is deprecated and will be '. |
|
292 | 292 | 'impossible in version 4.0.', $interface), |
293 | 293 | $error |
294 | 294 | ); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | public function testDeprecationProxyConfigDontThrowIfNotConstructed(string $interface): void |
317 | 317 | { |
318 | 318 | \set_error_handler(static function (int $errno, string $error) use ($interface): void { |
319 | - self::fail('Unexpected error: ' . $error); |
|
319 | + self::fail('Unexpected error: '.$error); |
|
320 | 320 | }); |
321 | 321 | |
322 | 322 | $root = new Container(); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | #[DataProvider('invalidDeprecationProxyArgsDataProvider')] |
339 | - public function testDeprecationProxyConfigArgsRequiredException(string|null $scope, string|null $version): void |
|
339 | + public function testDeprecationProxyConfigArgsRequiredException(string | null $scope, string | null $version): void |
|
340 | 340 | { |
341 | 341 | self::expectException(\InvalidArgumentException::class); |
342 | 342 | self::expectExceptionMessage('Scope and version or custom message must be provided.'); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | { |
349 | 349 | $proxy = new Config\Proxy(EmptyInterface::class); |
350 | 350 | |
351 | - $this->assertSame(\sprintf('Proxy to `%s`', EmptyInterface::class), (string) $proxy); |
|
351 | + $this->assertSame(\sprintf('Proxy to `%s`', EmptyInterface::class), (string)$proxy); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | public function testProxyConfigNotInterfaceException(): void |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | $root->invoke(static function ( |
37 | 37 | #[Proxy] MockInterface $mock, |
38 | 38 | #[Proxy(/*proxyOverloads: true*/)] EmptyInterface $empty, |
39 | - ) use ($var) { |
|
39 | + ) use ($var) |
|
40 | + { |
|
40 | 41 | /** @var MockInterfaceImpl $proxy */ |
41 | 42 | $proxy = $$var; |
42 | 43 | $proxy->bar(name: 'foo'); // Possible to run |
@@ -53,7 +54,8 @@ discard block |
||
53 | 54 | |
54 | 55 | self::expectExceptionMessageMatches('/Call to undefined method/i'); |
55 | 56 | |
56 | - $root->invoke(static function (#[Proxy] EmptyInterface $proxy) { |
|
57 | + $root->invoke(static function (#[Proxy] EmptyInterface $proxy) |
|
58 | + { |
|
57 | 59 | $proxy->bar(name: 'foo'); // Possible to run |
58 | 60 | }); |
59 | 61 | } |
@@ -68,7 +70,8 @@ discard block |
||
68 | 70 | $root->invoke(static function ( |
69 | 71 | #[Proxy] MockInterface $mock, |
70 | 72 | #[Proxy(/*proxyOverloads: true*/)] EmptyInterface $empty, |
71 | - ) use ($var) { |
|
73 | + ) use ($var) |
|
74 | + { |
|
72 | 75 | /** @var MockInterfaceImpl $proxy */ |
73 | 76 | $proxy = $$var; |
74 | 77 | self::assertSame(['foo', 'bar', 'baz', 69], $proxy->extra('foo', 'bar', 'baz', 69)); |
@@ -88,7 +91,8 @@ discard block |
||
88 | 91 | $root->invoke(static function ( |
89 | 92 | #[Proxy] MockInterface $mock, |
90 | 93 | #[Proxy(/*proxyOverloads: true*/)] EmptyInterface $empty, |
91 | - ) use ($var) { |
|
94 | + ) use ($var) |
|
95 | + { |
|
92 | 96 | /** @var MockInterfaceImpl $proxy */ |
93 | 97 | $proxy = $$var; |
94 | 98 | self::assertSame(['foo', 'bar', 'baz', 69], $proxy->extraVariadic('foo', 'bar', 'baz', 69)); |
@@ -110,7 +114,8 @@ discard block |
||
110 | 114 | $root->bindSingleton(MockInterface::class, Stub\MockInterfaceImpl::class); |
111 | 115 | $root->bindSingleton(EmptyInterface::class, Stub\MockInterfaceImpl::class); |
112 | 116 | |
113 | - $root->invoke(static function (#[Proxy] MockInterface $mock, #[Proxy] EmptyInterface $empty) use ($var) { |
|
117 | + $root->invoke(static function (#[Proxy] MockInterface $mock, #[Proxy] EmptyInterface $empty) use ($var) |
|
118 | + { |
|
114 | 119 | /** @var MockInterfaceImpl $proxy */ |
115 | 120 | $proxy = $$var; |
116 | 121 | $str = 'bar'; |
@@ -130,7 +135,8 @@ discard block |
||
130 | 135 | $root->bindSingleton(MockInterface::class, Stub\MockInterfaceImpl::class); |
131 | 136 | $root->bindSingleton(EmptyInterface::class, Stub\MockInterfaceImpl::class); |
132 | 137 | |
133 | - $root->invoke(static function (#[Proxy] MockInterface $mock, #[Proxy] EmptyInterface $empty) use ($var) { |
|
138 | + $root->invoke(static function (#[Proxy] MockInterface $mock, #[Proxy] EmptyInterface $empty) use ($var) |
|
139 | + { |
|
134 | 140 | /** @var MockInterfaceImpl $proxy */ |
135 | 141 | $proxy = $$var; |
136 | 142 | |
@@ -153,7 +159,8 @@ discard block |
||
153 | 159 | $root->bindSingleton(MockInterface::class, Stub\MockInterfaceImpl::class); |
154 | 160 | $root->bindSingleton(EmptyInterface::class, Stub\MockInterfaceImpl::class); |
155 | 161 | |
156 | - $root->invoke(static function (#[Proxy] MockInterface $mock, #[Proxy] EmptyInterface $empty) use ($var) { |
|
162 | + $root->invoke(static function (#[Proxy] MockInterface $mock, #[Proxy] EmptyInterface $empty) use ($var) |
|
163 | + { |
|
157 | 164 | /** @var MockInterfaceImpl $proxy */ |
158 | 165 | $proxy = $$var; |
159 | 166 | $str1 = 'bar'; |
@@ -194,7 +201,8 @@ discard block |
||
194 | 201 | $this->assertInstanceOf($interface, $proxy); |
195 | 202 | $this->assertNotInstanceOf(MockInterfaceImpl::class, $proxy); |
196 | 203 | |
197 | - $root->runScope(new Scope('foo'), static function (Container $container) use ($interface, $proxy) { |
|
204 | + $root->runScope(new Scope('foo'), static function (Container $container) use ($interface, $proxy) |
|
205 | + { |
|
198 | 206 | $proxy->bar(name: 'foo'); // Possible to run |
199 | 207 | self::assertSame('foo', $proxy->baz('foo', 42)); |
200 | 208 | self::assertSame(123, $proxy->qux(age: 123)); |
@@ -244,7 +252,8 @@ discard block |
||
244 | 252 | $proxy = $root->get($interface); |
245 | 253 | $this->assertInstanceOf($interface, $proxy); |
246 | 254 | |
247 | - $root->runScope(new Scope('foo'), static function () use ($proxy) { |
|
255 | + $root->runScope(new Scope('foo'), static function () use ($proxy) |
|
256 | + { |
|
248 | 257 | $proxy->bar(name: 'foo'); // Possible to run |
249 | 258 | self::assertSame('foo', $proxy->baz('foo', 42)); |
250 | 259 | self::assertSame(123, $proxy->qux(age: 123)); |
@@ -272,7 +281,8 @@ discard block |
||
272 | 281 | $proxy = $root->get($interface); |
273 | 282 | $this->assertInstanceOf($interface, $proxy); |
274 | 283 | |
275 | - $root->runScope(new Scope('foo'), static function () use ($proxy) { |
|
284 | + $root->runScope(new Scope('foo'), static function () use ($proxy) |
|
285 | + { |
|
276 | 286 | $proxy->bar(name: 'foo'); // Possible to run |
277 | 287 | self::assertSame('foo', $proxy->baz('foo', 42)); |
278 | 288 | self::assertSame(123, $proxy->qux(age: 123)); |
@@ -301,7 +311,8 @@ discard block |
||
301 | 311 | $proxy = $root->get($interface); |
302 | 312 | $this->assertInstanceOf($interface, $proxy); |
303 | 313 | |
304 | - $root->runScope(new Scope('foo'), static function () use ($proxy) { |
|
314 | + $root->runScope(new Scope('foo'), static function () use ($proxy) |
|
315 | + { |
|
305 | 316 | $proxy->bar(name: 'foo'); // Possible to run |
306 | 317 | self::assertSame('foo', $proxy->baz('foo', 42)); |
307 | 318 | self::assertSame(123, $proxy->qux(age: 123)); |
@@ -323,7 +334,8 @@ discard block |
||
323 | 334 | $root->getBinder('foo')->bindSingleton($interface, Stub\MockInterfaceImpl::class); |
324 | 335 | $root->bindSingleton($interface, new Config\DeprecationProxy($interface, true, 'foo', '4.0')); |
325 | 336 | |
326 | - $root->runScope(new Scope('foo'), static function (Container $container) use ($interface) { |
|
337 | + $root->runScope(new Scope('foo'), static function (Container $container) use ($interface) |
|
338 | + { |
|
327 | 339 | $proxy = $container->get($interface); |
328 | 340 | |
329 | 341 | $proxy->bar(name: 'foo'); // Possible to run |
@@ -16,9 +16,9 @@ |
||
16 | 16 | protected string $scope; |
17 | 17 | public function __construct( |
18 | 18 | protected readonly string $id, |
19 | - Container|string|null $scopeOrContainer = null, |
|
19 | + Container | string | null $scopeOrContainer = null, |
|
20 | 20 | protected readonly ?string $requiredScope = null, |
21 | - ) { |
|
21 | + ){ |
|
22 | 22 | $this->scope = \is_string($scopeOrContainer) |
23 | 23 | ? $scopeOrContainer |
24 | 24 | : Introspector::scopeName($scopeOrContainer); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function defineDirectories(string $root): array |
30 | 30 | { |
31 | - return \array_merge(parent::defineDirectories($root), ['app' => $root . '/App']); |
|
31 | + return \array_merge(parent::defineDirectories($root), ['app' => $root.'/App']); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | protected function tearDown(): void |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | public function __construct( |
17 | 17 | private readonly InvokerInterface $invoker, |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function execute(InputInterface $input, OutputInterface $output): int |
86 | 86 | { |
87 | - if ($this->container === null) { |
|
87 | + if ($this->container === null){ |
|
88 | 88 | throw new ScopeException('Container is not set'); |
89 | 89 | } |
90 | 90 | |
91 | 91 | $method = method_exists($this, 'perform') ? 'perform' : '__invoke'; |
92 | 92 | |
93 | - try { |
|
93 | + try{ |
|
94 | 94 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
95 | 95 | |
96 | 96 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
124 | 124 | |
125 | 125 | return $code; |
126 | - } finally { |
|
126 | + }finally{ |
|
127 | 127 | [$this->input, $this->output] = [null, null]; |
128 | 128 | } |
129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | /** |
132 | 132 | * @deprecated This method will be removed in v4.0. |
133 | 133 | */ |
134 | - protected function buildCore(): CoreInterface|HandlerInterface |
|
134 | + protected function buildCore(): CoreInterface | HandlerInterface |
|
135 | 135 | { |
136 | 136 | return ContainerScope::getContainer() |
137 | 137 | ->get(CommandCoreFactory::class) |
@@ -84,13 +84,15 @@ discard block |
||
84 | 84 | */ |
85 | 85 | protected function execute(InputInterface $input, OutputInterface $output): int |
86 | 86 | { |
87 | - if ($this->container === null) { |
|
87 | + if ($this->container === null) |
|
88 | + { |
|
88 | 89 | throw new ScopeException('Container is not set'); |
89 | 90 | } |
90 | 91 | |
91 | 92 | $method = method_exists($this, 'perform') ? 'perform' : '__invoke'; |
92 | 93 | |
93 | - try { |
|
94 | + try |
|
95 | + { |
|
94 | 96 | [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)]; |
95 | 97 | |
96 | 98 | $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output)); |
@@ -107,7 +109,8 @@ discard block |
||
107 | 109 | ], |
108 | 110 | autowire: false, |
109 | 111 | ), |
110 | - function () use ($method) { |
|
112 | + function () use ($method) |
|
113 | + { |
|
111 | 114 | $core = $this->buildCore(); |
112 | 115 | $arguments = ['input' => $this->input, 'output' => $this->output, 'command' => $this]; |
113 | 116 | |
@@ -123,7 +126,9 @@ discard block |
||
123 | 126 | $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output)); |
124 | 127 | |
125 | 128 | return $code; |
126 | - } finally { |
|
129 | + } |
|
130 | + finally |
|
131 | + { |
|
127 | 132 | [$this->input, $this->output] = [null, null]; |
128 | 133 | } |
129 | 134 | } |