Passed
Push — master ( 41e710...91ffae )
by Aleksei
06:19 queued 21s
created
src/Core/tests/ExceptionsTest.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
                 context: Parameter #1 [ <required> Spiral\Tests\Core\Fixtures\InvalidClass $class ]
209 209
             MARKDOWN;
210 210
 
211
-        try {
211
+        try{
212 212
             $container->get(InvalidWithContainerInside::class);
213 213
             self::fail('Exception `ContainerException` expected');
214
-        } catch (ContainerException $e) {
214
+        }catch (ContainerException $e){
215 215
             self::assertSame($expectedMessage, $e->getMessage());
216 216
         }
217 217
     }
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $container = new Container();
236 236
 
237
-        try {
237
+        try{
238 238
             $container->get('invalid');
239
-        } catch (ContainerException $e) {
239
+        }catch (ContainerException $e){
240 240
             self::assertSame(<<<MARKDOWN
241 241
                 Can't autowire `invalid`: class or injector not found.
242 242
                 Resolving trace:
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
     {
268 268
         $this->expectException(ContainerException::class);
269 269
 
270
-        try {
270
+        try{
271 271
             $container->get(ClassWithUndefinedDependency::class);
272
-        } catch (ContainerException $e) {
272
+        }catch (ContainerException $e){
273 273
             self::assertSame($message, $e->getMessage());
274 274
 
275 275
             throw $e;
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -208,10 +208,13 @@  discard block
 block discarded – undo
208 208
                 context: Parameter #1 [ <required> Spiral\Tests\Core\Fixtures\InvalidClass $class ]
209 209
             MARKDOWN;
210 210
 
211
-        try {
211
+        try
212
+        {
212 213
             $container->get(InvalidWithContainerInside::class);
213 214
             self::fail('Exception `ContainerException` expected');
214
-        } catch (ContainerException $e) {
215
+        }
216
+        catch (ContainerException $e)
217
+        {
215 218
             self::assertSame($expectedMessage, $e->getMessage());
216 219
         }
217 220
     }
@@ -234,9 +237,12 @@  discard block
 block discarded – undo
234 237
     {
235 238
         $container = new Container();
236 239
 
237
-        try {
240
+        try
241
+        {
238 242
             $container->get('invalid');
239
-        } catch (ContainerException $e) {
243
+        }
244
+        catch (ContainerException $e)
245
+        {
240 246
             self::assertSame(<<<MARKDOWN
241 247
                 Can't autowire `invalid`: class or injector not found.
242 248
                 Resolving trace:
@@ -267,9 +273,12 @@  discard block
 block discarded – undo
267 273
     {
268 274
         $this->expectException(ContainerException::class);
269 275
 
270
-        try {
276
+        try
277
+        {
271 278
             $container->get(ClassWithUndefinedDependency::class);
272
-        } catch (ContainerException $e) {
279
+        }
280
+        catch (ContainerException $e)
281
+        {
273 282
             self::assertSame($message, $e->getMessage());
274 283
 
275 284
             throw $e;
Please login to merge, or discard this patch.
src/Core/tests/Scope/ScopeAttributeTest.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         $root = self::makeContainer();
168 168
 
169
-        try {
169
+        try{
170 170
             $root->runScoped(static function (Container $c1): void {
171 171
                 $c1->runScoped(static function (Container $c2): void {
172 172
                     $c2->runScoped(static function (Container $c3): void {
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
                     }, name: 'root');
175 175
                 });
176 176
             });
177
-        } catch (NamedScopeDuplicationException $e) {
177
+        }catch (NamedScopeDuplicationException $e){
178 178
             self::assertSame('root', $e->getScope());
179 179
             throw $e;
180 180
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     #[Group('scrutinizer-ignore')]
188 188
     public function testBadScopeException(): void
189 189
     {
190
-        try {
190
+        try{
191 191
             $root = self::makeContainer();
192 192
             $root->runScoped(static function (Container $c1): void {
193 193
                 $c1->runScoped(static function (Container $c2): void {
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
                 });
196 196
             }, name: 'bar');
197 197
 
198
-            self::fail(BadScopeException::class . ' should be thrown');
199
-        } catch (BadScopeException $e) {
198
+            self::fail(BadScopeException::class.' should be thrown');
199
+        }catch (BadScopeException $e){
200 200
             self::assertSame('foo', $e->getScope());
201 201
         }
202 202
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -166,7 +166,8 @@  discard block
 block discarded – undo
166 166
 
167 167
         $root = self::makeContainer();
168 168
 
169
-        try {
169
+        try
170
+        {
170 171
             $root->runScoped(static function (Container $c1): void {
171 172
                 $c1->runScoped(static function (Container $c2): void {
172 173
                     $c2->runScoped(static function (Container $c3): void {
@@ -174,7 +175,9 @@  discard block
 block discarded – undo
174 175
                     }, name: 'root');
175 176
                 });
176 177
             });
177
-        } catch (NamedScopeDuplicationException $e) {
178
+        }
179
+        catch (NamedScopeDuplicationException $e)
180
+        {
178 181
             self::assertSame('root', $e->getScope());
179 182
             throw $e;
180 183
         }
@@ -187,7 +190,8 @@  discard block
 block discarded – undo
187 190
     #[Group('scrutinizer-ignore')]
188 191
     public function testBadScopeException(): void
189 192
     {
190
-        try {
193
+        try
194
+        {
191 195
             $root = self::makeContainer();
192 196
             $root->runScoped(static function (Container $c1): void {
193 197
                 $c1->runScoped(static function (Container $c2): void {
@@ -196,7 +200,9 @@  discard block
 block discarded – undo
196 200
             }, name: 'bar');
197 201
 
198 202
             self::fail(BadScopeException::class . ' should be thrown');
199
-        } catch (BadScopeException $e) {
203
+        }
204
+        catch (BadScopeException $e)
205
+        {
200 206
             self::assertSame('foo', $e->getScope());
201 207
         }
202 208
     }
Please login to merge, or discard this patch.
src/Core/tests/Fixtures/PrivateConstructor.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 final class PrivateConstructor
8 8
 {
9
-    private function __construct() {}
9
+    private function __construct(){}
10 10
 
11 11
     private static function privateMethod(int $result): int
12 12
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@
 block discarded – undo
6 6
 
7 7
 final class PrivateConstructor
8 8
 {
9
-    private function __construct() {}
9
+    private function __construct()
10
+    {
11
+}
10 12
 
11 13
     private static function privateMethod(int $result): int
12 14
     {
Please login to merge, or discard this patch.
src/Core/src/Internal/Scope.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function __construct(
19 19
         private readonly ?string $scopeName = null,
20
-    ) {}
20
+    ){}
21 21
 
22 22
     public function getScopeName(): ?string
23 23
     {
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
         $this->parentActor = $actor;
40 40
 
41 41
         // Check a scope with the same name is not already registered
42
-        if ($this->scopeName !== null) {
42
+        if ($this->scopeName !== null){
43 43
             $tmp = $this;
44
-            while ($tmp->parentScope !== null) {
44
+            while ($tmp->parentScope !== null){
45 45
                 $tmp = $tmp->parentScope;
46 46
                 $tmp->scopeName !== $this->scopeName ?: throw new NamedScopeDuplicationException($this->scopeName);
47 47
             }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $result = [$this->scopeName];
65 65
 
66 66
         $parent = $this;
67
-        while ($parent->parentScope !== null) {
67
+        while ($parent->parentScope !== null){
68 68
             $parent = $parent->parentScope;
69 69
             $result[] = $parent->scopeName;
70 70
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function __construct(
19 19
         private readonly ?string $scopeName = null,
20
-    ) {}
20
+    ) {
21
+}
21 22
 
22 23
     public function getScopeName(): ?string
23 24
     {
@@ -39,9 +40,11 @@  discard block
 block discarded – undo
39 40
         $this->parentActor = $actor;
40 41
 
41 42
         // Check a scope with the same name is not already registered
42
-        if ($this->scopeName !== null) {
43
+        if ($this->scopeName !== null)
44
+        {
43 45
             $tmp = $this;
44
-            while ($tmp->parentScope !== null) {
46
+            while ($tmp->parentScope !== null)
47
+            {
45 48
                 $tmp = $tmp->parentScope;
46 49
                 $tmp->scopeName !== $this->scopeName ?: throw new NamedScopeDuplicationException($this->scopeName);
47 50
             }
@@ -64,7 +67,8 @@  discard block
 block discarded – undo
64 67
         $result = [$this->scopeName];
65 68
 
66 69
         $parent = $this;
67
-        while ($parent->parentScope !== null) {
70
+        while ($parent->parentScope !== null)
71
+        {
68 72
             $parent = $parent->parentScope;
69 73
             $result[] = $parent->scopeName;
70 74
         }
Please login to merge, or discard this patch.
src/Core/src/Internal/Tracer.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
     public function push(bool $nextLevel, mixed ...$details): void
35 35
     {
36 36
         $trace = $details === [] ? null : new Trace($details);
37
-        if ($nextLevel || $this->traces === []) {
37
+        if ($nextLevel || $this->traces === []){
38 38
             $this->traces[] = $trace === null ? [] : [$trace];
39
-        } elseif ($trace !== null) {
39
+        } elseif ($trace !== null){
40 40
             $this->traces[\array_key_last($this->traces)][] = $trace;
41 41
         }
42 42
     }
43 43
 
44 44
     public function pop(bool $previousLevel = false): void
45 45
     {
46
-        if ($this->traces === []) {
46
+        if ($this->traces === []){
47 47
             return;
48 48
         }
49
-        if ($previousLevel) {
49
+        if ($previousLevel){
50 50
             \array_pop($this->traces);
51 51
             return;
52 52
         }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
     public function __toString(): string
64 64
     {
65
-        return $this->traces === [] ? '' : "Resolving trace:\n" . self::renderTraceList($this->traces);
65
+        return $this->traces === [] ? '' : "Resolving trace:\n".self::renderTraceList($this->traces);
66 66
     }
67 67
 
68 68
     /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $result = [];
74 74
         $i = 0;
75
-        foreach ($blocks as $block) {
75
+        foreach ($blocks as $block){
76 76
             \array_push($result, ...self::blockToStringList($block, $i++));
77 77
         }
78 78
         return \implode("\n", $result);
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
         // Separator
93 93
         $s = "\n";
94 94
         $nexPrefix = "$s$padding  ";
95
-        foreach ($items as $item) {
96
-            $result[] = $firstPrefix . \str_replace($s, $nexPrefix, (string) $item);
95
+        foreach ($items as $item){
96
+            $result[] = $firstPrefix.\str_replace($s, $nexPrefix, (string)$item);
97 97
         }
98 98
         return $result;
99 99
     }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,19 +34,24 @@  discard block
 block discarded – undo
34 34
     public function push(bool $nextLevel, mixed ...$details): void
35 35
     {
36 36
         $trace = $details === [] ? null : new Trace($details);
37
-        if ($nextLevel || $this->traces === []) {
37
+        if ($nextLevel || $this->traces === [])
38
+        {
38 39
             $this->traces[] = $trace === null ? [] : [$trace];
39
-        } elseif ($trace !== null) {
40
+        }
41
+        elseif ($trace !== null)
42
+        {
40 43
             $this->traces[\array_key_last($this->traces)][] = $trace;
41 44
         }
42 45
     }
43 46
 
44 47
     public function pop(bool $previousLevel = false): void
45 48
     {
46
-        if ($this->traces === []) {
49
+        if ($this->traces === [])
50
+        {
47 51
             return;
48 52
         }
49
-        if ($previousLevel) {
53
+        if ($previousLevel)
54
+        {
50 55
             \array_pop($this->traces);
51 56
             return;
52 57
         }
@@ -72,7 +77,8 @@  discard block
 block discarded – undo
72 77
     {
73 78
         $result = [];
74 79
         $i = 0;
75
-        foreach ($blocks as $block) {
80
+        foreach ($blocks as $block)
81
+        {
76 82
             \array_push($result, ...self::blockToStringList($block, $i++));
77 83
         }
78 84
         return \implode("\n", $result);
@@ -92,7 +98,8 @@  discard block
 block discarded – undo
92 98
         // Separator
93 99
         $s = "\n";
94 100
         $nexPrefix = "$s$padding  ";
95
-        foreach ($items as $item) {
101
+        foreach ($items as $item)
102
+        {
96 103
             $result[] = $firstPrefix . \str_replace($s, $nexPrefix, (string) $item);
97 104
         }
98 105
         return $result;
Please login to merge, or discard this patch.
src/Core/src/Container.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     public const DEFAULT_ROOT_SCOPE_NAME = 'root';
49 49
 
50 50
     private Internal\State $state;
51
-    private ResolverInterface|Internal\Resolver $resolver;
52
-    private FactoryInterface|Internal\Factory $factory;
53
-    private ContainerInterface|Internal\Container $container;
54
-    private BinderInterface|Internal\Binder $binder;
55
-    private InvokerInterface|Internal\Invoker $invoker;
51
+    private ResolverInterface | Internal\Resolver $resolver;
52
+    private FactoryInterface | Internal\Factory $factory;
53
+    private ContainerInterface | Internal\Container $container;
54
+    private BinderInterface | Internal\Binder $binder;
55
+    private InvokerInterface | Internal\Invoker $invoker;
56 56
     private Internal\Scope $scope;
57 57
     private Internal\Actor $actor;
58 58
 
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function __construct(
63 63
         private Config $config = new Config(),
64
-        string|\BackedEnum|null $scopeName = self::DEFAULT_ROOT_SCOPE_NAME,
64
+        string | \BackedEnum | null $scopeName = self::DEFAULT_ROOT_SCOPE_NAME,
65 65
         private Options $options = new Options(),
66
-    ) {
67
-        if (\is_object($scopeName)) {
68
-            $scopeName = (string) $scopeName->value;
66
+    ){
67
+        if (\is_object($scopeName)){
68
+            $scopeName = (string)$scopeName->value;
69 69
         }
70 70
 
71 71
         $this->initServices($this, $scopeName);
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
      * @throws \Throwable
107 107
      * @psalm-suppress TooManyArguments
108 108
      */
109
-    public function make(string $alias, array $parameters = [], \Stringable|string|null $context = null): mixed
109
+    public function make(string $alias, array $parameters = [], \Stringable | string | null $context = null): mixed
110 110
     {
111 111
         return ContainerScope::getContainer() === $this
112 112
             ? $this->factory->make($alias, $parameters, $context)
113
-            : ContainerScope::runScope($this, fn(): mixed => $this->factory->make($alias, $parameters, $context));
113
+            : ContainerScope::runScope($this, fn() : mixed => $this->factory->make($alias, $parameters, $context));
114 114
     }
115 115
 
116 116
     /**
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * @throws \Throwable
133 133
      * @psalm-suppress TooManyArguments
134 134
      */
135
-    public function get(string|Autowire $id, \Stringable|string|null $context = null): mixed
135
+    public function get(string | Autowire $id, \Stringable | string | null $context = null): mixed
136 136
     {
137 137
         return ContainerScope::getContainer() === $this
138 138
             ? $this->container->get($id, $context)
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
      *        If {@see string}, the default binder for the given scope will be returned. Default bindings won't affect
153 153
      *        already created Container instances except the case with the root one.
154 154
      */
155
-    public function getBinder(string|\BackedEnum|null $scope = null): BinderInterface
155
+    public function getBinder(string | \BackedEnum | null $scope = null): BinderInterface
156 156
     {
157
-        $scope = \is_object($scope) ? (string) $scope->value : $scope;
157
+        $scope = \is_object($scope) ? (string)$scope->value : $scope;
158 158
 
159 159
         return $scope === null
160 160
             ? $this->binder
@@ -164,25 +164,25 @@  discard block
 block discarded – undo
164 164
     /**
165 165
      * @throws \Throwable
166 166
      */
167
-    public function runScope(Scope|array $bindings, callable $scope): mixed
167
+    public function runScope(Scope | array $bindings, callable $scope): mixed
168 168
     {
169
-        if (!\is_array($bindings)) {
169
+        if (!\is_array($bindings)){
170 170
             return $this->runIsolatedScope($bindings, $scope);
171 171
         }
172 172
 
173 173
         $binds = &$this->state->bindings;
174 174
         $singletons = &$this->state->singletons;
175 175
         $cleanup = $previous = $prevSin = [];
176
-        foreach ($bindings as $alias => $resolver) {
176
+        foreach ($bindings as $alias => $resolver){
177 177
             // Store previous bindings
178
-            if (isset($binds[$alias])) {
178
+            if (isset($binds[$alias])){
179 179
                 $previous[$alias] = $binds[$alias];
180
-            } else {
180
+            }else{
181 181
                 // Store bindings to be removed
182 182
                 $cleanup[] = $alias;
183 183
             }
184 184
             // Store previous singletons
185
-            if (isset($singletons[$alias])) {
185
+            if (isset($singletons[$alias])){
186 186
                 $prevSin[$alias] = $singletons[$alias];
187 187
                 unset($singletons[$alias]);
188 188
             }
@@ -190,21 +190,21 @@  discard block
 block discarded – undo
190 190
             $this->binder->bind($alias, $resolver);
191 191
         }
192 192
 
193
-        try {
193
+        try{
194 194
             return ContainerScope::getContainer() !== $this
195 195
                 ? ContainerScope::runScope($this, $scope)
196 196
                 : $scope($this);
197
-        } finally {
197
+        }finally{
198 198
             // Remove new bindings
199
-            foreach ($cleanup as $alias) {
199
+            foreach ($cleanup as $alias){
200 200
                 unset($binds[$alias], $singletons[$alias]);
201 201
             }
202 202
             // Restore previous bindings
203
-            foreach ($previous as $alias => $resolver) {
203
+            foreach ($previous as $alias => $resolver){
204 204
                 $binds[$alias] = $resolver;
205 205
             }
206 206
             // Restore singletons
207
-            foreach ($prevSin as $alias => $instance) {
207
+            foreach ($prevSin as $alias => $instance){
208 208
                 $singletons[$alias] = $instance;
209 209
             }
210 210
         }
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
      *        If the value is null, option {@see Options::$allowSingletonsRebinding} will be used.
253 253
      * @throws SingletonOverloadException
254 254
      */
255
-    public function bindSingleton(string $alias, string|array|callable|object $resolver, ?bool $force = null): void
255
+    public function bindSingleton(string $alias, string | array | callable | object $resolver, ?bool $force = null): void
256 256
     {
257
-        if ($force ?? $this->options->allowSingletonsRebinding) {
257
+        if ($force ?? $this->options->allowSingletonsRebinding){
258 258
             $this->binder->removeBinding($alias);
259 259
         }
260 260
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     {
282 282
         return ContainerScope::getContainer() === $this
283 283
             ? $this->invoker->invoke($target, $parameters)
284
-            : ContainerScope::runScope($this, fn(): mixed => $this->invoker->invoke($target, $parameters));
284
+            : ContainerScope::runScope($this, fn() : mixed => $this->invoker->invoke($target, $parameters));
285 285
     }
286 286
 
287 287
     /**
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
         ], $this->options);
339 339
 
340 340
         // Create container services
341
-        foreach ($container->config as $property => $class) {
342
-            if (\property_exists($container, $property)) {
341
+        foreach ($container->config as $property => $class){
342
+            if (\property_exists($container, $property)){
343 343
                 $container->$property = $constructor->get($property, $class);
344 344
             }
345 345
         }
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
     private function closeScope(): void
354 354
     {
355 355
         /** @psalm-suppress RedundantPropertyInitializationCheck */
356
-        if (!isset($this->scope)) {
356
+        if (!isset($this->scope)){
357 357
             $this->destruct();
358 358
             return;
359 359
         }
@@ -362,10 +362,10 @@  discard block
 block discarded – undo
362 362
 
363 363
         // Run finalizers
364 364
         $errors = [];
365
-        foreach ($this->state->finalizers as $finalizer) {
366
-            try {
365
+        foreach ($this->state->finalizers as $finalizer){
366
+            try{
367 367
                 $this->invoker->invoke($finalizer);
368
-            } catch (\Throwable $e) {
368
+            }catch (\Throwable $e){
369 369
                 $errors[] = $e;
370 370
             }
371 371
         }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
         $this->destruct();
375 375
 
376 376
         // Throw collected errors
377
-        if ($errors !== []) {
377
+        if ($errors !== []){
378 378
             throw new FinalizersException($scopeName, $errors);
379 379
         }
380 380
     }
@@ -396,18 +396,18 @@  discard block
 block discarded – undo
396 396
         $container->scope->setParent($this, $this->scope, $this->actor);
397 397
 
398 398
         // Add specific bindings
399
-        foreach ($config->bindings as $alias => $resolver) {
399
+        foreach ($config->bindings as $alias => $resolver){
400 400
             $container->binder->bind($alias, $resolver);
401 401
         }
402 402
 
403 403
         return ContainerScope::runScope(
404 404
             $container,
405 405
             static function (self $container) use ($config, $closure): mixed {
406
-                try {
406
+                try{
407 407
                     return $config->autowire
408 408
                         ? $container->invoke($closure)
409 409
                         : $closure($container);
410
-                } finally {
410
+                }finally{
411 411
                     $container->closeScope();
412 412
                 }
413 413
             },
Please login to merge, or discard this patch.
Braces   +48 added lines, -22 removed lines patch added patch discarded remove patch
@@ -64,7 +64,8 @@  discard block
 block discarded – undo
64 64
         string|\BackedEnum|null $scopeName = self::DEFAULT_ROOT_SCOPE_NAME,
65 65
         private Options $options = new Options(),
66 66
     ) {
67
-        if (\is_object($scopeName)) {
67
+        if (\is_object($scopeName))
68
+        {
68 69
             $scopeName = (string) $scopeName->value;
69 70
         }
70 71
 
@@ -166,23 +167,29 @@  discard block
 block discarded – undo
166 167
      */
167 168
     public function runScope(Scope|array $bindings, callable $scope): mixed
168 169
     {
169
-        if (!\is_array($bindings)) {
170
+        if (!\is_array($bindings))
171
+        {
170 172
             return $this->runIsolatedScope($bindings, $scope);
171 173
         }
172 174
 
173 175
         $binds = &$this->state->bindings;
174 176
         $singletons = &$this->state->singletons;
175 177
         $cleanup = $previous = $prevSin = [];
176
-        foreach ($bindings as $alias => $resolver) {
178
+        foreach ($bindings as $alias => $resolver)
179
+        {
177 180
             // Store previous bindings
178
-            if (isset($binds[$alias])) {
181
+            if (isset($binds[$alias]))
182
+            {
179 183
                 $previous[$alias] = $binds[$alias];
180
-            } else {
184
+            }
185
+            else
186
+            {
181 187
                 // Store bindings to be removed
182 188
                 $cleanup[] = $alias;
183 189
             }
184 190
             // Store previous singletons
185
-            if (isset($singletons[$alias])) {
191
+            if (isset($singletons[$alias]))
192
+            {
186 193
                 $prevSin[$alias] = $singletons[$alias];
187 194
                 unset($singletons[$alias]);
188 195
             }
@@ -190,21 +197,27 @@  discard block
 block discarded – undo
190 197
             $this->binder->bind($alias, $resolver);
191 198
         }
192 199
 
193
-        try {
200
+        try
201
+        {
194 202
             return ContainerScope::getContainer() !== $this
195 203
                 ? ContainerScope::runScope($this, $scope)
196 204
                 : $scope($this);
197
-        } finally {
205
+        }
206
+        finally
207
+        {
198 208
             // Remove new bindings
199
-            foreach ($cleanup as $alias) {
209
+            foreach ($cleanup as $alias)
210
+            {
200 211
                 unset($binds[$alias], $singletons[$alias]);
201 212
             }
202 213
             // Restore previous bindings
203
-            foreach ($previous as $alias => $resolver) {
214
+            foreach ($previous as $alias => $resolver)
215
+            {
204 216
                 $binds[$alias] = $resolver;
205 217
             }
206 218
             // Restore singletons
207
-            foreach ($prevSin as $alias => $instance) {
219
+            foreach ($prevSin as $alias => $instance)
220
+            {
208 221
                 $singletons[$alias] = $instance;
209 222
             }
210 223
         }
@@ -254,7 +267,8 @@  discard block
 block discarded – undo
254 267
      */
255 268
     public function bindSingleton(string $alias, string|array|callable|object $resolver, ?bool $force = null): void
256 269
     {
257
-        if ($force ?? $this->options->allowSingletonsRebinding) {
270
+        if ($force ?? $this->options->allowSingletonsRebinding)
271
+        {
258 272
             $this->binder->removeBinding($alias);
259 273
         }
260 274
 
@@ -338,8 +352,10 @@  discard block
 block discarded – undo
338 352
         ], $this->options);
339 353
 
340 354
         // Create container services
341
-        foreach ($container->config as $property => $class) {
342
-            if (\property_exists($container, $property)) {
355
+        foreach ($container->config as $property => $class)
356
+        {
357
+            if (\property_exists($container, $property))
358
+            {
343 359
                 $container->$property = $constructor->get($property, $class);
344 360
             }
345 361
         }
@@ -353,7 +369,8 @@  discard block
 block discarded – undo
353 369
     private function closeScope(): void
354 370
     {
355 371
         /** @psalm-suppress RedundantPropertyInitializationCheck */
356
-        if (!isset($this->scope)) {
372
+        if (!isset($this->scope))
373
+        {
357 374
             $this->destruct();
358 375
             return;
359 376
         }
@@ -362,10 +379,14 @@  discard block
 block discarded – undo
362 379
 
363 380
         // Run finalizers
364 381
         $errors = [];
365
-        foreach ($this->state->finalizers as $finalizer) {
366
-            try {
382
+        foreach ($this->state->finalizers as $finalizer)
383
+        {
384
+            try
385
+            {
367 386
                 $this->invoker->invoke($finalizer);
368
-            } catch (\Throwable $e) {
387
+            }
388
+            catch (\Throwable $e)
389
+            {
369 390
                 $errors[] = $e;
370 391
             }
371 392
         }
@@ -374,7 +395,8 @@  discard block
 block discarded – undo
374 395
         $this->destruct();
375 396
 
376 397
         // Throw collected errors
377
-        if ($errors !== []) {
398
+        if ($errors !== [])
399
+        {
378 400
             throw new FinalizersException($scopeName, $errors);
379 401
         }
380 402
     }
@@ -396,18 +418,22 @@  discard block
 block discarded – undo
396 418
         $container->scope->setParent($this, $this->scope, $this->actor);
397 419
 
398 420
         // Add specific bindings
399
-        foreach ($config->bindings as $alias => $resolver) {
421
+        foreach ($config->bindings as $alias => $resolver)
422
+        {
400 423
             $container->binder->bind($alias, $resolver);
401 424
         }
402 425
 
403 426
         return ContainerScope::runScope(
404 427
             $container,
405 428
             static function (self $container) use ($config, $closure): mixed {
406
-                try {
429
+                try
430
+                {
407 431
                     return $config->autowire
408 432
                         ? $container->invoke($closure)
409 433
                         : $closure($container);
410
-                } finally {
434
+                }
435
+                finally
436
+                {
411 437
                     $container->closeScope();
412 438
                 }
413 439
             },
Please login to merge, or discard this patch.
src/Core/src/Config.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         public readonly string $container = Container::class,
51 51
         public readonly string $binder = Binder::class,
52 52
         public readonly string $invoker = Invoker::class,
53
-    ) {
53
+    ){
54 54
         $this->scope = Scope::class;
55 55
         $this->scopedBindings = new Internal\Config\StateStorage();
56 56
         $this->actor = Actor::class;
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function lockRoot(): bool
77 77
     {
78
-        try {
78
+        try{
79 79
             return $this->rootLocked;
80
-        } finally {
80
+        }finally{
81 81
             $this->rootLocked = false;
82 82
         }
83 83
     }
Please login to merge, or discard this patch.
src/Core/src/Config/Factory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
     public function __construct(
23 23
         callable $callable,
24 24
         public readonly bool $singleton = false,
25
-    ) {
25
+    ){
26 26
         $this->factory = $callable(...);
27 27
         $reflection = new \ReflectionFunction($this->factory);
28 28
         $this->parametersCount = $reflection->getNumberOfParameters();
29 29
 
30 30
         // Detect the return type of the factory
31
-        $returnType = (string) $reflection->getReturnType();
31
+        $returnType = (string)$reflection->getReturnType();
32 32
         $this->returnClass = \class_exists($returnType) ? $returnType : null;
33 33
 
34 34
         /** @psalm-suppress TypeDoesNotContainType */
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
                 \is_object($callable[0]) ? $callable[0]::class : $callable[0],
40 40
                 $callable[1],
41 41
             ),
42
-            \is_object($callable) && $callable::class !== \Closure::class => 'object ' . $callable::class,
42
+            \is_object($callable) && $callable::class !== \Closure::class => 'object '.$callable::class,
43 43
             default => null,
44 44
         };
45 45
     }
Please login to merge, or discard this patch.
src/Core/src/Config/Shared.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
     public function __construct(
13 13
         public readonly object $value,
14 14
         public readonly bool $singleton = false,
15
-    ) {}
15
+    ){}
16 16
 
17 17
     public function __toString(): string
18 18
     {
19
-        return 'Shared object of class ' . $this->value::class;
19
+        return 'Shared object of class '.$this->value::class;
20 20
     }
21 21
 
22 22
     /**
Please login to merge, or discard this patch.