@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | |
28 | 28 | $this->assertNull(ContainerScope::getContainer()); |
29 | 29 | |
30 | - $this->assertTrue(ContainerScope::runScope($container, function () use ($container) { |
|
30 | + $this->assertTrue(ContainerScope::runScope($container, function () use ($container) |
|
31 | + { |
|
31 | 32 | return $container === ContainerScope::getContainer(); |
32 | 33 | })); |
33 | 34 | |
@@ -40,11 +41,14 @@ discard block |
||
40 | 41 | |
41 | 42 | $this->assertNull(ContainerScope::getContainer()); |
42 | 43 | |
43 | - try { |
|
44 | + try |
|
45 | + { |
|
44 | 46 | $this->assertTrue(ContainerScope::runScope($container, function () use ($container): void { |
45 | 47 | throw new RuntimeException('exception'); |
46 | 48 | })); |
47 | - } catch (\Throwable $e) { |
|
49 | + } |
|
50 | + catch (\Throwable $e) |
|
51 | + { |
|
48 | 52 | } |
49 | 53 | |
50 | 54 | $this->assertInstanceOf(RuntimeException::class, $e); |
@@ -62,7 +66,8 @@ discard block |
||
62 | 66 | $this->assertTrue($c->runScope([ |
63 | 67 | 'bucket' => new Bucket('b'), |
64 | 68 | 'other' => new SampleClass() |
65 | - ], function () use ($c) { |
|
69 | + ], function () use ($c) |
|
70 | + { |
|
66 | 71 | $this->assertSame('b', $c->get('bucket')->getName()); |
67 | 72 | $this->assertTrue($c->has('other')); |
68 | 73 | |
@@ -84,21 +89,25 @@ discard block |
||
84 | 89 | $this->assertTrue($c->runScope([ |
85 | 90 | 'bucket' => new Bucket('b'), |
86 | 91 | 'other' => new SampleClass() |
87 | - ], function () use ($c) { |
|
92 | + ], function () use ($c) |
|
93 | + { |
|
88 | 94 | $this->assertSame('b', $c->get('bucket')->getName()); |
89 | 95 | $this->assertTrue($c->has('other')); |
90 | 96 | |
91 | 97 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
92 | 98 | })); |
93 | 99 | |
94 | - try { |
|
100 | + try |
|
101 | + { |
|
95 | 102 | $this->assertTrue($c->runScope([ |
96 | 103 | 'bucket' => new Bucket('b'), |
97 | 104 | 'other' => new SampleClass() |
98 | 105 | ], function () use ($c): void { |
99 | 106 | throw new RuntimeException('exception'); |
100 | 107 | })); |
101 | - } catch (\Throwable $e) { |
|
108 | + } |
|
109 | + catch (\Throwable $e) |
|
110 | + { |
|
102 | 111 | } |
103 | 112 | |
104 | 113 | $this->assertSame('a', $c->get('bucket')->getName()); |
@@ -60,7 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | $instance = new SampleClass(); |
62 | 62 | |
63 | - $container->bindSingleton('sampleClass', function () use ($instance) { |
|
63 | + $container->bindSingleton('sampleClass', function () use ($instance) |
|
64 | + { |
|
64 | 65 | return $instance; |
65 | 66 | }); |
66 | 67 | |
@@ -71,7 +72,8 @@ discard block |
||
71 | 72 | { |
72 | 73 | $container = new Container(); |
73 | 74 | |
74 | - $container->bindSingleton('sampleClass', function () { |
|
75 | + $container->bindSingleton('sampleClass', function () |
|
76 | + { |
|
75 | 77 | return new SampleClass(); |
76 | 78 | }); |
77 | 79 | |
@@ -98,7 +100,8 @@ discard block |
||
98 | 100 | $container = new Container(); |
99 | 101 | $container->bindSingleton('singleton', 'sampleClass'); |
100 | 102 | |
101 | - $container->bind('sampleClass', function () { |
|
103 | + $container->bind('sampleClass', function () |
|
104 | + { |
|
102 | 105 | return new SampleClass(); |
103 | 106 | }); |
104 | 107 |
@@ -25,7 +25,8 @@ discard block |
||
25 | 25 | |
26 | 26 | $this->assertFalse($container->has('abc')); |
27 | 27 | |
28 | - $container->bind('abc', function () { |
|
28 | + $container->bind('abc', function () |
|
29 | + { |
|
29 | 30 | return 'hello'; |
30 | 31 | }); |
31 | 32 | |
@@ -38,7 +39,8 @@ discard block |
||
38 | 39 | $container = new Container(); |
39 | 40 | |
40 | 41 | $this->assertFalse($container->has('abc')); |
41 | - $container->bind('abc', function () { |
|
42 | + $container->bind('abc', function () |
|
43 | + { |
|
42 | 44 | return 'hello'; |
43 | 45 | }); |
44 | 46 |
@@ -124,9 +124,12 @@ |
||
124 | 124 | */ |
125 | 125 | public function getActiveSession(): SessionInterface |
126 | 126 | { |
127 | - try { |
|
127 | + try |
|
128 | + { |
|
128 | 129 | return $this->container->get(SessionInterface::class); |
129 | - } catch (NotFoundExceptionInterface $e) { |
|
130 | + } |
|
131 | + catch (NotFoundExceptionInterface $e) |
|
132 | + { |
|
130 | 133 | throw new ScopeException( |
131 | 134 | 'Unable to receive active session, invalid request scope', |
132 | 135 | $e->getCode(), |
@@ -169,9 +169,12 @@ discard block |
||
169 | 169 | */ |
170 | 170 | private function getRequest(): ServerRequestInterface |
171 | 171 | { |
172 | - try { |
|
172 | + try |
|
173 | + { |
|
173 | 174 | return $this->container->get(ServerRequestInterface::class); |
174 | - } catch (NotFoundExceptionInterface $e) { |
|
175 | + } |
|
176 | + catch (NotFoundExceptionInterface $e) |
|
177 | + { |
|
175 | 178 | throw new ScopeException('Unable to receive active request', $e->getCode(), $e); |
176 | 179 | } |
177 | 180 | } |
@@ -183,9 +186,12 @@ discard block |
||
183 | 186 | */ |
184 | 187 | private function getCookieQueue(): CookieQueue |
185 | 188 | { |
186 | - try { |
|
189 | + try |
|
190 | + { |
|
187 | 191 | return $this->container->get(CookieQueue::class); |
188 | - } catch (NotFoundExceptionInterface $e) { |
|
192 | + } |
|
193 | + catch (NotFoundExceptionInterface $e) |
|
194 | + { |
|
189 | 195 | throw new ScopeException('Unable to receive cookie queue, invalid request scope', $e->getCode(), $e); |
190 | 196 | } |
191 | 197 | } |
@@ -72,7 +72,8 @@ |
||
72 | 72 | private function cookieQueue(ServerRequestInterface $request): CookieQueue |
73 | 73 | { |
74 | 74 | $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE, null); |
75 | - if ($cookieQueue === null) { |
|
75 | + if ($cookieQueue === null) |
|
76 | + { |
|
76 | 77 | throw new ScopeException('Unable to resolve CookieQueue, invalid request scope'); |
77 | 78 | } |
78 | 79 |
@@ -30,7 +30,8 @@ |
||
30 | 30 | |
31 | 31 | protected function getFactory(string $directory = null, bool $strict = true): ConfigManager |
32 | 32 | { |
33 | - if (is_null($directory)) { |
|
33 | + if (is_null($directory)) |
|
34 | + { |
|
34 | 35 | $directory = __DIR__ . '/fixtures'; |
35 | 36 | } |
36 | 37 |
@@ -137,7 +137,8 @@ discard block |
||
137 | 137 | $this->assertTrue($files->exists($directory)); |
138 | 138 | $this->assertTrue($files->isDirectory($directory)); |
139 | 139 | |
140 | - foreach ($filenames as $filename) { |
|
140 | + foreach ($filenames as $filename) |
|
141 | + { |
|
141 | 142 | $this->assertFalse($files->exists($filename)); |
142 | 143 | $files->write($filename, 'random-data'); |
143 | 144 | $this->assertTrue($files->exists($filename)); |
@@ -151,7 +152,8 @@ discard block |
||
151 | 152 | $this->assertFalse($files->exists($directory)); |
152 | 153 | $this->assertFalse($files->isDirectory($directory)); |
153 | 154 | |
154 | - foreach ($filenames as $filename) { |
|
155 | + foreach ($filenames as $filename) |
|
156 | + { |
|
155 | 157 | $this->assertFalse($files->exists($filename)); |
156 | 158 | } |
157 | 159 | } |
@@ -182,7 +184,8 @@ discard block |
||
182 | 184 | $this->assertTrue($files->exists($directory)); |
183 | 185 | $this->assertTrue($files->isDirectory($directory)); |
184 | 186 | |
185 | - foreach ($filenames as $filename) { |
|
187 | + foreach ($filenames as $filename) |
|
188 | + { |
|
186 | 189 | $this->assertFalse($files->exists($filename)); |
187 | 190 | $files->write($filename, 'random-data'); |
188 | 191 | $this->assertTrue($files->exists($filename)); |
@@ -196,7 +199,8 @@ discard block |
||
196 | 199 | $this->assertFalse($files->exists($directory)); |
197 | 200 | $this->assertFalse($files->isDirectory($directory)); |
198 | 201 | |
199 | - foreach ($filenames as $filename) { |
|
202 | + foreach ($filenames as $filename) |
|
203 | + { |
|
200 | 204 | $this->assertFalse($files->exists($filename)); |
201 | 205 | } |
202 | 206 | } |
@@ -20,7 +20,8 @@ |
||
20 | 20 | |
21 | 21 | protected static function filter($v) |
22 | 22 | { |
23 | - if (is_array($v)) { |
|
23 | + if (is_array($v)) |
|
24 | + { |
|
24 | 25 | throw new RuntimeException("can't be array"); |
25 | 26 | } |
26 | 27 |