@@ -12,13 +12,13 @@ |
||
12 | 12 | { |
13 | 13 | public function testInternalServicesDontBlockContainer(): void |
14 | 14 | { |
15 | - (static function () { |
|
15 | + (static function (){ |
|
16 | 16 | $container = new Container(); |
17 | 17 | $finalizer = new class { |
18 | 18 | public ?\Closure $closure = null; |
19 | 19 | public function __destruct() |
20 | 20 | { |
21 | - if ($this->closure !== null) { |
|
21 | + if ($this->closure !== null){ |
|
22 | 22 | ($this->closure)(); |
23 | 23 | } |
24 | 24 | } |
@@ -12,18 +12,22 @@ |
||
12 | 12 | { |
13 | 13 | public function testInternalServicesDontBlockContainer(): void |
14 | 14 | { |
15 | - (static function () { |
|
15 | + (static function () |
|
16 | + { |
|
16 | 17 | $container = new Container(); |
17 | - $finalizer = new class { |
|
18 | + $finalizer = new class |
|
19 | + { |
|
18 | 20 | public ?\Closure $closure = null; |
19 | 21 | public function __destruct() |
20 | 22 | { |
21 | - if ($this->closure !== null) { |
|
23 | + if ($this->closure !== null) |
|
24 | + { |
|
22 | 25 | ($this->closure)(); |
23 | 26 | } |
24 | 27 | } |
25 | 28 | }; |
26 | - $finalizer->closure = static function () use ($container) { |
|
29 | + $finalizer->closure = static function () use ($container) |
|
30 | + { |
|
27 | 31 | $container->hasInstance('finalizer'); |
28 | 32 | }; |
29 | 33 | $container->bind('finalizer', $finalizer); |
@@ -36,9 +36,9 @@ |
||
36 | 36 | { |
37 | 37 | $map = new WeakMap(); |
38 | 38 | |
39 | - $fn = function (WeakMap $map) { |
|
40 | - foreach ($this as $key => $value) { |
|
41 | - if (\is_object($value)) { |
|
39 | + $fn = function (WeakMap $map){ |
|
40 | + foreach ($this as $key => $value){ |
|
41 | + if (\is_object($value)){ |
|
42 | 42 | $map->offsetSet($value, $key); |
43 | 43 | } |
44 | 44 | } |
@@ -36,9 +36,12 @@ |
||
36 | 36 | { |
37 | 37 | $map = new WeakMap(); |
38 | 38 | |
39 | - $fn = function (WeakMap $map) { |
|
40 | - foreach ($this as $key => $value) { |
|
41 | - if (\is_object($value)) { |
|
39 | + $fn = function (WeakMap $map) |
|
40 | + { |
|
41 | + foreach ($this as $key => $value) |
|
42 | + { |
|
43 | + if (\is_object($value)) |
|
44 | + { |
|
42 | 45 | $map->offsetSet($value, $key); |
43 | 46 | } |
44 | 47 | } |
@@ -85,7 +85,7 @@ |
||
85 | 85 | |
86 | 86 | public function testClosureFactory(): void |
87 | 87 | { |
88 | - $this->bind(Bucket::class, function ($data) { |
|
88 | + $this->bind(Bucket::class, function ($data){ |
|
89 | 89 | return new Bucket('via-closure', $data); |
90 | 90 | }); |
91 | 91 |
@@ -85,7 +85,8 @@ discard block |
||
85 | 85 | |
86 | 86 | public function testClosureFactory(): void |
87 | 87 | { |
88 | - $this->bind(Bucket::class, function ($data) { |
|
88 | + $this->bind(Bucket::class, function ($data) |
|
89 | + { |
|
89 | 90 | return new Bucket('via-closure', $data); |
90 | 91 | }); |
91 | 92 | |
@@ -125,7 +126,8 @@ discard block |
||
125 | 126 | $sample = new SampleClass(); |
126 | 127 | |
127 | 128 | $this->bind(Bucket::class, [self::class, 'makeBucketWithSample']); |
128 | - $this->bind(SampleClass::class, function () use ($sample) { |
|
129 | + $this->bind(SampleClass::class, function () use ($sample) |
|
130 | + { |
|
129 | 131 | return $sample; |
130 | 132 | }); |
131 | 133 |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function testClassWithNamespace(): void |
94 | 94 | { |
95 | 95 | $this->assertSame( |
96 | - 'function (?' . Container::class . ' ...$v)', |
|
96 | + 'function (?'.Container::class.' ...$v)', |
|
97 | 97 | $this->renderClosureForTesting(fn (?Container ...$v) => null), |
98 | 98 | ); |
99 | 99 | } |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | { |
103 | 103 | $this->assertSame( |
104 | 104 | 'function (self|string|int|null $v)', |
105 | - $this->renderClosureForTesting(fn (self|string|int|null $v) => null), |
|
105 | + $this->renderClosureForTesting(fn (self | string | int | null $v) => null), |
|
106 | 106 | ); |
107 | 107 | } |
108 | 108 | |
109 | 109 | public function testTypeIntersection(): void |
110 | 110 | { |
111 | 111 | $this->assertSame( |
112 | - 'function (' . ContainerInterface::class . '&' . ContainerExceptionInterface::class . ' $v)', |
|
112 | + 'function ('.ContainerInterface::class.'&'.ContainerExceptionInterface::class.' $v)', |
|
113 | 113 | $this->renderClosureForTesting(fn (ContainerInterface&ContainerExceptionInterface $v) => null), |
114 | 114 | ); |
115 | 115 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $this->assertSame( |
129 | 129 | 'function (Foo|Bar $v)', |
130 | - $this->renderClosureForTesting(fn (\Foo|\Bar $v) => null), |
|
130 | + $this->renderClosureForTesting(fn (\Foo | \Bar $v) => null), |
|
131 | 131 | ); |
132 | 132 | } |
133 | 133 |
@@ -13,6 +13,6 @@ |
||
13 | 13 | public bool $bool, |
14 | 14 | public array $array = [], |
15 | 15 | public ?string $pong = null |
16 | - ) { |
|
16 | + ){ |
|
17 | 17 | } |
18 | 18 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function testInvalidInjector(): void |
33 | 33 | { |
34 | - $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an " . |
|
34 | + $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an ". |
|
35 | 35 | "instance of InjectorInterface for 'Spiral\Tests\Core\Fixtures\TestConfig'"; |
36 | 36 | $this->expectException(InjectionException::class); |
37 | 37 | $this->expectExceptionMessage($excepted); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function testInvalidRuntimeInjector(): void |
57 | 57 | { |
58 | - $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an " . |
|
58 | + $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an ". |
|
59 | 59 | "instance of InjectorInterface for 'Spiral\Tests\Core\Fixtures\TestConfig'"; |
60 | 60 | $this->expectException(InjectionException::class); |
61 | 61 | $this->expectExceptionMessage($excepted); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $container->bind(ConfigsInterface::class, $configurator); |
103 | 103 | |
104 | 104 | $configurator->shouldReceive('createInjection') |
105 | - ->with(m::on(static function (ReflectionClass $r) { |
|
105 | + ->with(m::on(static function (ReflectionClass $r){ |
|
106 | 106 | return $r->getName() === TestConfig::class; |
107 | 107 | }), null) |
108 | 108 | ->andReturn($expected) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $container->bind(ConfigsInterface::class, $configurator); |
121 | 121 | |
122 | 122 | $configurator->shouldReceive('createInjection') |
123 | - ->with(m::on(static function (ReflectionClass $r) { |
|
123 | + ->with(m::on(static function (ReflectionClass $r){ |
|
124 | 124 | return $r->getName() === TestConfig::class; |
125 | 125 | }), 'context') |
126 | 126 | ->andReturn($expected) |
@@ -102,7 +102,8 @@ discard block |
||
102 | 102 | $container->bind(ConfigsInterface::class, $configurator); |
103 | 103 | |
104 | 104 | $configurator->shouldReceive('createInjection') |
105 | - ->with(m::on(static function (ReflectionClass $r) { |
|
105 | + ->with(m::on(static function (ReflectionClass $r) |
|
106 | + { |
|
106 | 107 | return $r->getName() === TestConfig::class; |
107 | 108 | }), null) |
108 | 109 | ->andReturn($expected) |
@@ -120,7 +121,8 @@ discard block |
||
120 | 121 | $container->bind(ConfigsInterface::class, $configurator); |
121 | 122 | |
122 | 123 | $configurator->shouldReceive('createInjection') |
123 | - ->with(m::on(static function (ReflectionClass $r) { |
|
124 | + ->with(m::on(static function (ReflectionClass $r) |
|
125 | + { |
|
124 | 126 | return $r->getName() === TestConfig::class; |
125 | 127 | }), 'context') |
126 | 128 | ->andReturn($expected) |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function __construct( |
10 | 10 | public LightEngine $engine |
11 | - ) { |
|
11 | + ){ |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | public function __call(string $name, array $arguments) |
@@ -10,6 +10,6 @@ |
||
10 | 10 | { |
11 | 11 | public function __construct( |
12 | 12 | private object $object = new stdClass() |
13 | - ) { |
|
13 | + ){ |
|
14 | 14 | } |
15 | 15 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->container->bindSingleton(Bucket::class, $bucket = new Bucket('foo')); |
96 | 96 | |
97 | 97 | $result = $this->container->invoke( |
98 | - static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz') { |
|
98 | + static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz'){ |
|
99 | 99 | return \compact('bucket', 'class', 'name', 'path'); |
100 | 100 | }, |
101 | 101 | ['name' => 'bar'] |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->expectErrorMessage('Unable to resolve required argument `name` when resolving'); |
114 | 114 | |
115 | 115 | $this->container->invoke( |
116 | - static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz') { |
|
116 | + static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz'){ |
|
117 | 117 | return \compact('bucket', 'class', 'name', 'path'); |
118 | 118 | }, |
119 | 119 | ['name' => 'bar'] |
@@ -95,7 +95,8 @@ discard block |
||
95 | 95 | $this->container->bindSingleton(Bucket::class, $bucket = new Bucket('foo')); |
96 | 96 | |
97 | 97 | $result = $this->container->invoke( |
98 | - static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz') { |
|
98 | + static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz') |
|
99 | + { |
|
99 | 100 | return \compact('bucket', 'class', 'name', 'path'); |
100 | 101 | }, |
101 | 102 | ['name' => 'bar'] |
@@ -113,7 +114,8 @@ discard block |
||
113 | 114 | $this->expectErrorMessage('Unable to resolve required argument `name` when resolving'); |
114 | 115 | |
115 | 116 | $this->container->invoke( |
116 | - static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz') { |
|
117 | + static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz') |
|
118 | + { |
|
117 | 119 | return \compact('bucket', 'class', 'name', 'path'); |
118 | 120 | }, |
119 | 121 | ['name' => 'bar'] |