@@ -8,5 +8,5 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | public \DateTimeInterface $logger, |
11 | - ) {} |
|
11 | + ){} |
|
12 | 12 | } |
@@ -8,5 +8,6 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | public \DateTimeInterface $logger, |
11 | - ) {} |
|
11 | + ) { |
|
12 | +} |
|
12 | 13 | } |
@@ -9,4 +9,4 @@ |
||
9 | 9 | |
10 | 10 | #[Singleton] |
11 | 11 | #[Scope('foo')] |
12 | -final class AttrScopeFooSingleton {} |
|
12 | +final class AttrScopeFooSingleton{} |
@@ -9,4 +9,6 @@ |
||
9 | 9 | |
10 | 10 | #[Singleton] |
11 | 11 | #[Scope('foo')] |
12 | -final class AttrScopeFooSingleton {} |
|
12 | +final class AttrScopeFooSingleton |
|
13 | +{ |
|
14 | +} |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | #[Proxy] public LoggerInterface $logger, |
13 | - ) {} |
|
13 | + ){} |
|
14 | 14 | |
15 | 15 | public function getLogger(): LoggerInterface |
16 | 16 | { |
@@ -10,7 +10,8 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | #[Proxy] public LoggerInterface $logger, |
13 | - ) {} |
|
13 | + ) { |
|
14 | +} |
|
14 | 15 | |
15 | 16 | public function getLogger(): LoggerInterface |
16 | 17 | { |
@@ -8,5 +8,5 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | public LoggerInterface $logger, |
11 | - ) {} |
|
11 | + ){} |
|
12 | 12 | } |
@@ -8,5 +8,6 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | public LoggerInterface $logger, |
11 | - ) {} |
|
11 | + ) { |
|
12 | +} |
|
12 | 13 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | { |
20 | 20 | $this->logger = $logger; |
21 | 21 | $this->finalized = true; |
22 | - if ($this->throwException) { |
|
22 | + if ($this->throwException){ |
|
23 | 23 | throw new \RuntimeException('Test exception from finalize method.'); |
24 | 24 | } |
25 | 25 | } |
@@ -19,7 +19,8 @@ |
||
19 | 19 | { |
20 | 20 | $this->logger = $logger; |
21 | 21 | $this->finalized = true; |
22 | - if ($this->throwException) { |
|
22 | + if ($this->throwException) |
|
23 | + { |
|
23 | 24 | throw new \RuntimeException('Test exception from finalize method.'); |
24 | 25 | } |
25 | 26 | } |
@@ -8,11 +8,11 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | private string $name, |
11 | - ) {} |
|
11 | + ){} |
|
12 | 12 | |
13 | - public function setName(string|\Stringable $name): void |
|
13 | + public function setName(string | \Stringable $name): void |
|
14 | 14 | { |
15 | - $this->name = (string) $name; |
|
15 | + $this->name = (string)$name; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function getName(): string |
@@ -8,7 +8,8 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | private string $name, |
11 | - ) {} |
|
11 | + ) { |
|
12 | +} |
|
12 | 13 | |
13 | 14 | public function setName(string|\Stringable $name): void |
14 | 15 | { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | #[Proxy] public ContextInterface $context, |
13 | - ) {} |
|
13 | + ){} |
|
14 | 14 | |
15 | 15 | public function getContext(): ContextInterface |
16 | 16 | { |
@@ -10,7 +10,8 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | #[Proxy] public ContextInterface $context, |
13 | - ) {} |
|
13 | + ) { |
|
14 | +} |
|
14 | 15 | |
15 | 16 | public function getContext(): ContextInterface |
16 | 17 | { |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | { |
165 | 165 | $root = new Container(); |
166 | 166 | // Configure Scope 1 |
167 | - $root->getBinder('scope1')->bindSingleton('foo', (object) ['scope' => 'scope1']); |
|
167 | + $root->getBinder('scope1')->bindSingleton('foo', (object)['scope' => 'scope1']); |
|
168 | 168 | // Configure Scope 2 |
169 | 169 | self::assertFalse($root->getBinder('scope2')->hasInstance('foo')); |
170 | - $root->getBinder('scope2')->bindSingleton('foo', (object) ['scope' => 'scope2']); |
|
171 | - $root->getBinder('scope2')->bindSingleton('bar', (object) ['from' => 'default']); |
|
170 | + $root->getBinder('scope2')->bindSingleton('foo', (object)['scope' => 'scope2']); |
|
171 | + $root->getBinder('scope2')->bindSingleton('bar', (object)['from' => 'default']); |
|
172 | 172 | |
173 | 173 | self::assertFalse($root->has('foo')); |
174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | self::assertTrue($c2->has('bar')); |
183 | 183 | self::assertSame('scope2', $c2->get('foo')->scope); |
184 | 184 | self::assertSame('custom', $c2->get('bar')->from); |
185 | - }, bindings: ['bar' => (object) ['from' => 'custom']], name: 'scope2'); |
|
185 | + }, bindings: ['bar' => (object)['from' => 'custom']], name: 'scope2'); |
|
186 | 186 | }, name: 'scope1'); |
187 | 187 | } |
188 | 188 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | // from the current `foo` scope |
48 | 48 | self::assertInstanceOf(KVLogger::class, $logger); |
49 | 49 | |
50 | - for ($i = 0; $i < 10; $i++) { |
|
50 | + for ($i = 0; $i < 10; $i++){ |
|
51 | 51 | // because of proxy |
52 | 52 | self::assertNotInstanceOf(KVLogger::class, $carrier->getLogger()); |
53 | 53 | self::assertSame('kv', $carrier->logger->getName()); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // from the current `foo` scope |
68 | 68 | self::assertInstanceOf(FileLogger::class, $logger); |
69 | 69 | |
70 | - for ($i = 0; $i < 10; $i++) { |
|
70 | + for ($i = 0; $i < 10; $i++){ |
|
71 | 71 | // because of proxy |
72 | 72 | self::assertNotInstanceOf(FileLogger::class, $carrier->getLogger()); |
73 | 73 | self::assertSame('file', $carrier->logger->getName()); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ->bind( |
136 | 136 | ContextInterface::class, |
137 | 137 | new \Spiral\Core\Config\Injectable( |
138 | - new class implements InjectorInterface { |
|
138 | + new class implements InjectorInterface{ |
|
139 | 139 | public function createInjection(\ReflectionClass $class, mixed $context = null): Context |
140 | 140 | { |
141 | 141 | return new Context($context); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | ->bind( |
177 | 177 | ContextInterface::class, |
178 | 178 | new \Spiral\Core\Config\Injectable( |
179 | - new class implements InjectorInterface { |
|
179 | + new class implements InjectorInterface{ |
|
180 | 180 | public function createInjection(\ReflectionClass $class, mixed $context = null): Context |
181 | 181 | { |
182 | 182 | return new Context($context); |
@@ -187,14 +187,14 @@ discard block |
||
187 | 187 | |
188 | 188 | FiberHelper::runFiberSequence( |
189 | 189 | static fn(): mixed => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx): void { |
190 | - for ($i = 0; $i < 10; $i++) { |
|
190 | + for ($i = 0; $i < 10; $i++){ |
|
191 | 191 | self::assertInstanceOf(\ReflectionParameter::class, $ctx->getValue(), 'Context injected'); |
192 | 192 | self::assertSame('ctx', $ctx->getValue()->getName()); |
193 | 193 | \Fiber::suspend(); |
194 | 194 | } |
195 | 195 | }), |
196 | 196 | static fn(): mixed => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context): void { |
197 | - for ($i = 0; $i < 10; $i++) { |
|
197 | + for ($i = 0; $i < 10; $i++){ |
|
198 | 198 | self::assertInstanceOf(\ReflectionParameter::class, $context->getValue(), 'Context injected'); |
199 | 199 | self::assertSame('context', $context->getValue()->getName()); |
200 | 200 | \Fiber::suspend(); |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | public function testDestroyMethod(): void |
255 | 255 | { |
256 | 256 | $root = new Container(); |
257 | - $context = (object) ['destroyed' => false]; |
|
258 | - $class = new class($context) implements DestroyableInterface { |
|
257 | + $context = (object)['destroyed' => false]; |
|
258 | + $class = new class($context) implements DestroyableInterface{ |
|
259 | 259 | public function __construct( |
260 | 260 | private readonly \stdClass $context, |
261 | - ) {} |
|
261 | + ){} |
|
262 | 262 | |
263 | 263 | public function __destruct() |
264 | 264 | { |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | new Scope('http'), |
286 | 286 | static function () use ($root, $proxy): void { |
287 | 287 | self::assertSame('Foo', $proxy->getName()); |
288 | - $proxy->setName(new class implements \Stringable { |
|
288 | + $proxy->setName(new class implements \Stringable{ |
|
289 | 289 | public function __toString(): string |
290 | 290 | { |
291 | 291 | return 'Bar'; |
@@ -47,7 +47,8 @@ discard block |
||
47 | 47 | // from the current `foo` scope |
48 | 48 | self::assertInstanceOf(KVLogger::class, $logger); |
49 | 49 | |
50 | - for ($i = 0; $i < 10; $i++) { |
|
50 | + for ($i = 0; $i < 10; $i++) |
|
51 | + { |
|
51 | 52 | // because of proxy |
52 | 53 | self::assertNotInstanceOf(KVLogger::class, $carrier->getLogger()); |
53 | 54 | self::assertSame('kv', $carrier->logger->getName()); |
@@ -67,7 +68,8 @@ discard block |
||
67 | 68 | // from the current `foo` scope |
68 | 69 | self::assertInstanceOf(FileLogger::class, $logger); |
69 | 70 | |
70 | - for ($i = 0; $i < 10; $i++) { |
|
71 | + for ($i = 0; $i < 10; $i++) |
|
72 | + { |
|
71 | 73 | // because of proxy |
72 | 74 | self::assertNotInstanceOf(FileLogger::class, $carrier->getLogger()); |
73 | 75 | self::assertSame('file', $carrier->logger->getName()); |
@@ -135,7 +137,8 @@ discard block |
||
135 | 137 | ->bind( |
136 | 138 | ContextInterface::class, |
137 | 139 | new \Spiral\Core\Config\Injectable( |
138 | - new class implements InjectorInterface { |
|
140 | + new class implements InjectorInterface |
|
141 | + { |
|
139 | 142 | public function createInjection(\ReflectionClass $class, mixed $context = null): Context |
140 | 143 | { |
141 | 144 | return new Context($context); |
@@ -176,7 +179,8 @@ discard block |
||
176 | 179 | ->bind( |
177 | 180 | ContextInterface::class, |
178 | 181 | new \Spiral\Core\Config\Injectable( |
179 | - new class implements InjectorInterface { |
|
182 | + new class implements InjectorInterface |
|
183 | + { |
|
180 | 184 | public function createInjection(\ReflectionClass $class, mixed $context = null): Context |
181 | 185 | { |
182 | 186 | return new Context($context); |
@@ -187,14 +191,16 @@ discard block |
||
187 | 191 | |
188 | 192 | FiberHelper::runFiberSequence( |
189 | 193 | static fn(): mixed => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx): void { |
190 | - for ($i = 0; $i < 10; $i++) { |
|
194 | + for ($i = 0; $i < 10; $i++) |
|
195 | + { |
|
191 | 196 | self::assertInstanceOf(\ReflectionParameter::class, $ctx->getValue(), 'Context injected'); |
192 | 197 | self::assertSame('ctx', $ctx->getValue()->getName()); |
193 | 198 | \Fiber::suspend(); |
194 | 199 | } |
195 | 200 | }), |
196 | 201 | static fn(): mixed => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context): void { |
197 | - for ($i = 0; $i < 10; $i++) { |
|
202 | + for ($i = 0; $i < 10; $i++) |
|
203 | + { |
|
198 | 204 | self::assertInstanceOf(\ReflectionParameter::class, $context->getValue(), 'Context injected'); |
199 | 205 | self::assertSame('context', $context->getValue()->getName()); |
200 | 206 | \Fiber::suspend(); |
@@ -255,10 +261,12 @@ discard block |
||
255 | 261 | { |
256 | 262 | $root = new Container(); |
257 | 263 | $context = (object) ['destroyed' => false]; |
258 | - $class = new class($context) implements DestroyableInterface { |
|
264 | + $class = new class($context) implements DestroyableInterface |
|
265 | + { |
|
259 | 266 | public function __construct( |
260 | 267 | private readonly \stdClass $context, |
261 | - ) {} |
|
268 | + ) { |
|
269 | +} |
|
262 | 270 | |
263 | 271 | public function __destruct() |
264 | 272 | { |