Passed
Push — master ( 37e009...cfbad5 )
by Aleksei
21:07 queued 10:08
created
src/Queue/tests/Interceptor/Push/CoreTest.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@  discard block
 block discarded – undo
24 24
             $queue = m::mock(QueueInterface::class)
25 25
         );
26 26
 
27
-        if (!\is_array($payload)) {
27
+        if (!\is_array($payload))
28
+        {
28 29
             $this->markTestIncomplete('QueueInterface does not support non-array payloads');
29 30
             return;
30 31
         }
@@ -46,7 +47,8 @@  discard block
 block discarded – undo
46 47
             $queue = m::mock(QueueInterface::class)
47 48
         );
48 49
 
49
-        if (!\is_array($payload)) {
50
+        if (!\is_array($payload))
51
+        {
50 52
             $this->markTestIncomplete('QueueInterface does not support non-array payloads');
51 53
             return;
52 54
         }
@@ -81,7 +83,8 @@  discard block
 block discarded – undo
81 83
                 && $payload === ['baz' => 'baf']
82 84
                 && $options->getHeader('foo') === ['bar']);
83 85
 
84
-        ContainerScope::runScope($container, function() use($core) {
86
+        ContainerScope::runScope($container, function() use($core)
87
+        {
85 88
             $core->callAction('foo', 'bar', [
86 89
                 'id' => 'job-id',
87 90
                 'payload' => ['baz' => 'baf'],
Please login to merge, or discard this patch.
src/Http/tests/HttpTest.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,7 +89,8 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $core = $this->getCore();
91 91
 
92
-        $core->setHandler(function ($req, $resp) {
92
+        $core->setHandler(function ($req, $resp)
93
+        {
93 94
             echo 'hello!';
94 95
 
95 96
             return $resp->withAddedHeader('hello', 'value');
@@ -105,7 +106,8 @@  discard block
 block discarded – undo
105 106
     {
106 107
         $core = $this->getCore();
107 108
 
108
-        $core->setHandler(function ($req, $resp) {
109
+        $core->setHandler(function ($req, $resp)
110
+        {
109 111
             echo 'hello!';
110 112
             $resp->getBody()->write('world ');
111 113
 
@@ -122,7 +124,8 @@  discard block
 block discarded – undo
122 124
     {
123 125
         $core = $this->getCore();
124 126
 
125
-        $core->setHandler(function () {
127
+        $core->setHandler(function ()
128
+        {
126 129
             ob_start();
127 130
             ob_start();
128 131
             echo 'hello!';
@@ -289,7 +292,8 @@  discard block
 block discarded – undo
289 292
                 TraceKind::SERVER,
290 293
             )
291 294
             ->willReturnCallback(
292
-                function ($name, $callback, $attributes, $scoped, $traceKind) {
295
+                function ($name, $callback, $attributes, $scoped, $traceKind)
296
+                {
293 297
                     self::assertSame($attributes, [
294 298
                         'http.method' => 'GET',
295 299
                         'http.url' => 'http://example.org/path',
Please login to merge, or discard this patch.
src/Http/tests/PipelineTest.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,7 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
     public function testMiddlewareProcessingEventShouldBeDispatched(): void
62 62
     {
63
-        $middleware = new class implements MiddlewareInterface {
63
+        $middleware = new class implements MiddlewareInterface
64
+        {
64 65
             public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
65 66
             {
66 67
                 return (new ResponseFactory(new HttpConfig(['headers' => []])))->createResponse(200);
@@ -89,7 +90,8 @@  discard block
 block discarded – undo
89 90
         $this->container->getBinder('http')
90 91
             ->bind(ServerRequestInterface::class, static fn(CurrentRequest $cr) => $cr->get());
91 92
 
92
-        $middleware = new class implements MiddlewareInterface {
93
+        $middleware = new class implements MiddlewareInterface
94
+        {
93 95
             public function process(
94 96
                 ServerRequestInterface $request,
95 97
                 RequestHandlerInterface $handler,
@@ -107,7 +109,8 @@  discard block
 block discarded – undo
107 109
 
108 110
         $this->container->runScope(
109 111
             new \Spiral\Core\Scope(name: 'http'),
110
-            function (ScopeInterface $c) use ($middleware) {
112
+            function (ScopeInterface $c) use ($middleware)
113
+            {
111 114
                 $request = new ServerRequest('GET', '');
112 115
                 $handler = new CallableHandler(fn() => 'response', new ResponseFactory(new HttpConfig(['headers' => []])));
113 116
 
Please login to merge, or discard this patch.
src/Scaffolder/tests/Command/AbstractCommandTestCase.php 1 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 1 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/Cookies/tests/CookiesTest.php 1 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/FibersTest.php 1 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 1 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/Core/tests/SingletonsTest.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -181,7 +181,9 @@  discard block
 block discarded – undo
181 181
     public function testHasShouldReturnTrueWhenSingletonIsAlreadyConstructed(): void
182 182
     {
183 183
         $container = new Container();
184
-        $class = new #[Singleton] class {};
184
+        $class = new #[Singleton] class
185
+        {
186
+};
185 187
 
186 188
         $this->assertFalse($container->has($class::class));
187 189
 
@@ -194,7 +196,8 @@  discard block
 block discarded – undo
194 196
     {
195 197
         return new
196 198
         #[Singleton]
197
-        class {
199
+        class
200
+        {
198 201
             public string $baz = 'baz';
199 202
         };
200 203
     }
Please login to merge, or discard this patch.