Passed
Pull Request — master (#1136)
by Abdul Malik
11:17
created
src/Scaffolder/tests/Command/AbstractCommandTestCase.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 
17 17
     protected function deleteDeclaration(string $class): void
18 18
     {
19
-        if (class_exists($class)) {
20
-            try {
19
+        if (class_exists($class)){
20
+            try{
21 21
                 $reflection = new ReflectionClass($class);
22 22
                 $this->files()->delete($reflection->getFileName());
23
-            } catch (Throwable $exception) {
23
+            }catch (Throwable $exception){
24 24
                 var_dump($exception->getMessage());
25 25
             }
26 26
         }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     {
47 47
         parent::tearDown();
48 48
 
49
-        if ($this->className) {
49
+        if ($this->className){
50 50
             $this->deleteDeclaration($this->className);
51 51
         }
52 52
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,11 +16,15 @@  discard block
 block discarded – undo
16 16
 
17 17
     protected function deleteDeclaration(string $class): void
18 18
     {
19
-        if (class_exists($class)) {
20
-            try {
19
+        if (class_exists($class))
20
+        {
21
+            try
22
+            {
21 23
                 $reflection = new ReflectionClass($class);
22 24
                 $this->files()->delete($reflection->getFileName());
23
-            } catch (Throwable $exception) {
25
+            }
26
+            catch (Throwable $exception)
27
+            {
24 28
                 var_dump($exception->getMessage());
25 29
             }
26 30
         }
@@ -46,7 +50,8 @@  discard block
 block discarded – undo
46 50
     {
47 51
         parent::tearDown();
48 52
 
49
-        if ($this->className) {
53
+        if ($this->className)
54
+        {
50 55
             $this->deleteDeclaration($this->className);
51 56
         }
52 57
     }
Please login to merge, or discard this patch.
src/Csrf/tests/CsrfTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -257,10 +257,10 @@
 block discarded – undo
257 257
     {
258 258
         $result = [];
259 259
 
260
-        foreach ($response->getHeaders() as $header) {
261
-            foreach ($header as $headerLine) {
260
+        foreach ($response->getHeaders() as $header){
261
+            foreach ($header as $headerLine){
262 262
                 $chunk = explode(';', $headerLine);
263
-                if (mb_strpos($chunk[0], '=') === false) {
263
+                if (mb_strpos($chunk[0], '=') === false){
264 264
                     continue;
265 265
                 }
266 266
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -257,10 +257,13 @@
 block discarded – undo
257 257
     {
258 258
         $result = [];
259 259
 
260
-        foreach ($response->getHeaders() as $header) {
261
-            foreach ($header as $headerLine) {
260
+        foreach ($response->getHeaders() as $header)
261
+        {
262
+            foreach ($header as $headerLine)
263
+            {
262 264
                 $chunk = explode(';', $headerLine);
263
-                if (mb_strpos($chunk[0], '=') === false) {
265
+                if (mb_strpos($chunk[0], '=') === false)
266
+                {
264 267
                     continue;
265 268
                 }
266 269
 
Please login to merge, or discard this patch.
src/Tokenizer/tests/ReflectionFileTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
src/Cookies/tests/CookiesTest.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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],
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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],
Please login to merge, or discard this patch.
src/Core/tests/Scope/ExceptionsTest.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Core/tests/Scope/FibersTest.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Core/tests/ScopesTest.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Braces   +23 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,11 +32,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Console/tests/Configurator/Attribute/OptionsTest.php 1 patch
Braces   +42 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
     public function testRequired(): void
27 27
     {
28 28
         $result = $this->parser->parse(new \ReflectionClass(
29
-            new #[AsCommand(name: 'foo')] class {
29
+            new #[AsCommand(name: 'foo')] class
30
+            {
30 31
                 #[Option(mode: InputOption::VALUE_REQUIRED)]
31 32
                 private int $option;
32 33
             }
@@ -44,7 +45,8 @@  discard block
 block discarded – undo
44 45
     public function testDefaultValue(): void
45 46
     {
46 47
         $result = $this->parser->parse(new \ReflectionClass(
47
-            new #[AsCommand(name: 'foo')] class {
48
+            new #[AsCommand(name: 'foo')] class
49
+            {
48 50
                 #[Option(mode: InputOption::VALUE_OPTIONAL)]
49 51
                 private string $option = 'some';
50 52
             }
@@ -62,7 +64,8 @@  discard block
 block discarded – undo
62 64
     public function testNullable(): void
63 65
     {
64 66
         $result = $this->parser->parse(new \ReflectionClass(
65
-            new #[AsCommand(name: 'foo')] class {
67
+            new #[AsCommand(name: 'foo')] class
68
+            {
66 69
                 #[Option(mode: InputOption::VALUE_OPTIONAL)]
67 70
                 private ?string $option = null;
68 71
             }
@@ -80,7 +83,8 @@  discard block
 block discarded – undo
80 83
     public function testWithName(): void
81 84
     {
82 85
         $result = $this->parser->parse(new \ReflectionClass(
83
-            new #[AsCommand(name: 'foo')] class {
86
+            new #[AsCommand(name: 'foo')] class
87
+            {
84 88
                 #[Option(name: 'customName', mode: InputOption::VALUE_OPTIONAL)]
85 89
                 private ?string $option = null;
86 90
             }
@@ -98,7 +102,8 @@  discard block
 block discarded – undo
98 102
     public function testWithShortcut(): void
99 103
     {
100 104
         $result = $this->parser->parse(new \ReflectionClass(
101
-            new #[AsCommand(name: 'foo')] class {
105
+            new #[AsCommand(name: 'foo')] class
106
+            {
102 107
                 #[Option(shortcut: 't', mode: InputOption::VALUE_OPTIONAL)]
103 108
                 private ?string $option = null;
104 109
             }
@@ -116,7 +121,8 @@  discard block
 block discarded – undo
116 121
     public function testWithDescription(): void
117 122
     {
118 123
         $result = $this->parser->parse(new \ReflectionClass(
119
-            new #[AsCommand(name: 'foo')] class {
124
+            new #[AsCommand(name: 'foo')] class
125
+            {
120 126
                 #[Option(description: 'Some description', mode: InputOption::VALUE_OPTIONAL)]
121 127
                 private ?string $option = null;
122 128
             }
@@ -134,7 +140,8 @@  discard block
 block discarded – undo
134 140
     public function testModeOptionalArray(): void
135 141
     {
136 142
         $result = $this->parser->parse(new \ReflectionClass(
137
-            new #[AsCommand(name: 'foo')] class {
143
+            new #[AsCommand(name: 'foo')] class
144
+            {
138 145
                 #[Option(mode: InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY)]
139 146
                 private array $option = [];
140 147
             }
@@ -152,7 +159,8 @@  discard block
 block discarded – undo
152 159
     public function testModeRequiredArray(): void
153 160
     {
154 161
         $result = $this->parser->parse(new \ReflectionClass(
155
-            new #[AsCommand(name: 'foo')] class {
162
+            new #[AsCommand(name: 'foo')] class
163
+            {
156 164
                 #[Option(mode: InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY)]
157 165
                 private array $option = [];
158 166
             }
@@ -170,7 +178,8 @@  discard block
 block discarded – undo
170 178
     public function testModeValueNegatable(): void
171 179
     {
172 180
         $result = $this->parser->parse(new \ReflectionClass(
173
-            new #[AsCommand(name: 'foo')] class {
181
+            new #[AsCommand(name: 'foo')] class
182
+            {
174 183
                 #[Option(mode: InputOption::VALUE_NEGATABLE)]
175 184
                 private bool $option;
176 185
             }
@@ -188,7 +197,8 @@  discard block
 block discarded – undo
188 197
     public function testModeValueNone(): void
189 198
     {
190 199
         $result = $this->parser->parse(new \ReflectionClass(
191
-            new #[AsCommand(name: 'foo')] class {
200
+            new #[AsCommand(name: 'foo')] class
201
+            {
192 202
                 #[Option(mode: InputOption::VALUE_NONE)]
193 203
                 private bool $option;
194 204
             }
@@ -206,7 +216,8 @@  discard block
 block discarded – undo
206 216
     public function testGuessedRequiredOption(): void
207 217
     {
208 218
         $result = $this->parser->parse(new \ReflectionClass(
209
-            new #[AsCommand(name: 'foo')] class {
219
+            new #[AsCommand(name: 'foo')] class
220
+            {
210 221
                 #[Option]
211 222
                 private int $int;
212 223
 
@@ -234,7 +245,8 @@  discard block
 block discarded – undo
234 245
     public function testGuessedOptionalOption(): void
235 246
     {
236 247
         $result = $this->parser->parse(new \ReflectionClass(
237
-            new #[AsCommand(name: 'foo')] class {
248
+            new #[AsCommand(name: 'foo')] class
249
+            {
238 250
                 #[Option]
239 251
                 private ?int $int = null;
240 252
 
@@ -265,7 +277,8 @@  discard block
 block discarded – undo
265 277
     public function testGuessedOptionalOptionFromPropertiesWithDefaultValue(): void
266 278
     {
267 279
         $result = $this->parser->parse(new \ReflectionClass(
268
-            new #[AsCommand(name: 'foo')] class {
280
+            new #[AsCommand(name: 'foo')] class
281
+            {
269 282
                 #[Option]
270 283
                 private int $int = 1;
271 284
 
@@ -296,7 +309,8 @@  discard block
 block discarded – undo
296 309
     public function testGuessedArrayOption(): void
297 310
     {
298 311
         $result = $this->parser->parse(new \ReflectionClass(
299
-            new #[AsCommand(name: 'foo')] class {
312
+            new #[AsCommand(name: 'foo')] class
313
+            {
300 314
                 #[Option]
301 315
                 private array $array;
302 316
             }
@@ -310,7 +324,8 @@  discard block
 block discarded – undo
310 324
     public function testGuessedOptionalArrayOption(): void
311 325
     {
312 326
         $result = $this->parser->parse(new \ReflectionClass(
313
-            new #[AsCommand(name: 'foo')] class {
327
+            new #[AsCommand(name: 'foo')] class
328
+            {
314 329
                 #[Option]
315 330
                 private ?array $array = null;
316 331
             }
@@ -325,7 +340,8 @@  discard block
 block discarded – undo
325 340
     public function testGuessedOptionalArrayOptionFromPropertyWithDefaultValue(): void
326 341
     {
327 342
         $result = $this->parser->parse(new \ReflectionClass(
328
-            new #[AsCommand(name: 'foo')] class {
343
+            new #[AsCommand(name: 'foo')] class
344
+            {
329 345
                 #[Option]
330 346
                 private array $array = [];
331 347
             }
@@ -340,7 +356,8 @@  discard block
 block discarded – undo
340 356
     public function testWithSuggestedValue(): void
341 357
     {
342 358
         $result = $this->parser->parse(new \ReflectionClass(
343
-            new #[AsCommand(name: 'foo')] class {
359
+            new #[AsCommand(name: 'foo')] class
360
+            {
344 361
                 #[Option(mode: InputOption::VALUE_REQUIRED, suggestedValues: [1, 0])]
345 362
                 private int $option;
346 363
             }
@@ -366,7 +383,8 @@  discard block
 block discarded – undo
366 383
     public function testUnionTypeWithBuiltInAndNot(): void
367 384
     {
368 385
         $result = $this->parser->parse(new \ReflectionClass(
369
-            new #[AsCommand(name: 'foo')] class {
386
+            new #[AsCommand(name: 'foo')] class
387
+            {
370 388
                 #[Option(mode: InputOption::VALUE_OPTIONAL)]
371 389
                 private int|\stdClass $option;
372 390
             }
@@ -385,7 +403,8 @@  discard block
 block discarded – undo
385 403
     {
386 404
         $this->expectException(ConfiguratorException::class);
387 405
         $this->parser->parse(new \ReflectionClass(
388
-            new #[AsCommand(name: 'foo')] class {
406
+            new #[AsCommand(name: 'foo')] class
407
+            {
389 408
                 #[Option]
390 409
                 private \stdClass $option;
391 410
             }
@@ -396,7 +415,8 @@  discard block
 block discarded – undo
396 415
     {
397 416
         $this->expectException(ConfiguratorException::class);
398 417
         $this->parser->parse(new \ReflectionClass(
399
-            new #[AsCommand(name: 'foo')] class {
418
+            new #[AsCommand(name: 'foo')] class
419
+            {
400 420
                 #[Option]
401 421
                 private \stdClass&\Traversable $option;
402 422
             }
@@ -407,7 +427,8 @@  discard block
 block discarded – undo
407 427
     {
408 428
         $this->expectException(ConfiguratorException::class);
409 429
         $this->parser->parse(new \ReflectionClass(
410
-            new #[AsCommand(name: 'foo')] class {
430
+            new #[AsCommand(name: 'foo')] class
431
+            {
411 432
                 #[Option]
412 433
                 private object $object;
413 434
             }
Please login to merge, or discard this patch.
src/Console/tests/Configurator/Attribute/FillPropertiesTest.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             ->method('getArgument')
38 38
             ->willReturnOnConsecutiveCalls(5, 'foo', ['foo', 'bar'], 0.5, true);
39 39
 
40
-        $command = new #[AsCommand('foo')] class extends Command {
40
+        $command = new #[AsCommand('foo')] class extends Command{
41 41
             #[Argument]
42 42
             public int $intVal;
43 43
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             ->expects($this->never())
77 77
             ->method('getArgument');
78 78
 
79
-        $command = new #[AsCommand('foo')] class extends Command {
79
+        $command = new #[AsCommand('foo')] class extends Command{
80 80
             #[Argument]
81 81
             public int $arg;
82 82
         };
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             ->method('getOption')
100 100
             ->willReturnOnConsecutiveCalls(5, 'foo', ['foo', 'bar'], 0.5, true, true);
101 101
 
102
-        $command = new #[AsCommand('foo')] class extends Command {
102
+        $command = new #[AsCommand('foo')] class extends Command{
103 103
             #[Option(mode: InputOption::VALUE_REQUIRED)]
104 104
             public int $intVal;
105 105
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             ->method('getOption')
143 143
             ->willReturnOnConsecutiveCalls(1, null, 0);
144 144
 
145
-        $command = new #[AsCommand('foo')] class extends Command {
145
+        $command = new #[AsCommand('foo')] class extends Command{
146 146
             #[Option(mode: InputOption::VALUE_REQUIRED)]
147 147
             public Status $required;
148 148
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
         $input->expects($this->once())->method('hasOption')->willReturn(true);
167 167
         $input->expects($this->once())->method('getOption')->willReturn('foo');
168 168
 
169
-        $command = new #[AsCommand('foo')] class extends Command {
169
+        $command = new #[AsCommand('foo')] class extends Command{
170 170
             #[Option]
171 171
             public Status $status;
172 172
         };
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             ->expects($this->never())
189 189
             ->method('getOption');
190 190
 
191
-        $command = new #[AsCommand('foo')] class extends Command {
191
+        $command = new #[AsCommand('foo')] class extends Command{
192 192
             #[Option(mode: InputOption::VALUE_REQUIRED)]
193 193
             public int $option;
194 194
         };
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
             ->method('getOption')
213 213
             ->willReturn(null);
214 214
 
215
-        $command = new #[AsCommand('foo')] class extends Command {
215
+        $command = new #[AsCommand('foo')] class extends Command{
216 216
             #[Option(mode: InputOption::VALUE_REQUIRED)]
217 217
             public int $option;
218 218
         };
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             ->method('getOption')
236 236
             ->willReturn(null);
237 237
 
238
-        $command = new #[AsCommand('foo')] class extends Command {
238
+        $command = new #[AsCommand('foo')] class extends Command{
239 239
             #[Option(mode: InputOption::VALUE_REQUIRED)]
240 240
             public ?int $intVal = null;
241 241
         };
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@  discard block
 block discarded – undo
37 37
             ->method('getArgument')
38 38
             ->willReturnOnConsecutiveCalls(5, 'foo', ['foo', 'bar'], 0.5, true);
39 39
 
40
-        $command = new #[AsCommand('foo')] class extends Command {
40
+        $command = new #[AsCommand('foo')] class extends Command
41
+        {
41 42
             #[Argument]
42 43
             public int $intVal;
43 44
 
@@ -76,7 +77,8 @@  discard block
 block discarded – undo
76 77
             ->expects($this->never())
77 78
             ->method('getArgument');
78 79
 
79
-        $command = new #[AsCommand('foo')] class extends Command {
80
+        $command = new #[AsCommand('foo')] class extends Command
81
+        {
80 82
             #[Argument]
81 83
             public int $arg;
82 84
         };
@@ -99,7 +101,8 @@  discard block
 block discarded – undo
99 101
             ->method('getOption')
100 102
             ->willReturnOnConsecutiveCalls(5, 'foo', ['foo', 'bar'], 0.5, true, true);
101 103
 
102
-        $command = new #[AsCommand('foo')] class extends Command {
104
+        $command = new #[AsCommand('foo')] class extends Command
105
+        {
103 106
             #[Option(mode: InputOption::VALUE_REQUIRED)]
104 107
             public int $intVal;
105 108
 
@@ -142,7 +145,8 @@  discard block
 block discarded – undo
142 145
             ->method('getOption')
143 146
             ->willReturnOnConsecutiveCalls(1, null, 0);
144 147
 
145
-        $command = new #[AsCommand('foo')] class extends Command {
148
+        $command = new #[AsCommand('foo')] class extends Command
149
+        {
146 150
             #[Option(mode: InputOption::VALUE_REQUIRED)]
147 151
             public Status $required;
148 152
 
@@ -166,7 +170,8 @@  discard block
 block discarded – undo
166 170
         $input->expects($this->once())->method('hasOption')->willReturn(true);
167 171
         $input->expects($this->once())->method('getOption')->willReturn('foo');
168 172
 
169
-        $command = new #[AsCommand('foo')] class extends Command {
173
+        $command = new #[AsCommand('foo')] class extends Command
174
+        {
170 175
             #[Option]
171 176
             public Status $status;
172 177
         };
@@ -188,7 +193,8 @@  discard block
 block discarded – undo
188 193
             ->expects($this->never())
189 194
             ->method('getOption');
190 195
 
191
-        $command = new #[AsCommand('foo')] class extends Command {
196
+        $command = new #[AsCommand('foo')] class extends Command
197
+        {
192 198
             #[Option(mode: InputOption::VALUE_REQUIRED)]
193 199
             public int $option;
194 200
         };
@@ -212,7 +218,8 @@  discard block
 block discarded – undo
212 218
             ->method('getOption')
213 219
             ->willReturn(null);
214 220
 
215
-        $command = new #[AsCommand('foo')] class extends Command {
221
+        $command = new #[AsCommand('foo')] class extends Command
222
+        {
216 223
             #[Option(mode: InputOption::VALUE_REQUIRED)]
217 224
             public int $option;
218 225
         };
@@ -235,7 +242,8 @@  discard block
 block discarded – undo
235 242
             ->method('getOption')
236 243
             ->willReturn(null);
237 244
 
238
-        $command = new #[AsCommand('foo')] class extends Command {
245
+        $command = new #[AsCommand('foo')] class extends Command
246
+        {
239 247
             #[Option(mode: InputOption::VALUE_REQUIRED)]
240 248
             public ?int $intVal = null;
241 249
         };
Please login to merge, or discard this patch.