@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | public function __construct( |
22 | 22 | public readonly \ReflectionFunctionAbstract $reflection, |
23 | 23 | private array $arguments, |
24 | - ) { |
|
24 | + ){ |
|
25 | 25 | $this->modeNamed = $this->isNamedMode(); |
26 | 26 | } |
27 | 27 | |
28 | 28 | public function addResolvedValue(mixed &$value, ?string $key = null): void |
29 | 29 | { |
30 | - if ($key === null) { |
|
30 | + if ($key === null){ |
|
31 | 31 | $this->resolvedValues[] = &$value; |
32 | - } else { |
|
32 | + }else{ |
|
33 | 33 | $this->resolvedValues[$key] = &$value; |
34 | 34 | } |
35 | 35 | } |
@@ -40,25 +40,25 @@ discard block |
||
40 | 40 | ? $parameter->getName() |
41 | 41 | : $parameter->getPosition(); |
42 | 42 | |
43 | - if (!\array_key_exists($key, $this->arguments)) { |
|
43 | + if (!\array_key_exists($key, $this->arguments)){ |
|
44 | 44 | return []; |
45 | 45 | } |
46 | 46 | $_val = &$this->arguments[$key]; |
47 | 47 | |
48 | - if ($variadic && \is_array($_val)) { |
|
48 | + if ($variadic && \is_array($_val)){ |
|
49 | 49 | // Save keys is possible |
50 | 50 | $positional = true; |
51 | 51 | $result = []; |
52 | - foreach ($_val as $key => &$item) { |
|
53 | - if (!$positional && \is_int($key)) { |
|
52 | + foreach ($_val as $key => &$item){ |
|
53 | + if (!$positional && \is_int($key)){ |
|
54 | 54 | throw new ResolvingException( |
55 | 55 | 'Cannot use positional argument after named argument during unpacking named variadic argument.', |
56 | 56 | ); |
57 | 57 | } |
58 | 58 | $positional = $positional && \is_int($key); |
59 | - if ($positional) { |
|
59 | + if ($positional){ |
|
60 | 60 | $result[] = &$item; |
61 | - } else { |
|
61 | + }else{ |
|
62 | 62 | $result[$key] = &$item; |
63 | 63 | } |
64 | 64 | } |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | { |
77 | 77 | $nums = 0; |
78 | 78 | $strings = 0; |
79 | - foreach ($this->arguments as $key => $_) { |
|
80 | - if (\is_int($key)) { |
|
79 | + foreach ($this->arguments as $key => $_){ |
|
80 | + if (\is_int($key)){ |
|
81 | 81 | ++$nums; |
82 | - } else { |
|
82 | + }else{ |
|
83 | 83 | ++$strings; |
84 | 84 | } |
85 | 85 | } |
@@ -27,9 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | public function addResolvedValue(mixed &$value, ?string $key = null): void |
29 | 29 | { |
30 | - if ($key === null) { |
|
30 | + if ($key === null) |
|
31 | + { |
|
31 | 32 | $this->resolvedValues[] = &$value; |
32 | - } else { |
|
33 | + } |
|
34 | + else |
|
35 | + { |
|
33 | 36 | $this->resolvedValues[$key] = &$value; |
34 | 37 | } |
35 | 38 | } |
@@ -40,25 +43,32 @@ discard block |
||
40 | 43 | ? $parameter->getName() |
41 | 44 | : $parameter->getPosition(); |
42 | 45 | |
43 | - if (!\array_key_exists($key, $this->arguments)) { |
|
46 | + if (!\array_key_exists($key, $this->arguments)) |
|
47 | + { |
|
44 | 48 | return []; |
45 | 49 | } |
46 | 50 | $_val = &$this->arguments[$key]; |
47 | 51 | |
48 | - if ($variadic && \is_array($_val)) { |
|
52 | + if ($variadic && \is_array($_val)) |
|
53 | + { |
|
49 | 54 | // Save keys is possible |
50 | 55 | $positional = true; |
51 | 56 | $result = []; |
52 | - foreach ($_val as $key => &$item) { |
|
53 | - if (!$positional && \is_int($key)) { |
|
57 | + foreach ($_val as $key => &$item) |
|
58 | + { |
|
59 | + if (!$positional && \is_int($key)) |
|
60 | + { |
|
54 | 61 | throw new ResolvingException( |
55 | 62 | 'Cannot use positional argument after named argument during unpacking named variadic argument.', |
56 | 63 | ); |
57 | 64 | } |
58 | 65 | $positional = $positional && \is_int($key); |
59 | - if ($positional) { |
|
66 | + if ($positional) |
|
67 | + { |
|
60 | 68 | $result[] = &$item; |
61 | - } else { |
|
69 | + } |
|
70 | + else |
|
71 | + { |
|
62 | 72 | $result[$key] = &$item; |
63 | 73 | } |
64 | 74 | } |
@@ -76,10 +86,14 @@ discard block |
||
76 | 86 | { |
77 | 87 | $nums = 0; |
78 | 88 | $strings = 0; |
79 | - foreach ($this->arguments as $key => $_) { |
|
80 | - if (\is_int($key)) { |
|
89 | + foreach ($this->arguments as $key => $_) |
|
90 | + { |
|
91 | + if (\is_int($key)) |
|
92 | + { |
|
81 | 93 | ++$nums; |
82 | - } else { |
|
94 | + } |
|
95 | + else |
|
96 | + { |
|
83 | 97 | ++$strings; |
84 | 98 | } |
85 | 99 | } |
@@ -15,11 +15,11 @@ |
||
15 | 15 | * @param \Stringable|string|null $context Original context. |
16 | 16 | */ |
17 | 17 | public function __construct( |
18 | - public \Stringable|string|null $context = null, |
|
19 | - ) {} |
|
18 | + public \Stringable | string | null $context = null, |
|
19 | + ){} |
|
20 | 20 | |
21 | 21 | public function __toString(): string |
22 | 22 | { |
23 | - return (string) $this->context; |
|
23 | + return (string)$this->context; |
|
24 | 24 | } |
25 | 25 | } |
@@ -16,7 +16,8 @@ |
||
16 | 16 | */ |
17 | 17 | public function __construct( |
18 | 18 | public \Stringable|string|null $context = null, |
19 | - ) {} |
|
19 | + ) { |
|
20 | +} |
|
20 | 21 | |
21 | 22 | public function __toString(): string |
22 | 23 | { |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | { |
29 | 29 | public function __construct( |
30 | 30 | protected readonly State $state, |
31 | - ) {} |
|
31 | + ){} |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @param TResolver|object $resolver |
35 | 35 | */ |
36 | 36 | public function bind(string $alias, mixed $resolver): void |
37 | 37 | { |
38 | - if ($resolver instanceof Inflector && (\interface_exists($alias) || \class_exists($alias))) { |
|
38 | + if ($resolver instanceof Inflector && (\interface_exists($alias) || \class_exists($alias))){ |
|
39 | 39 | $this->state->inflectors[$alias][] = $resolver; |
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - try { |
|
43 | + try{ |
|
44 | 44 | $config = $this->makeConfig($resolver, false); |
45 | - } catch (\Throwable $e) { |
|
45 | + }catch (\Throwable $e){ |
|
46 | 46 | throw $this->invalidBindingException($alias, $e); |
47 | 47 | } |
48 | 48 | |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function bindSingleton(string $alias, mixed $resolver): void |
56 | 56 | { |
57 | - try { |
|
57 | + try{ |
|
58 | 58 | $config = $this->makeConfig($resolver, true); |
59 | - } catch (\Throwable $e) { |
|
59 | + }catch (\Throwable $e){ |
|
60 | 60 | throw $this->invalidBindingException($alias, $e); |
61 | 61 | } |
62 | 62 | |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | $bindings = &$this->state->bindings; |
69 | 69 | |
70 | 70 | $flags = []; |
71 | - while ($binding = $bindings[$alias] ?? null and $binding::class === Alias::class) { |
|
71 | + while ($binding = $bindings[$alias] ?? null and $binding::class === Alias::class){ |
|
72 | 72 | //Checking alias tree |
73 | - if ($flags[$binding->alias] ?? false) { |
|
73 | + if ($flags[$binding->alias] ?? false){ |
|
74 | 74 | return $binding->alias === $alias ?: throw new \Exception('Circular alias detected'); |
75 | 75 | } |
76 | 76 | |
77 | - if (\array_key_exists($alias, $this->state->singletons)) { |
|
77 | + if (\array_key_exists($alias, $this->state->singletons)){ |
|
78 | 78 | return true; |
79 | 79 | } |
80 | 80 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public function removeInjector(string $class): void |
99 | 99 | { |
100 | 100 | unset($this->state->injectors[$class]); |
101 | - if (!isset($this->state->bindings[$class]) || $this->state->bindings[$class]::class !== Injectable::class) { |
|
101 | + if (!isset($this->state->bindings[$class]) || $this->state->bindings[$class]::class !== Injectable::class){ |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 | unset($this->state->bindings[$class]); |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | |
107 | 107 | public function hasInjector(string $class): bool |
108 | 108 | { |
109 | - if (\array_key_exists($class, $this->state->injectors)) { |
|
109 | + if (\array_key_exists($class, $this->state->injectors)){ |
|
110 | 110 | return true; |
111 | 111 | } |
112 | 112 | |
113 | - try { |
|
113 | + try{ |
|
114 | 114 | $reflection = new \ReflectionClass($class); |
115 | - } catch (\ReflectionException $e) { |
|
115 | + }catch (\ReflectionException $e){ |
|
116 | 116 | throw new ContainerException($e->getMessage(), $e->getCode(), $e); |
117 | 117 | } |
118 | 118 | |
119 | 119 | if ( |
120 | 120 | $reflection->implementsInterface(InjectableInterface::class) |
121 | 121 | && $reflection->hasConstant('INJECTOR') |
122 | - ) { |
|
122 | + ){ |
|
123 | 123 | $const = $reflection->getConstant('INJECTOR'); |
124 | 124 | $this->bindInjector($class, $const); |
125 | 125 | |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | // check interfaces |
130 | - foreach ($this->state->injectors as $target => $injector) { |
|
130 | + foreach ($this->state->injectors as $target => $injector){ |
|
131 | 131 | if ( |
132 | 132 | (\class_exists($target, true) && $reflection->isSubclassOf($target)) |
133 | 133 | || |
134 | 134 | (\interface_exists($target, true) && $reflection->implementsInterface($target)) |
135 | - ) { |
|
135 | + ){ |
|
136 | 136 | $this->state->bindings[$class] = new Injectable($injector); |
137 | 137 | |
138 | 138 | return true; |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | |
160 | 160 | private function makeConfigFromArray(array $resolver, bool $singleton): Binding |
161 | 161 | { |
162 | - if (\is_callable($resolver)) { |
|
162 | + if (\is_callable($resolver)){ |
|
163 | 163 | return new Factory($resolver, $singleton); |
164 | 164 | } |
165 | 165 | |
166 | 166 | // Validate lazy invokable array |
167 | - if (!isset($resolver[0]) || !isset($resolver[1]) || !\is_string($resolver[1]) || $resolver[1] === '') { |
|
167 | + if (!isset($resolver[0]) || !isset($resolver[1]) || !\is_string($resolver[1]) || $resolver[1] === ''){ |
|
168 | 168 | throw new \InvalidArgumentException('Incompatible array declaration for resolver.'); |
169 | 169 | } |
170 | - if ((!\is_string($resolver[0]) && !\is_object($resolver[0])) || $resolver[0] === '') { |
|
170 | + if ((!\is_string($resolver[0]) && !\is_object($resolver[0])) || $resolver[0] === ''){ |
|
171 | 171 | throw new \InvalidArgumentException('Incompatible array declaration for resolver.'); |
172 | 172 | } |
173 | 173 | |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | |
189 | 189 | private function setBinding(string $alias, Binding $config): void |
190 | 190 | { |
191 | - if (isset($this->state->singletons[$alias])) { |
|
191 | + if (isset($this->state->singletons[$alias])){ |
|
192 | 192 | throw new SingletonOverloadException($alias); |
193 | 193 | } |
194 | 194 | |
195 | 195 | $this->state->bindings[$alias] = $config; |
196 | 196 | |
197 | - if ($config instanceof Injectable) { |
|
197 | + if ($config instanceof Injectable){ |
|
198 | 198 | $this->state->injectors[$alias] = $config->injector; |
199 | 199 | } |
200 | 200 | } |
@@ -28,21 +28,26 @@ discard block |
||
28 | 28 | { |
29 | 29 | public function __construct( |
30 | 30 | protected readonly State $state, |
31 | - ) {} |
|
31 | + ) { |
|
32 | +} |
|
32 | 33 | |
33 | 34 | /** |
34 | 35 | * @param TResolver|object $resolver |
35 | 36 | */ |
36 | 37 | public function bind(string $alias, mixed $resolver): void |
37 | 38 | { |
38 | - if ($resolver instanceof Inflector && (\interface_exists($alias) || \class_exists($alias))) { |
|
39 | + if ($resolver instanceof Inflector && (\interface_exists($alias) || \class_exists($alias))) |
|
40 | + { |
|
39 | 41 | $this->state->inflectors[$alias][] = $resolver; |
40 | 42 | return; |
41 | 43 | } |
42 | 44 | |
43 | - try { |
|
45 | + try |
|
46 | + { |
|
44 | 47 | $config = $this->makeConfig($resolver, false); |
45 | - } catch (\Throwable $e) { |
|
48 | + } |
|
49 | + catch (\Throwable $e) |
|
50 | + { |
|
46 | 51 | throw $this->invalidBindingException($alias, $e); |
47 | 52 | } |
48 | 53 | |
@@ -54,9 +59,12 @@ discard block |
||
54 | 59 | */ |
55 | 60 | public function bindSingleton(string $alias, mixed $resolver): void |
56 | 61 | { |
57 | - try { |
|
62 | + try |
|
63 | + { |
|
58 | 64 | $config = $this->makeConfig($resolver, true); |
59 | - } catch (\Throwable $e) { |
|
65 | + } |
|
66 | + catch (\Throwable $e) |
|
67 | + { |
|
60 | 68 | throw $this->invalidBindingException($alias, $e); |
61 | 69 | } |
62 | 70 | |
@@ -68,13 +76,16 @@ discard block |
||
68 | 76 | $bindings = &$this->state->bindings; |
69 | 77 | |
70 | 78 | $flags = []; |
71 | - while ($binding = $bindings[$alias] ?? null and $binding::class === Alias::class) { |
|
79 | + while ($binding = $bindings[$alias] ?? null and $binding::class === Alias::class) |
|
80 | + { |
|
72 | 81 | //Checking alias tree |
73 | - if ($flags[$binding->alias] ?? false) { |
|
82 | + if ($flags[$binding->alias] ?? false) |
|
83 | + { |
|
74 | 84 | return $binding->alias === $alias ?: throw new \Exception('Circular alias detected'); |
75 | 85 | } |
76 | 86 | |
77 | - if (\array_key_exists($alias, $this->state->singletons)) { |
|
87 | + if (\array_key_exists($alias, $this->state->singletons)) |
|
88 | + { |
|
78 | 89 | return true; |
79 | 90 | } |
80 | 91 | |
@@ -98,7 +109,8 @@ discard block |
||
98 | 109 | public function removeInjector(string $class): void |
99 | 110 | { |
100 | 111 | unset($this->state->injectors[$class]); |
101 | - if (!isset($this->state->bindings[$class]) || $this->state->bindings[$class]::class !== Injectable::class) { |
|
112 | + if (!isset($this->state->bindings[$class]) || $this->state->bindings[$class]::class !== Injectable::class) |
|
113 | + { |
|
102 | 114 | return; |
103 | 115 | } |
104 | 116 | unset($this->state->bindings[$class]); |
@@ -106,13 +118,17 @@ discard block |
||
106 | 118 | |
107 | 119 | public function hasInjector(string $class): bool |
108 | 120 | { |
109 | - if (\array_key_exists($class, $this->state->injectors)) { |
|
121 | + if (\array_key_exists($class, $this->state->injectors)) |
|
122 | + { |
|
110 | 123 | return true; |
111 | 124 | } |
112 | 125 | |
113 | - try { |
|
126 | + try |
|
127 | + { |
|
114 | 128 | $reflection = new \ReflectionClass($class); |
115 | - } catch (\ReflectionException $e) { |
|
129 | + } |
|
130 | + catch (\ReflectionException $e) |
|
131 | + { |
|
116 | 132 | throw new ContainerException($e->getMessage(), $e->getCode(), $e); |
117 | 133 | } |
118 | 134 | |
@@ -127,7 +143,8 @@ discard block |
||
127 | 143 | } |
128 | 144 | |
129 | 145 | // check interfaces |
130 | - foreach ($this->state->injectors as $target => $injector) { |
|
146 | + foreach ($this->state->injectors as $target => $injector) |
|
147 | + { |
|
131 | 148 | if ( |
132 | 149 | (\class_exists($target, true) && $reflection->isSubclassOf($target)) |
133 | 150 | || |
@@ -159,15 +176,18 @@ discard block |
||
159 | 176 | |
160 | 177 | private function makeConfigFromArray(array $resolver, bool $singleton): Binding |
161 | 178 | { |
162 | - if (\is_callable($resolver)) { |
|
179 | + if (\is_callable($resolver)) |
|
180 | + { |
|
163 | 181 | return new Factory($resolver, $singleton); |
164 | 182 | } |
165 | 183 | |
166 | 184 | // Validate lazy invokable array |
167 | - if (!isset($resolver[0]) || !isset($resolver[1]) || !\is_string($resolver[1]) || $resolver[1] === '') { |
|
185 | + if (!isset($resolver[0]) || !isset($resolver[1]) || !\is_string($resolver[1]) || $resolver[1] === '') |
|
186 | + { |
|
168 | 187 | throw new \InvalidArgumentException('Incompatible array declaration for resolver.'); |
169 | 188 | } |
170 | - if ((!\is_string($resolver[0]) && !\is_object($resolver[0])) || $resolver[0] === '') { |
|
189 | + if ((!\is_string($resolver[0]) && !\is_object($resolver[0])) || $resolver[0] === '') |
|
190 | + { |
|
171 | 191 | throw new \InvalidArgumentException('Incompatible array declaration for resolver.'); |
172 | 192 | } |
173 | 193 | |
@@ -188,13 +208,15 @@ discard block |
||
188 | 208 | |
189 | 209 | private function setBinding(string $alias, Binding $config): void |
190 | 210 | { |
191 | - if (isset($this->state->singletons[$alias])) { |
|
211 | + if (isset($this->state->singletons[$alias])) |
|
212 | + { |
|
192 | 213 | throw new SingletonOverloadException($alias); |
193 | 214 | } |
194 | 215 | |
195 | 216 | $this->state->bindings[$alias] = $config; |
196 | 217 | |
197 | - if ($config instanceof Injectable) { |
|
218 | + if ($config instanceof Injectable) |
|
219 | + { |
|
198 | 220 | $this->state->injectors[$alias] = $config->injector; |
199 | 221 | } |
200 | 222 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | private readonly Config $config, |
20 | 20 | private array $objects = [], |
21 | 21 | private readonly Options $options = new Options(), |
22 | - ) {} |
|
22 | + ){} |
|
23 | 23 | |
24 | 24 | public function set(string $name, object $value): void |
25 | 25 | { |
@@ -19,7 +19,8 @@ |
||
19 | 19 | private readonly Config $config, |
20 | 20 | private array $objects = [], |
21 | 21 | private readonly Options $options = new Options(), |
22 | - ) {} |
|
22 | + ) { |
|
23 | +} |
|
23 | 24 | |
24 | 25 | public function set(string $name, object $value): void |
25 | 26 | { |
@@ -10,4 +10,4 @@ |
||
10 | 10 | * Attention, this abstraction is currently under re-thinking process in order to replace it with |
11 | 11 | * bound context-specific factory (non breaking change). |
12 | 12 | */ |
13 | -interface InjectableInterface {} |
|
13 | +interface InjectableInterface{} |
@@ -10,4 +10,6 @@ |
||
10 | 10 | * Attention, this abstraction is currently under re-thinking process in order to replace it with |
11 | 11 | * bound context-specific factory (non breaking change). |
12 | 12 | */ |
13 | -interface InjectableInterface {} |
|
13 | +interface InjectableInterface |
|
14 | +{ |
|
15 | +} |
@@ -10,4 +10,4 @@ |
||
10 | 10 | * Class treated as singleton will only be constructed once in spiral IoC. |
11 | 11 | * @deprecated Use {@see Singleton} attribute instead. Will be removed in v4.0. |
12 | 12 | */ |
13 | -interface SingletonInterface {} |
|
13 | +interface SingletonInterface{} |
@@ -10,4 +10,6 @@ |
||
10 | 10 | * Class treated as singleton will only be constructed once in spiral IoC. |
11 | 11 | * @deprecated Use {@see Singleton} attribute instead. Will be removed in v4.0. |
12 | 12 | */ |
13 | -interface SingletonInterface {} |
|
13 | +interface SingletonInterface |
|
14 | +{ |
|
15 | +} |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function __construct( |
27 | 27 | public readonly string $alias, |
28 | 28 | public readonly array $parameters = [], |
29 | - ) {} |
|
29 | + ){} |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Init the autowire based on string or array definition. |
@@ -35,22 +35,22 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function wire(mixed $definition): Autowire |
37 | 37 | { |
38 | - if ($definition instanceof self) { |
|
38 | + if ($definition instanceof self){ |
|
39 | 39 | return $definition; |
40 | 40 | } |
41 | 41 | |
42 | - if (\is_string($definition)) { |
|
42 | + if (\is_string($definition)){ |
|
43 | 43 | return new self($definition); |
44 | 44 | } |
45 | 45 | |
46 | - if (\is_array($definition) && isset($definition['class'])) { |
|
46 | + if (\is_array($definition) && isset($definition['class'])){ |
|
47 | 47 | return new self( |
48 | 48 | $definition['class'], |
49 | 49 | $definition['options'] ?? $definition['params'] ?? [], |
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | - if (\is_object($definition)) { |
|
53 | + if (\is_object($definition)){ |
|
54 | 54 | $autowire = new self($definition::class, []); |
55 | 55 | $autowire->target = $definition; |
56 | 56 | return $autowire; |
@@ -26,7 +26,8 @@ discard block |
||
26 | 26 | public function __construct( |
27 | 27 | public readonly string $alias, |
28 | 28 | public readonly array $parameters = [], |
29 | - ) {} |
|
29 | + ) { |
|
30 | +} |
|
30 | 31 | |
31 | 32 | /** |
32 | 33 | * Init the autowire based on string or array definition. |
@@ -35,22 +36,26 @@ discard block |
||
35 | 36 | */ |
36 | 37 | public static function wire(mixed $definition): Autowire |
37 | 38 | { |
38 | - if ($definition instanceof self) { |
|
39 | + if ($definition instanceof self) |
|
40 | + { |
|
39 | 41 | return $definition; |
40 | 42 | } |
41 | 43 | |
42 | - if (\is_string($definition)) { |
|
44 | + if (\is_string($definition)) |
|
45 | + { |
|
43 | 46 | return new self($definition); |
44 | 47 | } |
45 | 48 | |
46 | - if (\is_array($definition) && isset($definition['class'])) { |
|
49 | + if (\is_array($definition) && isset($definition['class'])) |
|
50 | + { |
|
47 | 51 | return new self( |
48 | 52 | $definition['class'], |
49 | 53 | $definition['options'] ?? $definition['params'] ?? [], |
50 | 54 | ); |
51 | 55 | } |
52 | 56 | |
53 | - if (\is_object($definition)) { |
|
57 | + if (\is_object($definition)) |
|
58 | + { |
|
54 | 59 | $autowire = new self($definition::class, []); |
55 | 60 | $autowire->target = $definition; |
56 | 61 | return $autowire; |
@@ -20,8 +20,8 @@ |
||
20 | 20 | * as the first argument. Otherwise, {@see InvokerInterface::invoke()} will be used to invoke the closure. |
21 | 21 | */ |
22 | 22 | public function __construct( |
23 | - public readonly string|\BackedEnum|null $name = null, |
|
23 | + public readonly string | \BackedEnum | null $name = null, |
|
24 | 24 | public readonly array $bindings = [], |
25 | 25 | public readonly bool $autowire = true, |
26 | - ) {} |
|
26 | + ){} |
|
27 | 27 | } |
@@ -23,5 +23,6 @@ |
||
23 | 23 | public readonly string|\BackedEnum|null $name = null, |
24 | 24 | public readonly array $bindings = [], |
25 | 25 | public readonly bool $autowire = true, |
26 | - ) {} |
|
26 | + ) { |
|
27 | +} |
|
27 | 28 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public function __construct( |
16 | 16 | public readonly array $factory, |
17 | 17 | public readonly bool $singleton = false, |
18 | - ) {} |
|
18 | + ){} |
|
19 | 19 | |
20 | 20 | public function __toString(): string |
21 | 21 | { |
@@ -15,7 +15,8 @@ |
||
15 | 15 | public function __construct( |
16 | 16 | public readonly array $factory, |
17 | 17 | public readonly bool $singleton = false, |
18 | - ) {} |
|
18 | + ) { |
|
19 | +} |
|
19 | 20 | |
20 | 21 | public function __toString(): string |
21 | 22 | { |