@@ -12,14 +12,14 @@ |
||
12 | 12 | public function destruct(): void |
13 | 13 | { |
14 | 14 | $class = new \ReflectionClass($this); |
15 | - foreach ($class->getProperties() as $property) { |
|
15 | + foreach ($class->getProperties() as $property){ |
|
16 | 16 | $name = $property->getName(); |
17 | - if (!isset($this->$name)) { |
|
17 | + if (!isset($this->$name)){ |
|
18 | 18 | continue; |
19 | 19 | } |
20 | 20 | $value = $this->$name; |
21 | 21 | unset($this->$name); |
22 | - if (\is_object($value) && \method_exists($value, 'destruct')) { |
|
22 | + if (\is_object($value) && \method_exists($value, 'destruct')){ |
|
23 | 23 | $value->destruct(); |
24 | 24 | } |
25 | 25 | } |
@@ -12,14 +12,17 @@ |
||
12 | 12 | public function destruct(): void |
13 | 13 | { |
14 | 14 | $class = new \ReflectionClass($this); |
15 | - foreach ($class->getProperties() as $property) { |
|
15 | + foreach ($class->getProperties() as $property) |
|
16 | + { |
|
16 | 17 | $name = $property->getName(); |
17 | - if (!isset($this->$name)) { |
|
18 | + if (!isset($this->$name)) |
|
19 | + { |
|
18 | 20 | continue; |
19 | 21 | } |
20 | 22 | $value = $this->$name; |
21 | 23 | unset($this->$name); |
22 | - if (\is_object($value) && \method_exists($value, 'destruct')) { |
|
24 | + if (\is_object($value) && \method_exists($value, 'destruct')) |
|
25 | + { |
|
23 | 26 | $value->destruct(); |
24 | 27 | } |
25 | 28 | } |
@@ -27,7 +27,8 @@ discard block |
||
27 | 27 | public function __toString(): string |
28 | 28 | { |
29 | 29 | $info = []; |
30 | - foreach ($this->info as $key => $item) { |
|
30 | + foreach ($this->info as $key => $item) |
|
31 | + { |
|
31 | 32 | $info[] = "$key: {$this->stringifyValue($item)}"; |
32 | 33 | } |
33 | 34 | return \implode("\n", $info); |
@@ -47,14 +48,17 @@ discard block |
||
47 | 48 | |
48 | 49 | private function renderArray(array $array, int $level = 0): string |
49 | 50 | { |
50 | - if ($array === []) { |
|
51 | + if ($array === []) |
|
52 | + { |
|
51 | 53 | return '[]'; |
52 | 54 | } |
53 | - if ($level >= self::ARRAY_MAX_LEVEL) { |
|
55 | + if ($level >= self::ARRAY_MAX_LEVEL) |
|
56 | + { |
|
54 | 57 | return 'array'; |
55 | 58 | } |
56 | 59 | $result = []; |
57 | - foreach ($array as $key => $value) { |
|
60 | + foreach ($array as $key => $value) |
|
61 | + { |
|
58 | 62 | $result[] = \sprintf( |
59 | 63 | '%s: %s', |
60 | 64 | $key, |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | |
20 | 20 | public function __construct( |
21 | 21 | public array $info = [], |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | $this->alias = $info['alias'] ?? null; |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function __toString(): string |
27 | 27 | { |
28 | 28 | $info = []; |
29 | - foreach ($this->info as $key => $item) { |
|
29 | + foreach ($this->info as $key => $item){ |
|
30 | 30 | $info[] = "$key: {$this->stringifyValue($item)}"; |
31 | 31 | } |
32 | 32 | return \implode("\n", $info); |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | \is_scalar($item) => \var_export($item, true), |
40 | 40 | $item instanceof \Closure => $this->renderClosureSignature(new \ReflectionFunction($item)), |
41 | 41 | $item instanceof \ReflectionFunctionAbstract => $this->renderClosureSignature($item), |
42 | - $item instanceof \UnitEnum => $item::class . "::$item->name", |
|
43 | - \is_object($item) => $item instanceof \Stringable ? (string) $item : 'instance of ' . $item::class, |
|
42 | + $item instanceof \UnitEnum => $item::class."::$item->name", |
|
43 | + \is_object($item) => $item instanceof \Stringable ? (string)$item : 'instance of '.$item::class, |
|
44 | 44 | \is_array($item) => $this->renderArray($item), |
45 | 45 | default => \get_debug_type($item), |
46 | 46 | }; |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | |
49 | 49 | private function renderArray(array $array, int $level = 0): string |
50 | 50 | { |
51 | - if ($array === []) { |
|
51 | + if ($array === []){ |
|
52 | 52 | return '[]'; |
53 | 53 | } |
54 | - if ($level >= self::ARRAY_MAX_LEVEL) { |
|
54 | + if ($level >= self::ARRAY_MAX_LEVEL){ |
|
55 | 55 | return 'array'; |
56 | 56 | } |
57 | 57 | $result = []; |
58 | - foreach ($array as $key => $value) { |
|
58 | + foreach ($array as $key => $value){ |
|
59 | 59 | $result[] = \sprintf( |
60 | 60 | '%s: %s', |
61 | 61 | $key, |
@@ -66,6 +66,6 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | $pad = \str_repeat(' ', $level); |
69 | - return "[\n $pad" . \implode(",\n $pad", $result) . "\n$pad]"; |
|
69 | + return "[\n $pad".\implode(",\n $pad", $result)."\n$pad]"; |
|
70 | 70 | } |
71 | 71 | } |
@@ -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), |
@@ -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( |
@@ -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, |
@@ -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 | } |
@@ -50,7 +50,7 @@ discard block |
||
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 |
||
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 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | $listener = \Mockery::mock(TokenizationListenerInterface::class); |
32 | 32 | |
33 | - foreach ($classes as $class) { |
|
33 | + foreach ($classes as $class){ |
|
34 | 34 | $listener->shouldReceive('listen') |
35 | 35 | ->once() |
36 | 36 | ->with($class); |
@@ -30,7 +30,8 @@ |
||
30 | 30 | |
31 | 31 | $listener = \Mockery::mock(TokenizationListenerInterface::class); |
32 | 32 | |
33 | - foreach ($classes as $class) { |
|
33 | + foreach ($classes as $class) |
|
34 | + { |
|
34 | 35 | $listener->shouldReceive('listen') |
35 | 36 | ->once() |
36 | 37 | ->with($class); |