@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @param TResolver $resolver |
22 | 22 | */ |
23 | - public function bind(string $alias, string|array|callable|object $resolver): void; |
|
23 | + public function bind(string $alias, string | array | callable | object $resolver): void; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Bind value resolver to container alias to be executed as cached. Resolver can be class name |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param TResolver $resolver Can be result object or |
30 | 30 | * the same special callable value like the $target parameter in the {@see InvokerInterface::invoke()} method |
31 | 31 | */ |
32 | - public function bindSingleton(string $alias, string|array|callable|object $resolver): void; |
|
32 | + public function bindSingleton(string $alias, string | array | callable | object $resolver): void; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Check if alias points to constructed instance (singleton). |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | public function __construct( |
13 | 13 | string $scope, |
14 | - ) { |
|
14 | + ){ |
|
15 | 15 | parent::__construct( |
16 | 16 | $scope, |
17 | 17 | "Error on a scope allocation with the name `{$scope}`. A scope with the same name already exists.", |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public function __construct( |
13 | 13 | string $scope, |
14 | 14 | protected string $className, |
15 | - ) { |
|
15 | + ){ |
|
16 | 16 | parent::__construct( |
17 | 17 | $scope, |
18 | 18 | \sprintf('Class `%s` can be resolved only in `%s` scope.', $className, $scope), |
@@ -16,7 +16,7 @@ |
||
16 | 16 | string $message = '', |
17 | 17 | int $code = 0, |
18 | 18 | ?\Throwable $previous = null, |
19 | - ) { |
|
19 | + ){ |
|
20 | 20 | parent::__construct( |
21 | 21 | $message, |
22 | 22 | $code, |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public function __construct( |
16 | 16 | ?string $scope, |
17 | 17 | protected array $exceptions, |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | $count = \count($exceptions); |
20 | 20 | parent::__construct( |
21 | 21 | $scope, |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $count === 1 ? 'An exception has been' : "$count exceptions have been", |
25 | 25 | $scope === null ? 'an unnamed scope' : "the scope `$scope`", |
26 | 26 | \implode("\n\n", \array_map( |
27 | - static fn (Exception $e): string => \sprintf( |
|
27 | + static fn (Exception $e) : string => \sprintf( |
|
28 | 28 | "# %s\n%s", |
29 | 29 | $e::class, |
30 | 30 | $e->getMessage(), |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public readonly string $binder = Binder::class, |
51 | 51 | public readonly string $invoker = Invoker::class, |
52 | 52 | public readonly string $tracer = Tracer::class, |
53 | - ) { |
|
53 | + ){ |
|
54 | 54 | $this->scope = Scope::class; |
55 | 55 | $this->scopedBindings = new Internal\Config\StateStorage(); |
56 | 56 | } |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function lockRoot(): bool |
76 | 76 | { |
77 | - try { |
|
77 | + try{ |
|
78 | 78 | return $this->rootLocked; |
79 | - } finally { |
|
79 | + }finally{ |
|
80 | 80 | $this->rootLocked = false; |
81 | 81 | } |
82 | 82 | } |
@@ -74,9 +74,12 @@ |
||
74 | 74 | */ |
75 | 75 | public function lockRoot(): bool |
76 | 76 | { |
77 | - try { |
|
77 | + try |
|
78 | + { |
|
78 | 79 | return $this->rootLocked; |
79 | - } finally { |
|
80 | + } |
|
81 | + finally |
|
82 | + { |
|
80 | 83 | $this->rootLocked = false; |
81 | 84 | } |
82 | 85 | } |
@@ -13,9 +13,9 @@ |
||
13 | 13 | public function __construct( |
14 | 14 | ?string $scope, |
15 | 15 | array $parents, |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | $scopes = \implode('->', \array_map( |
18 | - static fn (?string $scope): string => $scope === null ? 'null' : "\"$scope\"", |
|
18 | + static fn (?string $scope) : string => $scope === null ? 'null' : "\"$scope\"", |
|
19 | 19 | [...\array_reverse($parents), $scope], |
20 | 20 | )); |
21 | 21 | parent::__construct( |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | $this->logger = $logger; |
22 | 22 | $this->finalized = true; |
23 | - if ($this->throwException) { |
|
23 | + if ($this->throwException){ |
|
24 | 24 | throw new RuntimeException('Test exception from finalize method.'); |
25 | 25 | } |
26 | 26 | } |
@@ -20,7 +20,8 @@ |
||
20 | 20 | { |
21 | 21 | $this->logger = $logger; |
22 | 22 | $this->finalized = true; |
23 | - if ($this->throwException) { |
|
23 | + if ($this->throwException) |
|
24 | + { |
|
24 | 25 | throw new RuntimeException('Test exception from finalize method.'); |
25 | 26 | } |
26 | 27 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | #[ExpectedValues(values: [\E_USER_NOTICE, \E_USER_WARNING, \E_USER_ERROR])] |
69 | 69 | int $type |
70 | 70 | ): ?Throwable { |
71 | - $handler = (new class extends ExceptionHandler { |
|
71 | + $handler = (new class extends ExceptionHandler{ |
|
72 | 72 | public function handleError(int $errno, string $errstr, string $errfile = '', int $errline = 0): bool |
73 | 73 | { |
74 | 74 | return parent::handleError($errno, $errstr, $errfile, $errline); |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | { |
79 | 79 | } |
80 | 80 | }); |
81 | - try { |
|
81 | + try{ |
|
82 | 82 | $handler->handleError(...\array_values($this->generateErrorArray($type))); |
83 | - } catch (Throwable $e) { |
|
83 | + }catch (Throwable $e){ |
|
84 | 84 | return $e; |
85 | 85 | } |
86 | 86 | return null; |
@@ -68,7 +68,8 @@ discard block |
||
68 | 68 | #[ExpectedValues(values: [\E_USER_NOTICE, \E_USER_WARNING, \E_USER_ERROR])] |
69 | 69 | int $type |
70 | 70 | ): ?Throwable { |
71 | - $handler = (new class extends ExceptionHandler { |
|
71 | + $handler = (new class extends ExceptionHandler |
|
72 | + { |
|
72 | 73 | public function handleError(int $errno, string $errstr, string $errfile = '', int $errline = 0): bool |
73 | 74 | { |
74 | 75 | return parent::handleError($errno, $errstr, $errfile, $errline); |
@@ -78,9 +79,12 @@ discard block |
||
78 | 79 | { |
79 | 80 | } |
80 | 81 | }); |
81 | - try { |
|
82 | + try |
|
83 | + { |
|
82 | 84 | $handler->handleError(...\array_values($this->generateErrorArray($type))); |
83 | - } catch (Throwable $e) { |
|
85 | + } |
|
86 | + catch (Throwable $e) |
|
87 | + { |
|
84 | 88 | return $e; |
85 | 89 | } |
86 | 90 | return null; |