Passed
Pull Request — master (#1184)
by Abdul Malik
10:30
created
src/Console/src/Command.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,13 +83,15 @@  discard block
 block discarded – undo
83 83
      */
84 84
     protected function execute(InputInterface $input, OutputInterface $output): int
85 85
     {
86
-        if ($this->container === null) {
86
+        if ($this->container === null)
87
+        {
87 88
             throw new ScopeException('Container is not set');
88 89
         }
89 90
 
90 91
         $method = method_exists($this, 'perform') ? 'perform' : '__invoke';
91 92
 
92
-        try {
93
+        try
94
+        {
93 95
             [$this->input, $this->output] = [$this->prepareInput($input), $this->prepareOutput($input, $output)];
94 96
 
95 97
             $this->eventDispatcher?->dispatch(new CommandStarting($this, $this->input, $this->output));
@@ -122,7 +124,9 @@  discard block
 block discarded – undo
122 124
             $this->eventDispatcher?->dispatch(new CommandFinished($this, $code, $this->input, $this->output));
123 125
 
124 126
             return $code;
125
-        } finally {
127
+        }
128
+        finally
129
+        {
126 130
             [$this->input, $this->output] = [null, null];
127 131
         }
128 132
     }
Please login to merge, or discard this patch.
src/Router/src/Router.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
         private readonly ContainerInterface $container,
53 53
         private readonly ?EventDispatcherInterface $eventDispatcher = null,
54 54
         ?TracerInterface $tracer = null,
55
-    ) {
55
+    ){
56 56
         $this->tracer = $tracer ?? new NullTracer();
57
-        $this->basePath = '/' . \ltrim($basePath, '/');
57
+        $this->basePath = '/'.\ltrim($basePath, '/');
58 58
     }
59 59
 
60 60
     /**
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
         return $this->tracer->trace(
69 69
             name: 'Routing',
70 70
             callback: function (SpanInterface $span) use ($request): \Psr\Http\Message\ResponseInterface {
71
-                try {
71
+                try{
72 72
                     $route = $this->matchRoute($request, $routeName);
73
-                } catch (RouteException $e) {
73
+                }catch (RouteException $e){
74 74
                     throw new RouterException('Invalid route definition', $e->getCode(), $e);
75 75
                 }
76 76
 
77
-                if ($route === null) {
77
+                if ($route === null){
78 78
                     $this->eventDispatcher?->dispatch(new RouteNotFound($request));
79 79
                     throw new RouteNotFoundException($request->getUri());
80 80
                 }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     public function getRoute(string $name): RouteInterface
111 111
     {
112
-        if (isset($this->routes[$name])) {
112
+        if (isset($this->routes[$name])){
113 113
             return $this->routes[$name];
114 114
         }
115 115
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
     public function getRoutes(): array
120 120
     {
121
-        if (!empty($this->default)) {
121
+        if (!empty($this->default)){
122 122
             return $this->routes + [null => $this->default];
123 123
         }
124 124
 
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 
128 128
     public function uri(string $route, iterable $parameters = []): UriInterface
129 129
     {
130
-        try {
130
+        try{
131 131
             return $this->getRoute($route)->uri($parameters);
132
-        } catch (UndefinedRouteException) {
132
+        }catch (UndefinedRouteException){
133 133
             //In some cases route name can be provided as controller:action pair, we can try to
134 134
             //generate such route automatically based on our default/fallback route
135 135
             return $this->castRoute($route)->uri($parameters);
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
         /** @var GroupRegistry $groups */
142 142
         $groups = $this->container->get(GroupRegistry::class);
143 143
 
144
-        foreach ($routes->getCollection() as $name => $configurator) {
144
+        foreach ($routes->getCollection() as $name => $configurator){
145 145
             $target = $configurator->target;
146
-            if ($configurator->core !== null && $target instanceof AbstractTarget) {
146
+            if ($configurator->core !== null && $target instanceof AbstractTarget){
147 147
                 $target = $target->withCore($configurator->core);
148 148
             }
149 149
 
@@ -152,21 +152,21 @@  discard block
 block discarded – undo
152 152
                 : \ltrim($configurator->pattern, '/');
153 153
             $route = new Route($pattern, $target, $configurator->defaults);
154 154
 
155
-            if ($configurator->middleware !== null) {
155
+            if ($configurator->middleware !== null){
156 156
                 $route = $route->withMiddleware(...$configurator->middleware);
157 157
             }
158 158
 
159
-            if ($configurator->methods !== null) {
159
+            if ($configurator->methods !== null){
160 160
                 $route = $route->withVerbs(...$configurator->methods);
161 161
             }
162 162
 
163
-            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) {
163
+            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME){
164 164
                 $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup());
165 165
                 $group->setPrefix($configurator->prefix);
166 166
                 $group->addRoute($name, $route);
167 167
             }
168 168
 
169
-            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) {
169
+            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME){
170 170
                 $this->setDefault($route);
171 171
             }
172 172
         }
@@ -177,17 +177,17 @@  discard block
 block discarded – undo
177 177
      */
178 178
     protected function matchRoute(ServerRequestInterface $request, ?string &$routeName = null): ?RouteInterface
179 179
     {
180
-        foreach ($this->routes as $name => $route) {
180
+        foreach ($this->routes as $name => $route){
181 181
             // Matched route will return new route instance with matched parameters
182 182
             $matched = $route->match($request);
183 183
 
184
-            if ($matched !== null) {
184
+            if ($matched !== null){
185 185
                 $routeName = $name;
186 186
                 return $matched;
187 187
             }
188 188
         }
189 189
 
190
-        if ($this->default !== null) {
190
+        if ($this->default !== null){
191 191
             return $this->default->match($request);
192 192
         }
193 193
 
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
      */
201 201
     protected function configure(RouteInterface $route): RouteInterface
202 202
     {
203
-        if ($route instanceof ContainerizedInterface && !$route->hasContainer()) {
203
+        if ($route instanceof ContainerizedInterface && !$route->hasContainer()){
204 204
             // isolating route in a given container
205 205
             $route = $route->withContainer($this->container);
206 206
         }
207 207
 
208
-        try {
208
+        try{
209 209
             $uriHandler = $route->getUriHandler();
210
-        } catch (\Throwable) {
210
+        }catch (\Throwable){
211 211
             $uriHandler = $this->uriHandler;
212 212
         }
213 213
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 $route,
231 231
                 $matches
232 232
             )
233
-        ) {
233
+        ){
234 234
             throw new UndefinedRouteException(
235 235
                 "Unable to locate route or use default route with 'name/controller:action' pattern"
236 236
             );
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
         /**
240 240
          * @var Matches $matches
241 241
          */
242
-        if (!empty($matches['name'])) {
242
+        if (!empty($matches['name'])){
243 243
             $routeObject = $this->getRoute($matches['name']);
244
-        } elseif ($this->default !== null) {
244
+        } elseif ($this->default !== null){
245 245
             $routeObject = $this->default;
246
-        } else {
246
+        }else{
247 247
             throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route));
248 248
         }
249 249
 
Please login to merge, or discard this patch.
Braces   +49 added lines, -22 removed lines patch added patch discarded remove patch
@@ -68,13 +68,17 @@  discard block
 block discarded – undo
68 68
         return $this->tracer->trace(
69 69
             name: 'Routing',
70 70
             callback: function (SpanInterface $span) use ($request): \Psr\Http\Message\ResponseInterface {
71
-                try {
71
+                try
72
+                {
72 73
                     $route = $this->matchRoute($request, $routeName);
73
-                } catch (RouteException $e) {
74
+                }
75
+                catch (RouteException $e)
76
+                {
74 77
                     throw new RouterException('Invalid route definition', $e->getCode(), $e);
75 78
                 }
76 79
 
77
-                if ($route === null) {
80
+                if ($route === null)
81
+                {
78 82
                     $this->eventDispatcher?->dispatch(new RouteNotFound($request));
79 83
                     throw new RouteNotFoundException($request->getUri());
80 84
                 }
@@ -109,7 +113,8 @@  discard block
 block discarded – undo
109 113
 
110 114
     public function getRoute(string $name): RouteInterface
111 115
     {
112
-        if (isset($this->routes[$name])) {
116
+        if (isset($this->routes[$name]))
117
+        {
113 118
             return $this->routes[$name];
114 119
         }
115 120
 
@@ -118,7 +123,8 @@  discard block
 block discarded – undo
118 123
 
119 124
     public function getRoutes(): array
120 125
     {
121
-        if (!empty($this->default)) {
126
+        if (!empty($this->default))
127
+        {
122 128
             return $this->routes + [null => $this->default];
123 129
         }
124 130
 
@@ -127,9 +133,12 @@  discard block
 block discarded – undo
127 133
 
128 134
     public function uri(string $route, iterable $parameters = []): UriInterface
129 135
     {
130
-        try {
136
+        try
137
+        {
131 138
             return $this->getRoute($route)->uri($parameters);
132
-        } catch (UndefinedRouteException) {
139
+        }
140
+        catch (UndefinedRouteException)
141
+        {
133 142
             //In some cases route name can be provided as controller:action pair, we can try to
134 143
             //generate such route automatically based on our default/fallback route
135 144
             return $this->castRoute($route)->uri($parameters);
@@ -141,9 +150,11 @@  discard block
 block discarded – undo
141 150
         /** @var GroupRegistry $groups */
142 151
         $groups = $this->container->get(GroupRegistry::class);
143 152
 
144
-        foreach ($routes->getCollection() as $name => $configurator) {
153
+        foreach ($routes->getCollection() as $name => $configurator)
154
+        {
145 155
             $target = $configurator->target;
146
-            if ($configurator->core !== null && $target instanceof AbstractTarget) {
156
+            if ($configurator->core !== null && $target instanceof AbstractTarget)
157
+            {
147 158
                 $target = $target->withCore($configurator->core);
148 159
             }
149 160
 
@@ -152,21 +163,25 @@  discard block
 block discarded – undo
152 163
                 : \ltrim($configurator->pattern, '/');
153 164
             $route = new Route($pattern, $target, $configurator->defaults);
154 165
 
155
-            if ($configurator->middleware !== null) {
166
+            if ($configurator->middleware !== null)
167
+            {
156 168
                 $route = $route->withMiddleware(...$configurator->middleware);
157 169
             }
158 170
 
159
-            if ($configurator->methods !== null) {
171
+            if ($configurator->methods !== null)
172
+            {
160 173
                 $route = $route->withVerbs(...$configurator->methods);
161 174
             }
162 175
 
163
-            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME) {
176
+            if (!isset($this->routes[$name]) && $name !== RoutingConfigurator::DEFAULT_ROUTE_NAME)
177
+            {
164 178
                 $group = $groups->getGroup($configurator->group ?? $groups->getDefaultGroup());
165 179
                 $group->setPrefix($configurator->prefix);
166 180
                 $group->addRoute($name, $route);
167 181
             }
168 182
 
169
-            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME) {
183
+            if ($name === RoutingConfigurator::DEFAULT_ROUTE_NAME)
184
+            {
170 185
                 $this->setDefault($route);
171 186
             }
172 187
         }
@@ -177,17 +192,20 @@  discard block
 block discarded – undo
177 192
      */
178 193
     protected function matchRoute(ServerRequestInterface $request, ?string &$routeName = null): ?RouteInterface
179 194
     {
180
-        foreach ($this->routes as $name => $route) {
195
+        foreach ($this->routes as $name => $route)
196
+        {
181 197
             // Matched route will return new route instance with matched parameters
182 198
             $matched = $route->match($request);
183 199
 
184
-            if ($matched !== null) {
200
+            if ($matched !== null)
201
+            {
185 202
                 $routeName = $name;
186 203
                 return $matched;
187 204
             }
188 205
         }
189 206
 
190
-        if ($this->default !== null) {
207
+        if ($this->default !== null)
208
+        {
191 209
             return $this->default->match($request);
192 210
         }
193 211
 
@@ -200,14 +218,18 @@  discard block
 block discarded – undo
200 218
      */
201 219
     protected function configure(RouteInterface $route): RouteInterface
202 220
     {
203
-        if ($route instanceof ContainerizedInterface && !$route->hasContainer()) {
221
+        if ($route instanceof ContainerizedInterface && !$route->hasContainer())
222
+        {
204 223
             // isolating route in a given container
205 224
             $route = $route->withContainer($this->container);
206 225
         }
207 226
 
208
-        try {
227
+        try
228
+        {
209 229
             $uriHandler = $route->getUriHandler();
210
-        } catch (\Throwable) {
230
+        }
231
+        catch (\Throwable)
232
+        {
211 233
             $uriHandler = $this->uriHandler;
212 234
         }
213 235
 
@@ -239,11 +261,16 @@  discard block
 block discarded – undo
239 261
         /**
240 262
          * @var Matches $matches
241 263
          */
242
-        if (!empty($matches['name'])) {
264
+        if (!empty($matches['name']))
265
+        {
243 266
             $routeObject = $this->getRoute($matches['name']);
244
-        } elseif ($this->default !== null) {
267
+        }
268
+        elseif ($this->default !== null)
269
+        {
245 270
             $routeObject = $this->default;
246
-        } else {
271
+        }
272
+        else
273
+        {
247 274
             throw new UndefinedRouteException(\sprintf('Unable to locate route candidate for `%s`', $route));
248 275
         }
249 276
 
Please login to merge, or discard this patch.
src/SendIt/tests/JobTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,13 +57,13 @@
 block discarded – undo
57 57
 
58 58
         $this->mailer->expects('send')->with($email)->andThrow(new TransportException('failed'));
59 59
 
60
-        try {
60
+        try{
61 61
             $this->getHandler()->handle(
62 62
                 MailQueue::JOB_NAME,
63 63
                 'id',
64 64
                 json_encode(MessageSerializer::pack($this->getMail()))
65 65
             );
66
-        } catch (TransportException) {
66
+        }catch (TransportException){
67 67
         }
68 68
     }
69 69
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,13 +57,16 @@
 block discarded – undo
57 57
 
58 58
         $this->mailer->expects('send')->with($email)->andThrow(new TransportException('failed'));
59 59
 
60
-        try {
60
+        try
61
+        {
61 62
             $this->getHandler()->handle(
62 63
                 MailQueue::JOB_NAME,
63 64
                 'id',
64 65
                 json_encode(MessageSerializer::pack($this->getMail()))
65 66
             );
66
-        } catch (TransportException) {
67
+        }
68
+        catch (TransportException)
69
+        {
67 70
         }
68 71
     }
69 72
 
Please login to merge, or discard this patch.
src/Storage/src/Bootloader/StorageBootloader.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function __construct(
32 32
         private readonly ConfiguratorInterface $config
33
-    ) {
33
+    ){
34 34
     }
35 35
 
36 36
     public function init(BinderInterface $binder, EnvironmentInterface $env): void
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
             $distributions = $config->getDistributions();
52 52
 
53
-            foreach ($config->getAdapters() as $name => $adapter) {
53
+            foreach ($config->getAdapters() as $name => $adapter){
54 54
                 $resolver = null;
55 55
 
56
-                if (isset($distributions[$name])) {
57
-                    try {
56
+                if (isset($distributions[$name])){
57
+                    try{
58 58
                         $cdn = $factory->make(CdnInterface::class);
59
-                    } catch (NotFoundException $e) {
59
+                    }catch (NotFoundException $e){
60 60
                         $message = 'Unable to create distribution for bucket "%s". '
61 61
                             . 'Please make sure that bootloader %s is added in your application';
62 62
                         $message = \sprintf($message, $name, DistributionBootloader::class);
Please login to merge, or discard this patch.
src/Http/tests/HttpTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  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
             echo 'hello!';
94 94
 
95 95
             return $resp->withAddedHeader('hello', 'value');
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     {
106 106
         $core = $this->getCore();
107 107
 
108
-        $core->setHandler(function ($req, $resp) {
108
+        $core->setHandler(function ($req, $resp){
109 109
             echo 'hello!';
110 110
             $resp->getBody()->write('world ');
111 111
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $dispatcher
233 233
             ->expects(self::exactly(2))
234 234
             ->method('dispatch')
235
-            ->with($this->callback(static fn(RequestReceived|RequestHandled $event): bool => true));
235
+            ->with($this->callback(static fn(RequestReceived | RequestHandled $event): bool => true));
236 236
         $this->container->bind(EventDispatcherInterface::class, $dispatcher);
237 237
 
238 238
         $core = $this->getCore();
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                 TraceKind::SERVER,
290 290
             )
291 291
             ->willReturnCallback(
292
-                function ($name, $callback, $attributes, $scoped, $traceKind) {
292
+                function ($name, $callback, $attributes, $scoped, $traceKind){
293 293
                     self::assertSame($attributes, [
294 294
                         'http.method' => 'GET',
295 295
                         'http.url' => 'http://example.org/path',
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 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
 
@@ -289,7 +291,8 @@  discard block
 block discarded – undo
289 291
                 TraceKind::SERVER,
290 292
             )
291 293
             ->willReturnCallback(
292
-                function ($name, $callback, $attributes, $scoped, $traceKind) {
294
+                function ($name, $callback, $attributes, $scoped, $traceKind)
295
+                {
293 296
                     self::assertSame($attributes, [
294 297
                         'http.method' => 'GET',
295 298
                         'http.url' => 'http://example.org/path',
Please login to merge, or discard this patch.
src/Cookies/tests/CookiesTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -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());
@@ -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   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,8 @@
 block discarded – undo
273 273
     {
274 274
         $result = [];
275 275
 
276
-        foreach ($response->getHeaders() as $line) {
276
+        foreach ($response->getHeaders() as $line)
277
+        {
277 278
             $cookie = explode('=', implode('', $line));
278 279
             $result[$cookie[0]] = rawurldecode(substr(
279 280
                 $cookie[1],
Please login to merge, or discard this patch.
src/Distribution/src/Bootloader/DistributionBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
         $binder->bindSingleton(DistributionInterface::class, static function (DistributionConfig $config): \Spiral\Distribution\Manager {
47 47
             $manager = new Manager($config->getDefaultDriver());
48 48
 
49
-            foreach ($config->getResolvers() as $name => $resolver) {
49
+            foreach ($config->getResolvers() as $name => $resolver){
50 50
                 $manager->add($name, $resolver);
51 51
             }
52 52
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,8 @@
 block discarded – undo
46 46
         $binder->bindSingleton(DistributionInterface::class, static function (DistributionConfig $config): \Spiral\Distribution\Manager {
47 47
             $manager = new Manager($config->getDefaultDriver());
48 48
 
49
-            foreach ($config->getResolvers() as $name => $resolver) {
49
+            foreach ($config->getResolvers() as $name => $resolver)
50
+            {
50 51
                 $manager->add($name, $resolver);
51 52
             }
52 53
 
Please login to merge, or discard this patch.
src/Core/tests/Scope/FibersTest.php 1 patch
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,8 @@  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 68
             self::assertSame(self::TEST_DATA, $suspendValue);
68 69
         }
69 70
     }
@@ -81,7 +82,8 @@  discard block
 block discarded – undo
81 82
         );
82 83
 
83 84
         self::assertCount(2, $result);
84
-        foreach ($result as $suspendValue) {
85
+        foreach ($result as $suspendValue)
86
+        {
85 87
             self::assertSame(self::TEST_DATA, $suspendValue);
86 88
         }
87 89
     }
@@ -114,9 +116,12 @@  discard block
 block discarded – undo
114 116
                     $result = '';
115 117
                     $result .= Fiber::suspend('foo');
116 118
                     $result .= Fiber::suspend('bar');
117
-                    try {
119
+                    try
120
+                    {
118 121
                         $result .= Fiber::suspend('error');
119
-                    } catch (\Throwable $e) {
122
+                    }
123
+                    catch (\Throwable $e)
124
+                    {
120 125
                         $result .= $e->getMessage();
121 126
                     }
122 127
                     return $result . Fiber::suspend('baz');
@@ -150,7 +155,8 @@  discard block
 block discarded – undo
150 155
             $c1 = $container ?? new Container();
151 156
             $c1->bindSingleton('resource', new stdClass());
152 157
 
153
-            $result = $c1->runScoped(static function (Container $c2) use ($load) {
158
+            $result = $c1->runScoped(static function (Container $c2) use ($load)
159
+            {
154 160
                 // check local binding
155 161
                 self::assertTrue($c2->has('foo'));
156 162
                 self::assertInstanceOf(DateTime::class, $c2->get('foo'));
@@ -163,7 +169,8 @@  discard block
 block discarded – undo
163 169
                         $resource = $c3->get('resource');
164 170
                         self::assertInstanceOf(DateTimeImmutable::class, $c3->get('bar'));
165 171
                         self::assertInstanceOf(stdClass::class, $resource);
166
-                        foreach (self::TEST_DATA as $key => $value) {
172
+                        foreach (self::TEST_DATA as $key => $value)
173
+                        {
167 174
                             $resource->$key = $value;
168 175
                             $load === null or $load();
169 176
                             Fiber::suspend($value);
Please login to merge, or discard this patch.
src/Core/tests/ScopesTest.php 2 patches
Spacing   +4 added lines, -4 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, static function (): never {
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);
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
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) {
93
+        }catch (\Throwable){
94 94
         }
95 95
 
96 96
         $this->assertSame('a', $c->get('bucket')->getName());
Please login to merge, or discard this patch.
Braces   +13 added lines, -5 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, static function (): never {
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);
@@ -83,14 +86,17 @@  discard block
 block discarded – undo
83 86
             return $c->get('bucket')->getName() == 'b' && $c->has('other');
84 87
         }));
85 88
 
86
-        try {
89
+        try
90
+        {
87 91
             $this->assertTrue($c->runScope([
88 92
                 'bucket' => new Bucket('b'),
89 93
                 'other'  => new SampleClass()
90 94
             ], function () use ($c): void {
91 95
                 throw new RuntimeException('exception');
92 96
             }));
93
-        } catch (\Throwable) {
97
+        }
98
+        catch (\Throwable)
99
+        {
94 100
         }
95 101
 
96 102
         $this->assertSame('a', $c->get('bucket')->getName());
@@ -138,7 +144,9 @@  discard block
 block discarded – undo
138 144
     public function testHasInstanceAfterMakeWithoutAliasInScope(): void
139 145
     {
140 146
         $container = new Container();
141
-        $container->bindSingleton('test', new #[Singleton] class {});
147
+        $container->bindSingleton('test', new #[Singleton] class
148
+        {
149
+});
142 150
         $container->make('test');
143 151
 
144 152
         $container->runScoped(function (Container $container): void {
Please login to merge, or discard this patch.