Test Failed
Pull Request — master (#1127)
by Aleksei
11:30
created
src/Core/tests/Scope/ProxyTest.php 1 patch
Braces   +38 added lines, -19 removed lines patch added patch discarded remove patch
@@ -42,11 +42,13 @@  discard block
 block discarded – undo
42 42
                         LoggerInterface::class => KVLogger::class,
43 43
                     ],
44 44
                 ),
45
-                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc) {
45
+                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc)
46
+                {
46 47
                     // from the current `foo` scope
47 48
                     self::assertInstanceOf(KVLogger::class, $logger);
48 49
 
49
-                    for ($i = 0; $i < 10; $i++) {
50
+                    for ($i = 0; $i < 10; $i++)
51
+                    {
50 52
                         // because of proxy
51 53
                         self::assertNotInstanceOf(KVLogger::class, $carrier->getLogger());
52 54
                         self::assertSame('kv', $carrier->logger->getName());
@@ -62,11 +64,13 @@  discard block
 block discarded – undo
62 64
                         LoggerInterface::class => FileLogger::class,
63 65
                     ],
64 66
                 ),
65
-                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc) {
67
+                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc)
68
+                {
66 69
                     // from the current `foo` scope
67 70
                     self::assertInstanceOf(FileLogger::class, $logger);
68 71
 
69
-                    for ($i = 0; $i < 10; $i++) {
72
+                    for ($i = 0; $i < 10; $i++)
73
+                    {
70 74
                         // because of proxy
71 75
                         self::assertNotInstanceOf(FileLogger::class, $carrier->getLogger());
72 76
                         self::assertSame('file', $carrier->logger->getName());
@@ -83,7 +87,8 @@  discard block
 block discarded – undo
83 87
         $root = new Container();
84 88
         $root->getBinder('http')->bindSingleton(LoggerInterface::class, KVLogger::class);
85 89
 
86
-        $root->runScope(new Scope(), static function (Container $c1) {
90
+        $root->runScope(new Scope(), static function (Container $c1)
91
+        {
87 92
             $c1->runScope(
88 93
                 new Scope(name: 'http'),
89 94
                 static function (
@@ -110,10 +115,12 @@  discard block
 block discarded – undo
110 115
         $root = new Container();
111 116
         $root->getBinder('foo')->bind(LoggerInterface::class, KVLogger::class);
112 117
 
113
-        $root->runScope(new Scope(), static function (Container $c1) {
118
+        $root->runScope(new Scope(), static function (Container $c1)
119
+        {
114 120
             $c1->runScope(
115 121
                 new Scope(name: 'foo'),
116
-                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) {
122
+                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger)
123
+                {
117 124
                     // from the current `foo` scope
118 125
                     self::assertInstanceOf(KVLogger::class, $logger);
119 126
 
@@ -134,7 +141,8 @@  discard block
 block discarded – undo
134 141
             ->bind(
135 142
                 ContextInterface::class,
136 143
                 new \Spiral\Core\Config\Injectable(
137
-                    new class implements InjectorInterface {
144
+                    new class implements InjectorInterface
145
+                    {
138 146
                         public function createInjection(\ReflectionClass $class, mixed $context = null): Context
139 147
                         {
140 148
                             return new Context($context);
@@ -143,8 +151,10 @@  discard block
 block discarded – undo
143 151
                 ),
144 152
             );
145 153
 
146
-        $root->runScope(new Scope(), static function (Container $c1) {
147
-            $c1->runScope(new Scope(name: 'foo'), static function (Container $c, ContextInterface $param) {
154
+        $root->runScope(new Scope(), static function (Container $c1)
155
+        {
156
+            $c1->runScope(new Scope(name: 'foo'), static function (Container $c, ContextInterface $param)
157
+            {
148 158
                 self::assertInstanceOf(ReflectionParameter::class, $param->value);
149 159
                 self::assertSame('param', $param->value->getName());
150 160
 
@@ -175,7 +185,8 @@  discard block
 block discarded – undo
175 185
             ->bind(
176 186
                 ContextInterface::class,
177 187
                 new \Spiral\Core\Config\Injectable(
178
-                    new class implements InjectorInterface {
188
+                    new class implements InjectorInterface
189
+                    {
179 190
                         public function createInjection(\ReflectionClass $class, mixed $context = null): Context
180 191
                         {
181 192
                             return new Context($context);
@@ -185,15 +196,19 @@  discard block
 block discarded – undo
185 196
             );
186 197
 
187 198
         FiberHelper::runFiberSequence(
188
-            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx) {
189
-                for ($i = 0; $i < 10; $i++) {
199
+            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx)
200
+            {
201
+                for ($i = 0; $i < 10; $i++)
202
+                {
190 203
                     self::assertInstanceOf(ReflectionParameter::class, $ctx->getValue(), 'Context injected');
191 204
                     self::assertSame('ctx', $ctx->getValue()->getName());
192 205
                     \Fiber::suspend();
193 206
                 }
194 207
             }),
195
-            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context) {
196
-                for ($i = 0; $i < 10; $i++) {
208
+            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context)
209
+            {
210
+                for ($i = 0; $i < 10; $i++)
211
+                {
197 212
                     self::assertInstanceOf(ReflectionParameter::class, $context->getValue(), 'Context injected');
198 213
                     self::assertSame('context', $context->getValue()->getName());
199 214
                     \Fiber::suspend();
@@ -209,8 +224,10 @@  discard block
 block discarded – undo
209 224
 
210 225
         $root->runScope(
211 226
             new Scope(),
212
-            static function (#[Proxy] ContainerInterface $cp) use ($root) {
213
-                $root->runScope(new Scope(name: 'http'), static function (ContainerInterface $c) use ($cp) {
227
+            static function (#[Proxy] ContainerInterface $cp) use ($root)
228
+            {
229
+                $root->runScope(new Scope(name: 'http'), static function (ContainerInterface $c) use ($cp)
230
+                {
214 231
                     self::assertNotSame($c, $cp);
215 232
                     self::assertSame($c, $cp->get(ContainerInterface::class));
216 233
                     self::assertInstanceOf(KVLogger::class, $cp->get(LoggerInterface::class));
@@ -254,7 +271,8 @@  discard block
 block discarded – undo
254 271
     {
255 272
         $root = new Container();
256 273
         $context = (object)['destroyed' => false];
257
-        $class = new class($context) implements DestroyableInterface {
274
+        $class = new class($context) implements DestroyableInterface
275
+        {
258 276
             public function __construct(
259 277
                 private readonly \stdClass $context,
260 278
             ) {
@@ -283,7 +301,8 @@  discard block
 block discarded – undo
283 301
 
284 302
         $root->runScope(
285 303
             new Scope('http'),
286
-            static function () use ($root, $proxy) {
304
+            static function () use ($root, $proxy)
305
+            {
287 306
                 self::assertSame('Foo', $proxy->getName());
288 307
                 $proxy->setName(new class implements \Stringable {
289 308
                     public function __toString(): string
Please login to merge, or discard this patch.