@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | $this->assertContains(TestTrait::class, $reflection->getTraits()); |
17 | 17 | $this->assertContains(TestInterface::class, $reflection->getInterfaces()); |
18 | 18 | |
19 | - $this->assertSame([__NAMESPACE__ . '\hello'], $reflection->getFunctions()); |
|
19 | + $this->assertSame([__NAMESPACE__.'\hello'], $reflection->getFunctions()); |
|
20 | 20 | |
21 | 21 | $functionA = null; |
22 | 22 | $functionB = null; |
23 | 23 | |
24 | - foreach ($reflection->getInvocations() as $invocation) { |
|
25 | - if ($invocation->getName() == 'test_function_a') { |
|
24 | + foreach ($reflection->getInvocations() as $invocation){ |
|
25 | + if ($invocation->getName() == 'test_function_a'){ |
|
26 | 26 | $functionA = $invocation; |
27 | 27 | } |
28 | 28 | |
29 | - if ($invocation->getName() == 'test_function_b') { |
|
29 | + if ($invocation->getName() == 'test_function_b'){ |
|
30 | 30 | $functionB = $invocation; |
31 | 31 | } |
32 | 32 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function testReflectionFileWithNamedParameters(): void |
55 | 55 | { |
56 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassWithNamedParameter.php'); |
|
56 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassWithNamedParameter.php'); |
|
57 | 57 | |
58 | 58 | $this->assertSame([ |
59 | 59 | \Spiral\Tests\Tokenizer\Classes\ClassWithNamedParameter::class, |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | public function testReflectionFileAnonymousClass(): void |
64 | 64 | { |
65 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassWithAnonymousClass.php'); |
|
65 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassWithAnonymousClass.php'); |
|
66 | 66 | |
67 | 67 | $this->assertSame([ |
68 | 68 | \Spiral\Tests\Tokenizer\Classes\ClassWithAnonymousClass::class, |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function testReflectionFileWithHeredoc(): void |
73 | 73 | { |
74 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassWithHeredoc.php'); |
|
74 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassWithHeredoc.php'); |
|
75 | 75 | |
76 | 76 | $this->assertSame([ |
77 | 77 | 'Spiral\Tests\Tokenizer\Classes\ClassWithHeredoc', |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function testReflectionEnum(): void |
82 | 82 | { |
83 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassD.php'); |
|
83 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassD.php'); |
|
84 | 84 | |
85 | 85 | $this->assertSame([ |
86 | 86 | \Spiral\Tests\Tokenizer\Classes\ClassD::class, |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function testReflectionTypedEnum(): void |
91 | 91 | { |
92 | - $reflection = new ReflectionFile(__DIR__ . '/Classes/ClassE.php'); |
|
92 | + $reflection = new ReflectionFile(__DIR__.'/Classes/ClassE.php'); |
|
93 | 93 | |
94 | 94 | $this->assertSame([ |
95 | 95 | \Spiral\Tests\Tokenizer\Classes\ClassE::class, |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | public function testReflectionInterface(): void |
100 | 100 | { |
101 | - $reflection = new ReflectionFile(__DIR__ . '/Interfaces/InterfaceA.php'); |
|
101 | + $reflection = new ReflectionFile(__DIR__.'/Interfaces/InterfaceA.php'); |
|
102 | 102 | |
103 | 103 | $this->assertSame([ |
104 | 104 | \Spiral\Tests\Tokenizer\Interfaces\InterfaceA::class, |
@@ -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'; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $core = $this->httpCore([CookiesMiddleware::class]); |
131 | 131 | $core->setHandler(fn(ServerRequestInterface $r) => $r->getCookieParams()['name']); |
132 | 132 | |
133 | - $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value') . 'BROKEN'; |
|
133 | + $value = $this->container->get(EncrypterInterface::class)->encrypt('cookie-value').'BROKEN'; |
|
134 | 134 | |
135 | 135 | $response = $this->get($core, '/', [], [], ['name' => $value]); |
136 | 136 | $this->assertSame(200, $response->getStatusCode()); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | public function testDelete(): void |
141 | 141 | { |
142 | 142 | $core = $this->httpCore([CookiesMiddleware::class]); |
143 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
143 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
144 | 144 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
145 | 145 | $r->getAttribute(CookieQueue::ATTRIBUTE)->delete('name'); |
146 | 146 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | ])); |
166 | 166 | |
167 | 167 | $core = $this->httpCore([CookiesMiddleware::class]); |
168 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
168 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
169 | 169 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
170 | 170 | |
171 | 171 | return 'all good'; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | ])); |
208 | 208 | |
209 | 209 | $core = $this->httpCore([CookiesMiddleware::class]); |
210 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
210 | + $core->setHandler(function (ServerRequestInterface $r){ |
|
211 | 211 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
212 | 212 | |
213 | 213 | return 'all good'; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | $result = []; |
275 | 275 | |
276 | - foreach ($response->getHeaders() as $line) { |
|
276 | + foreach ($response->getHeaders() as $line){ |
|
277 | 277 | $cookie = explode('=', implode('', $line)); |
278 | 278 | $result[$cookie[0]] = rawurldecode(substr( |
279 | 279 | $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'; |
@@ -140,7 +143,8 @@ discard block |
||
140 | 143 | public function testDelete(): void |
141 | 144 | { |
142 | 145 | $core = $this->httpCore([CookiesMiddleware::class]); |
143 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
146 | + $core->setHandler(function (ServerRequestInterface $r) |
|
147 | + { |
|
144 | 148 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
145 | 149 | $r->getAttribute(CookieQueue::ATTRIBUTE)->delete('name'); |
146 | 150 | |
@@ -165,7 +169,8 @@ discard block |
||
165 | 169 | ])); |
166 | 170 | |
167 | 171 | $core = $this->httpCore([CookiesMiddleware::class]); |
168 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
172 | + $core->setHandler(function (ServerRequestInterface $r) |
|
173 | + { |
|
169 | 174 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
170 | 175 | |
171 | 176 | return 'all good'; |
@@ -207,7 +212,8 @@ discard block |
||
207 | 212 | ])); |
208 | 213 | |
209 | 214 | $core = $this->httpCore([CookiesMiddleware::class]); |
210 | - $core->setHandler(function (ServerRequestInterface $r) { |
|
215 | + $core->setHandler(function (ServerRequestInterface $r) |
|
216 | + { |
|
211 | 217 | $r->getAttribute(CookieQueue::ATTRIBUTE)->set('name', 'value'); |
212 | 218 | |
213 | 219 | return 'all good'; |
@@ -273,7 +279,8 @@ discard block |
||
273 | 279 | { |
274 | 280 | $result = []; |
275 | 281 | |
276 | - foreach ($response->getHeaders() as $line) { |
|
282 | + foreach ($response->getHeaders() as $line) |
|
283 | + { |
|
277 | 284 | $cookie = explode('=', implode('', $line)); |
278 | 285 | $result[$cookie[0]] = rawurldecode(substr( |
279 | 286 | $cookie[1], |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $container = new Container(); |
22 | 22 | |
23 | - $container->runScoped(static function (Container $c1) { |
|
23 | + $container->runScoped(static function (Container $c1){ |
|
24 | 24 | $c1->get(ExceptionConstructor::class); |
25 | 25 | self::fail('Exception should be thrown'); |
26 | 26 | }); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | $container = new Container(); |
35 | 35 | |
36 | - $container->runScoped(static function (Container $c1) { |
|
36 | + $container->runScoped(static function (Container $c1){ |
|
37 | 37 | $c1->get(ExceptionConstructor::class); |
38 | 38 | self::fail('Exception should be thrown'); |
39 | 39 | }); |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | $container = new Container(); |
48 | 48 | |
49 | - $container->runScoped(static function (Container $c1) { |
|
50 | - try { |
|
49 | + $container->runScoped(static function (Container $c1){ |
|
50 | + try{ |
|
51 | 51 | $c1->get(DatetimeCarrier::class); |
52 | 52 | self::fail('Exception should be thrown'); |
53 | - } catch (\Throwable $e) { |
|
53 | + }catch (\Throwable $e){ |
|
54 | 54 | self::assertInstanceOf(NotFoundException::class, $e); |
55 | 55 | self::assertInstanceOf(NotFoundException::class, $e->getPrevious()); |
56 | 56 | self::assertStringContainsString( |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | $container = new Container(); |
22 | 22 | |
23 | - $container->runScoped(static function (Container $c1) { |
|
23 | + $container->runScoped(static function (Container $c1) |
|
24 | + { |
|
24 | 25 | $c1->get(ExceptionConstructor::class); |
25 | 26 | self::fail('Exception should be thrown'); |
26 | 27 | }); |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | |
34 | 35 | $container = new Container(); |
35 | 36 | |
36 | - $container->runScoped(static function (Container $c1) { |
|
37 | + $container->runScoped(static function (Container $c1) |
|
38 | + { |
|
37 | 39 | $c1->get(ExceptionConstructor::class); |
38 | 40 | self::fail('Exception should be thrown'); |
39 | 41 | }); |
@@ -46,11 +48,15 @@ discard block |
||
46 | 48 | |
47 | 49 | $container = new Container(); |
48 | 50 | |
49 | - $container->runScoped(static function (Container $c1) { |
|
50 | - try { |
|
51 | + $container->runScoped(static function (Container $c1) |
|
52 | + { |
|
53 | + try |
|
54 | + { |
|
51 | 55 | $c1->get(DatetimeCarrier::class); |
52 | 56 | self::fail('Exception should be thrown'); |
53 | - } catch (\Throwable $e) { |
|
57 | + } |
|
58 | + catch (\Throwable $e) |
|
59 | + { |
|
54 | 60 | self::assertInstanceOf(NotFoundException::class, $e); |
55 | 61 | self::assertInstanceOf(NotFoundException::class, $e->getPrevious()); |
56 | 62 | self::assertStringContainsString( |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | FiberHelper::runInFiber( |
32 | 32 | self::functionScopedTestDataIterator(), |
33 | - static function (mixed $suspendValue) { |
|
33 | + static function (mixed $suspendValue){ |
|
34 | 34 | self::assertNull(ContainerScope::getContainer()); |
35 | 35 | self::assertTrue(\in_array($suspendValue, self::TEST_DATA, true)); |
36 | 36 | }, |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ); |
64 | 64 | |
65 | 65 | self::assertCount(5, $result); |
66 | - foreach ($result as $suspendValue) { |
|
66 | + foreach ($result as $suspendValue){ |
|
67 | 67 | self::assertSame(self::TEST_DATA, $suspendValue); |
68 | 68 | } |
69 | 69 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ); |
82 | 82 | |
83 | 83 | self::assertCount(2, $result); |
84 | - foreach ($result as $suspendValue) { |
|
84 | + foreach ($result as $suspendValue){ |
|
85 | 85 | self::assertSame(self::TEST_DATA, $suspendValue); |
86 | 86 | } |
87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $result = ''; |
98 | 98 | $result .= Fiber::suspend('foo'); |
99 | 99 | $result .= Fiber::suspend('bar'); |
100 | - return $result . Fiber::suspend('error'); |
|
100 | + return $result.Fiber::suspend('error'); |
|
101 | 101 | } |
102 | 102 | ), |
103 | 103 | static fn(string $suspendValue): string => $suspendValue !== 'error' |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | $result = ''; |
115 | 115 | $result .= Fiber::suspend('foo'); |
116 | 116 | $result .= Fiber::suspend('bar'); |
117 | - try { |
|
117 | + try{ |
|
118 | 118 | $result .= Fiber::suspend('error'); |
119 | - } catch (\Throwable $e) { |
|
119 | + }catch (\Throwable $e){ |
|
120 | 120 | $result .= $e->getMessage(); |
121 | 121 | } |
122 | - return $result . Fiber::suspend('baz'); |
|
122 | + return $result.Fiber::suspend('baz'); |
|
123 | 123 | } |
124 | 124 | ), |
125 | 125 | static fn(string $suspendValue): string => $suspendValue !== 'error' |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | ?callable $load = null, |
143 | 143 | ?Container $container = null, |
144 | 144 | ): callable { |
145 | - return static function () use ($load, $container): array { |
|
145 | + return static function () use ($load, $container) : array { |
|
146 | 146 | // The function should be called in a fiber |
147 | 147 | self::assertNotNull(Fiber::getCurrent()); |
148 | 148 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $resource = $c3->get('resource'); |
164 | 164 | self::assertInstanceOf(DateTimeImmutable::class, $c3->get('bar')); |
165 | 165 | self::assertInstanceOf(stdClass::class, $resource); |
166 | - foreach (self::TEST_DATA as $key => $value) { |
|
166 | + foreach (self::TEST_DATA as $key => $value){ |
|
167 | 167 | $resource->$key = $value; |
168 | 168 | $load === null or $load(); |
169 | 169 | Fiber::suspend($value); |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | }, ['foo' => new DateTime()]); |
177 | 177 | self::assertFalse($c1->has('foo')); |
178 | 178 | |
179 | - self::assertSame(self::TEST_DATA, (array) $result); |
|
180 | - return (array) $result; |
|
179 | + self::assertSame(self::TEST_DATA, (array)$result); |
|
180 | + return (array)$result; |
|
181 | 181 | }; |
182 | 182 | } |
183 | 183 | } |
@@ -30,7 +30,8 @@ discard block |
||
30 | 30 | |
31 | 31 | FiberHelper::runInFiber( |
32 | 32 | self::functionScopedTestDataIterator(), |
33 | - static function (mixed $suspendValue) { |
|
33 | + static function (mixed $suspendValue) |
|
34 | + { |
|
34 | 35 | self::assertNull(ContainerScope::getContainer()); |
35 | 36 | self::assertTrue(\in_array($suspendValue, self::TEST_DATA, true)); |
36 | 37 | }, |
@@ -63,7 +64,8 @@ discard block |
||
63 | 64 | ); |
64 | 65 | |
65 | 66 | self::assertCount(5, $result); |
66 | - foreach ($result as $suspendValue) { |
|
67 | + foreach ($result as $suspendValue) |
|
68 | + { |
|
67 | 69 | self::assertSame(self::TEST_DATA, $suspendValue); |
68 | 70 | } |
69 | 71 | } |
@@ -81,7 +83,8 @@ discard block |
||
81 | 83 | ); |
82 | 84 | |
83 | 85 | self::assertCount(2, $result); |
84 | - foreach ($result as $suspendValue) { |
|
86 | + foreach ($result as $suspendValue) |
|
87 | + { |
|
85 | 88 | self::assertSame(self::TEST_DATA, $suspendValue); |
86 | 89 | } |
87 | 90 | } |
@@ -114,9 +117,12 @@ discard block |
||
114 | 117 | $result = ''; |
115 | 118 | $result .= Fiber::suspend('foo'); |
116 | 119 | $result .= Fiber::suspend('bar'); |
117 | - try { |
|
120 | + try |
|
121 | + { |
|
118 | 122 | $result .= Fiber::suspend('error'); |
119 | - } catch (\Throwable $e) { |
|
123 | + } |
|
124 | + catch (\Throwable $e) |
|
125 | + { |
|
120 | 126 | $result .= $e->getMessage(); |
121 | 127 | } |
122 | 128 | return $result . Fiber::suspend('baz'); |
@@ -150,20 +156,23 @@ discard block |
||
150 | 156 | $c1 = $container ?? new Container(); |
151 | 157 | $c1->bindSingleton('resource', new stdClass()); |
152 | 158 | |
153 | - $result = $c1->runScoped(static function (Container $c2) use ($load) { |
|
159 | + $result = $c1->runScoped(static function (Container $c2) use ($load) |
|
160 | + { |
|
154 | 161 | // check local binding |
155 | 162 | self::assertTrue($c2->has('foo')); |
156 | 163 | self::assertInstanceOf(DateTime::class, $c2->get('foo')); |
157 | 164 | |
158 | 165 | return $c2->runScoped( |
159 | - static function (ContainerInterface $c3) use ($load) { |
|
166 | + static function (ContainerInterface $c3) use ($load) |
|
167 | + { |
|
160 | 168 | // check local binding |
161 | 169 | self::assertTrue($c3->has('bar')); |
162 | 170 | |
163 | 171 | $resource = $c3->get('resource'); |
164 | 172 | self::assertInstanceOf(DateTimeImmutable::class, $c3->get('bar')); |
165 | 173 | self::assertInstanceOf(stdClass::class, $resource); |
166 | - foreach (self::TEST_DATA as $key => $value) { |
|
174 | + foreach (self::TEST_DATA as $key => $value) |
|
175 | + { |
|
167 | 176 | $resource->$key = $value; |
168 | 177 | $load === null or $load(); |
169 | 178 | Fiber::suspend($value); |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | $this->assertNull(ContainerScope::getContainer()); |
34 | 34 | |
35 | - try { |
|
35 | + try{ |
|
36 | 36 | $this->assertTrue(ContainerScope::runScope($container, function () use ($container): void { |
37 | 37 | throw new RuntimeException('exception'); |
38 | 38 | })); |
39 | - } catch (\Throwable $e) { |
|
39 | + }catch (\Throwable $e){ |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->assertInstanceOf(RuntimeException::class, $e); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->assertTrue($c->runScope([ |
55 | 55 | 'bucket' => new Bucket('b'), |
56 | 56 | 'other' => new SampleClass() |
57 | - ], function ($c) { |
|
57 | + ], function ($c){ |
|
58 | 58 | $this->assertSame('b', $c->get('bucket')->getName()); |
59 | 59 | $this->assertTrue($c->has('other')); |
60 | 60 | |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | $this->assertTrue($c->runScope([ |
77 | 77 | 'bucket' => new Bucket('b'), |
78 | 78 | 'other' => new SampleClass() |
79 | - ], function ($c) { |
|
79 | + ], function ($c){ |
|
80 | 80 | $this->assertSame('b', $c->get('bucket')->getName()); |
81 | 81 | $this->assertTrue($c->has('other')); |
82 | 82 | |
83 | 83 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
84 | 84 | })); |
85 | 85 | |
86 | - try { |
|
86 | + try{ |
|
87 | 87 | $this->assertTrue($c->runScope([ |
88 | 88 | 'bucket' => new Bucket('b'), |
89 | 89 | 'other' => new SampleClass() |
90 | 90 | ], function () use ($c): void { |
91 | 91 | throw new RuntimeException('exception'); |
92 | 92 | })); |
93 | - } catch (\Throwable $e) { |
|
93 | + }catch (\Throwable $e){ |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $this->assertSame('a', $c->get('bucket')->getName()); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $container->bindSingleton('test', new #[Singleton] class {}); |
136 | 136 | $container->make('test'); |
137 | 137 | |
138 | - $container->runScoped(function (Container $container) { |
|
138 | + $container->runScoped(function (Container $container){ |
|
139 | 139 | $this->assertTrue($container->hasInstance('test')); |
140 | 140 | }); |
141 | 141 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $container->bindSingleton('test', SampleClass::class); |
147 | 147 | $container->make('test'); |
148 | 148 | |
149 | - $container->runScoped(function (Container $container) { |
|
149 | + $container->runScoped(function (Container $container){ |
|
150 | 150 | $this->assertTrue($container->hasInstance('test')); |
151 | 151 | }); |
152 | 152 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $container->bindSingleton('bar', 'foo'); |
162 | 162 | $container->make('bar'); |
163 | 163 | |
164 | - $container->runScoped(function (Container $container) { |
|
164 | + $container->runScoped(function (Container $container){ |
|
165 | 165 | $this->assertTrue($container->hasInstance('bar')); |
166 | 166 | }); |
167 | 167 | } |
@@ -32,11 +32,14 @@ discard block |
||
32 | 32 | |
33 | 33 | $this->assertNull(ContainerScope::getContainer()); |
34 | 34 | |
35 | - try { |
|
35 | + try |
|
36 | + { |
|
36 | 37 | $this->assertTrue(ContainerScope::runScope($container, function () use ($container): void { |
37 | 38 | throw new RuntimeException('exception'); |
38 | 39 | })); |
39 | - } catch (\Throwable $e) { |
|
40 | + } |
|
41 | + catch (\Throwable $e) |
|
42 | + { |
|
40 | 43 | } |
41 | 44 | |
42 | 45 | $this->assertInstanceOf(RuntimeException::class, $e); |
@@ -54,7 +57,8 @@ discard block |
||
54 | 57 | $this->assertTrue($c->runScope([ |
55 | 58 | 'bucket' => new Bucket('b'), |
56 | 59 | 'other' => new SampleClass() |
57 | - ], function ($c) { |
|
60 | + ], function ($c) |
|
61 | + { |
|
58 | 62 | $this->assertSame('b', $c->get('bucket')->getName()); |
59 | 63 | $this->assertTrue($c->has('other')); |
60 | 64 | |
@@ -76,21 +80,25 @@ discard block |
||
76 | 80 | $this->assertTrue($c->runScope([ |
77 | 81 | 'bucket' => new Bucket('b'), |
78 | 82 | 'other' => new SampleClass() |
79 | - ], function ($c) { |
|
83 | + ], function ($c) |
|
84 | + { |
|
80 | 85 | $this->assertSame('b', $c->get('bucket')->getName()); |
81 | 86 | $this->assertTrue($c->has('other')); |
82 | 87 | |
83 | 88 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
84 | 89 | })); |
85 | 90 | |
86 | - try { |
|
91 | + try |
|
92 | + { |
|
87 | 93 | $this->assertTrue($c->runScope([ |
88 | 94 | 'bucket' => new Bucket('b'), |
89 | 95 | 'other' => new SampleClass() |
90 | 96 | ], function () use ($c): void { |
91 | 97 | throw new RuntimeException('exception'); |
92 | 98 | })); |
93 | - } catch (\Throwable $e) { |
|
99 | + } |
|
100 | + catch (\Throwable $e) |
|
101 | + { |
|
94 | 102 | } |
95 | 103 | |
96 | 104 | $this->assertSame('a', $c->get('bucket')->getName()); |
@@ -132,10 +140,13 @@ discard block |
||
132 | 140 | public function testHasInstanceAfterMakeWithoutAliasInScope(): void |
133 | 141 | { |
134 | 142 | $container = new Container(); |
135 | - $container->bindSingleton('test', new #[Singleton] class {}); |
|
143 | + $container->bindSingleton('test', new #[Singleton] class |
|
144 | + { |
|
145 | +}); |
|
136 | 146 | $container->make('test'); |
137 | 147 | |
138 | - $container->runScoped(function (Container $container) { |
|
148 | + $container->runScoped(function (Container $container) |
|
149 | + { |
|
139 | 150 | $this->assertTrue($container->hasInstance('test')); |
140 | 151 | }); |
141 | 152 | } |
@@ -146,7 +157,8 @@ discard block |
||
146 | 157 | $container->bindSingleton('test', SampleClass::class); |
147 | 158 | $container->make('test'); |
148 | 159 | |
149 | - $container->runScoped(function (Container $container) { |
|
160 | + $container->runScoped(function (Container $container) |
|
161 | + { |
|
150 | 162 | $this->assertTrue($container->hasInstance('test')); |
151 | 163 | }); |
152 | 164 | } |
@@ -161,7 +173,8 @@ discard block |
||
161 | 173 | $container->bindSingleton('bar', 'foo'); |
162 | 174 | $container->make('bar'); |
163 | 175 | |
164 | - $container->runScoped(function (Container $container) { |
|
176 | + $container->runScoped(function (Container $container) |
|
177 | + { |
|
165 | 178 | $this->assertTrue($container->hasInstance('bar')); |
166 | 179 | }); |
167 | 180 | } |
@@ -18,56 +18,56 @@ discard block |
||
18 | 18 | |
19 | 19 | return RectorConfig::configure() |
20 | 20 | ->withPaths([ |
21 | - __DIR__ . '/src/*/src', |
|
22 | - __DIR__ . '/src/*/tests', |
|
23 | - __DIR__ . '/tests', |
|
21 | + __DIR__.'/src/*/src', |
|
22 | + __DIR__.'/src/*/tests', |
|
23 | + __DIR__.'/tests', |
|
24 | 24 | ]) |
25 | 25 | ->withParallel() |
26 | 26 | ->withSkip([ |
27 | 27 | IfIssetToCoalescingRector::class, |
28 | 28 | RemoveUnusedPrivatePropertyRector::class => [ |
29 | - __DIR__ . '/src/Scaffolder/src/Command/BootloaderCommand.php', |
|
30 | - __DIR__ . '/src/Scaffolder/src/Command/CommandCommand.php', |
|
31 | - __DIR__ . '/src/Scaffolder/src/Command/ConfigCommand.php', |
|
32 | - __DIR__ . '/src/Scaffolder/src/Command/ControllerCommand.php', |
|
33 | - __DIR__ . '/src/Scaffolder/src/Command/FilterCommand.php', |
|
34 | - __DIR__ . '/src/Scaffolder/src/Command/JobHandlerCommand.php', |
|
35 | - __DIR__ . '/src/Scaffolder/src/Command/MiddlewareCommand.php', |
|
36 | - __DIR__ . '/src/Console/tests/PromptArgumentsTest.php', |
|
29 | + __DIR__.'/src/Scaffolder/src/Command/BootloaderCommand.php', |
|
30 | + __DIR__.'/src/Scaffolder/src/Command/CommandCommand.php', |
|
31 | + __DIR__.'/src/Scaffolder/src/Command/ConfigCommand.php', |
|
32 | + __DIR__.'/src/Scaffolder/src/Command/ControllerCommand.php', |
|
33 | + __DIR__.'/src/Scaffolder/src/Command/FilterCommand.php', |
|
34 | + __DIR__.'/src/Scaffolder/src/Command/JobHandlerCommand.php', |
|
35 | + __DIR__.'/src/Scaffolder/src/Command/MiddlewareCommand.php', |
|
36 | + __DIR__.'/src/Console/tests/PromptArgumentsTest.php', |
|
37 | 37 | ], |
38 | 38 | RemoveUnusedPrivateMethodRector::class => [ |
39 | - __DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
40 | - __DIR__ . '/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php', |
|
41 | - __DIR__ . '/src/Cache/src/Bootloader/CacheBootloader.php', |
|
42 | - __DIR__ . '/src/Serializer/src/Bootloader/SerializerBootloader.php', |
|
43 | - __DIR__ . '/src/Validation/src/Bootloader/ValidationBootloader.php', |
|
44 | - __DIR__ . '/src/Translator/tests/IndexerTest.php', |
|
45 | - __DIR__ . '/src/Tokenizer/tests/ReflectionFileTest.php', |
|
46 | - __DIR__ . '/src/Core/tests/SingletonsTest.php', |
|
39 | + __DIR__.'/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
40 | + __DIR__.'/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php', |
|
41 | + __DIR__.'/src/Cache/src/Bootloader/CacheBootloader.php', |
|
42 | + __DIR__.'/src/Serializer/src/Bootloader/SerializerBootloader.php', |
|
43 | + __DIR__.'/src/Validation/src/Bootloader/ValidationBootloader.php', |
|
44 | + __DIR__.'/src/Translator/tests/IndexerTest.php', |
|
45 | + __DIR__.'/src/Tokenizer/tests/ReflectionFileTest.php', |
|
46 | + __DIR__.'/src/Core/tests/SingletonsTest.php', |
|
47 | 47 | ], |
48 | 48 | RemoveUselessVarTagRector::class => [ |
49 | - __DIR__ . '/src/Console/src/Traits/HelpersTrait.php', |
|
49 | + __DIR__.'/src/Console/src/Traits/HelpersTrait.php', |
|
50 | 50 | ], |
51 | 51 | RemoveAlwaysTrueIfConditionRector::class => [ |
52 | - __DIR__ . '/src/Boot/src/BootloadManager/Initializer.php', |
|
53 | - __DIR__ . '/src/Stempler/src/Traverser.php', |
|
54 | - __DIR__ . '/src/Prototype/src/NodeVisitors/LocateProperties.php', |
|
55 | - __DIR__ . '/src/Prototype/src/NodeVisitors/RemoveTrait.php', |
|
56 | - __DIR__ . '/src/Logger/src/ListenerRegistry.php', |
|
57 | - __DIR__ . '/src/Stempler/src/Transform/Merge/ExtendsParent.php', |
|
52 | + __DIR__.'/src/Boot/src/BootloadManager/Initializer.php', |
|
53 | + __DIR__.'/src/Stempler/src/Traverser.php', |
|
54 | + __DIR__.'/src/Prototype/src/NodeVisitors/LocateProperties.php', |
|
55 | + __DIR__.'/src/Prototype/src/NodeVisitors/RemoveTrait.php', |
|
56 | + __DIR__.'/src/Logger/src/ListenerRegistry.php', |
|
57 | + __DIR__.'/src/Stempler/src/Transform/Merge/ExtendsParent.php', |
|
58 | 58 | ], |
59 | 59 | RemoveExtraParametersRector::class => [ |
60 | - __DIR__ . '/src/Boot/src/BootloadManager/AbstractBootloadManager.php', |
|
60 | + __DIR__.'/src/Boot/src/BootloadManager/AbstractBootloadManager.php', |
|
61 | 61 | ], |
62 | 62 | RemoveUnusedPrivateMethodParameterRector::class => [ |
63 | - __DIR__ . '/src/Core/src/Internal/Factory.php', |
|
64 | - __DIR__ . '/src/Core/tests/InjectableTest.php', |
|
63 | + __DIR__.'/src/Core/src/Internal/Factory.php', |
|
64 | + __DIR__.'/src/Core/tests/InjectableTest.php', |
|
65 | 65 | ], |
66 | 66 | RemoveDoubleAssignRector::class => [ |
67 | - __DIR__ . '/src/Core/tests/Scope/FinalizeAttributeTest.php', |
|
67 | + __DIR__.'/src/Core/tests/Scope/FinalizeAttributeTest.php', |
|
68 | 68 | ], |
69 | 69 | RemoveUnusedVariableAssignRector::class => [ |
70 | - __DIR__ . '/src/Core/tests/ExceptionsTest.php', |
|
70 | + __DIR__.'/src/Core/tests/ExceptionsTest.php', |
|
71 | 71 | ], |
72 | 72 | |
73 | 73 | // to be enabled later for bc break 4.x |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | RemoveUnusedPromotedPropertyRector::class, |
77 | 77 | |
78 | 78 | // start with short open tag |
79 | - __DIR__ . '/src/Views/tests/fixtures/other/var.php', |
|
80 | - __DIR__ . '/tests/app/views/native.php', |
|
79 | + __DIR__.'/src/Views/tests/fixtures/other/var.php', |
|
80 | + __DIR__.'/tests/app/views/native.php', |
|
81 | 81 | |
82 | 82 | // example code for test |
83 | 83 | '*/Fixtures/*', |
84 | 84 | '*/Stubs/*', |
85 | 85 | '*/tests/Classes/*', |
86 | 86 | '*/tests/Internal/*', |
87 | - __DIR__ . '/src/Console/tests/Configurator', |
|
87 | + __DIR__.'/src/Console/tests/Configurator', |
|
88 | 88 | |
89 | 89 | // cache |
90 | 90 | '*/tests/runtime/cache/*', |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | $core = TestCore::create([ |
16 | 16 | 'root' => __DIR__, |
17 | - 'config' => __DIR__ . '/config' |
|
17 | + 'config' => __DIR__.'/config' |
|
18 | 18 | ])->run(); |
19 | 19 | |
20 | 20 | /** @var TestConfig $config */ |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $core = TestCore::create([ |
29 | 29 | 'root' => __DIR__, |
30 | - 'config' => __DIR__ . '/config', |
|
30 | + 'config' => __DIR__.'/config', |
|
31 | 31 | ])->run(); |
32 | 32 | |
33 | 33 | /** @var ConfiguratorInterface $configurator */ |