Passed
Push — master ( 7bd689...ed0e19 )
by butschster
16:50 queued 18s
created
src/Core/tests/Scope/ProxyTest.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                     // from the current `foo` scope
45 45
                     self::assertInstanceOf(KVLogger::class, $logger);
46 46
 
47
-                    for ($i = 0; $i < 10; $i++) {
47
+                    for ($i = 0; $i < 10; $i++){
48 48
                         // because of proxy
49 49
                         self::assertNotInstanceOf(KVLogger::class, $carrier->getLogger());
50 50
                         self::assertSame('kv', $carrier->logger->getName());
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                     // from the current `foo` scope
65 65
                     self::assertInstanceOf(FileLogger::class, $logger);
66 66
 
67
-                    for ($i = 0; $i < 10; $i++) {
67
+                    for ($i = 0; $i < 10; $i++){
68 68
                         // because of proxy
69 69
                         self::assertNotInstanceOf(FileLogger::class, $carrier->getLogger());
70 70
                         self::assertSame('file', $carrier->logger->getName());
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
         $root = new Container();
82 82
         $root->getBinder('http')->bindSingleton(LoggerInterface::class, KVLogger::class);
83 83
 
84
-        $root->runScope(new Scope(), static function (Container $c1) {
84
+        $root->runScope(new Scope(), static function (Container $c1){
85 85
             $c1->runScope(
86 86
                 new Scope(name: 'http'),
87 87
                 static function (
88 88
                     ScopedProxyLoggerCarrier $carrier,
89 89
                     ScopedProxyLoggerCarrier $carrier2,
90 90
                     LoggerInterface $logger
91
-                ) {
91
+                ){
92 92
                     // from the current `foo` scope
93 93
                     self::assertInstanceOf(KVLogger::class, $logger);
94 94
 
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
         $root = new Container();
109 109
         $root->getBinder('foo')->bind(LoggerInterface::class, KVLogger::class);
110 110
 
111
-        $root->runScope(new Scope(), static function (Container $c1) {
111
+        $root->runScope(new Scope(), static function (Container $c1){
112 112
             $c1->runScope(
113 113
                 new Scope(name: 'foo'),
114
-                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) {
114
+                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger){
115 115
                     // from the current `foo` scope
116 116
                     self::assertInstanceOf(KVLogger::class, $logger);
117 117
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             ->bind(
133 133
                 ContextInterface::class,
134 134
                 new \Spiral\Core\Config\Injectable(
135
-                    new class implements InjectorInterface {
135
+                    new class implements InjectorInterface{
136 136
                         public function createInjection(\ReflectionClass $class, mixed $context = null): Context
137 137
                         {
138 138
                             return new Context($context);
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
                 )
142 142
             );
143 143
 
144
-        $root->runScope(new Scope(), static function (Container $c1) {
145
-            $c1->runScope(new Scope(name: 'foo'), static function (Container $c, ContextInterface $param) {
144
+        $root->runScope(new Scope(), static function (Container $c1){
145
+            $c1->runScope(new Scope(name: 'foo'), static function (Container $c, ContextInterface $param){
146 146
                 self::assertInstanceOf(ReflectionParameter::class, $param->value);
147 147
                 self::assertSame('param', $param->value->getName());
148 148
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             ->bind(
174 174
                 ContextInterface::class,
175 175
                 new \Spiral\Core\Config\Injectable(
176
-                    new class implements InjectorInterface {
176
+                    new class implements InjectorInterface{
177 177
                         public function createInjection(\ReflectionClass $class, mixed $context = null): Context
178 178
                         {
179 179
                             return new Context($context);
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
             );
184 184
 
185 185
         FiberHelper::runFiberSequence(
186
-            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx) {
187
-                for ($i = 0; $i < 10; $i++) {
186
+            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx){
187
+                for ($i = 0; $i < 10; $i++){
188 188
                     self::assertInstanceOf(ReflectionParameter::class, $ctx->getValue(), 'Context injected');
189 189
                     self::assertSame('ctx', $ctx->getValue()->getName());
190 190
                     \Fiber::suspend();
191 191
                 }
192 192
             }),
193
-            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context) {
194
-                for ($i = 0; $i < 10; $i++) {
193
+            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context){
194
+                for ($i = 0; $i < 10; $i++){
195 195
                     self::assertInstanceOf(ReflectionParameter::class, $context->getValue(), 'Context injected');
196 196
                     self::assertSame('context', $context->getValue()->getName());
197 197
                     \Fiber::suspend();
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
     {
253 253
         $root = new Container();
254 254
         $context = (object)['destroyed' => false];
255
-        $class = new class($context) implements DestroyableInterface {
255
+        $class = new class($context) implements DestroyableInterface{
256 256
             public function __construct(
257 257
                 private readonly \stdClass $context,
258
-            ) {
258
+            ){
259 259
             }
260 260
 
261 261
             public function __destruct()
Please login to merge, or discard this patch.
Braces   +36 added lines, -18 removed lines patch added patch discarded remove patch
@@ -40,11 +40,13 @@  discard block
 block discarded – undo
40 40
                         LoggerInterface::class => KVLogger::class,
41 41
                     ],
42 42
                 ),
43
-                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc) {
43
+                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc)
44
+                {
44 45
                     // from the current `foo` scope
45 46
                     self::assertInstanceOf(KVLogger::class, $logger);
46 47
 
47
-                    for ($i = 0; $i < 10; $i++) {
48
+                    for ($i = 0; $i < 10; $i++)
49
+                    {
48 50
                         // because of proxy
49 51
                         self::assertNotInstanceOf(KVLogger::class, $carrier->getLogger());
50 52
                         self::assertSame('kv', $carrier->logger->getName());
@@ -60,11 +62,13 @@  discard block
 block discarded – undo
60 62
                         LoggerInterface::class => FileLogger::class,
61 63
                     ],
62 64
                 ),
63
-                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc) {
65
+                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) use ($lc)
66
+                {
64 67
                     // from the current `foo` scope
65 68
                     self::assertInstanceOf(FileLogger::class, $logger);
66 69
 
67
-                    for ($i = 0; $i < 10; $i++) {
70
+                    for ($i = 0; $i < 10; $i++)
71
+                    {
68 72
                         // because of proxy
69 73
                         self::assertNotInstanceOf(FileLogger::class, $carrier->getLogger());
70 74
                         self::assertSame('file', $carrier->logger->getName());
@@ -81,7 +85,8 @@  discard block
 block discarded – undo
81 85
         $root = new Container();
82 86
         $root->getBinder('http')->bindSingleton(LoggerInterface::class, KVLogger::class);
83 87
 
84
-        $root->runScope(new Scope(), static function (Container $c1) {
88
+        $root->runScope(new Scope(), static function (Container $c1)
89
+        {
85 90
             $c1->runScope(
86 91
                 new Scope(name: 'http'),
87 92
                 static function (
@@ -108,10 +113,12 @@  discard block
 block discarded – undo
108 113
         $root = new Container();
109 114
         $root->getBinder('foo')->bind(LoggerInterface::class, KVLogger::class);
110 115
 
111
-        $root->runScope(new Scope(), static function (Container $c1) {
116
+        $root->runScope(new Scope(), static function (Container $c1)
117
+        {
112 118
             $c1->runScope(
113 119
                 new Scope(name: 'foo'),
114
-                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger) {
120
+                static function (ScopedProxyLoggerCarrier $carrier, LoggerInterface $logger)
121
+                {
115 122
                     // from the current `foo` scope
116 123
                     self::assertInstanceOf(KVLogger::class, $logger);
117 124
 
@@ -132,7 +139,8 @@  discard block
 block discarded – undo
132 139
             ->bind(
133 140
                 ContextInterface::class,
134 141
                 new \Spiral\Core\Config\Injectable(
135
-                    new class implements InjectorInterface {
142
+                    new class implements InjectorInterface
143
+                    {
136 144
                         public function createInjection(\ReflectionClass $class, mixed $context = null): Context
137 145
                         {
138 146
                             return new Context($context);
@@ -141,8 +149,10 @@  discard block
 block discarded – undo
141 149
                 )
142 150
             );
143 151
 
144
-        $root->runScope(new Scope(), static function (Container $c1) {
145
-            $c1->runScope(new Scope(name: 'foo'), static function (Container $c, ContextInterface $param) {
152
+        $root->runScope(new Scope(), static function (Container $c1)
153
+        {
154
+            $c1->runScope(new Scope(name: 'foo'), static function (Container $c, ContextInterface $param)
155
+            {
146 156
                 self::assertInstanceOf(ReflectionParameter::class, $param->value);
147 157
                 self::assertSame('param', $param->value->getName());
148 158
 
@@ -173,7 +183,8 @@  discard block
 block discarded – undo
173 183
             ->bind(
174 184
                 ContextInterface::class,
175 185
                 new \Spiral\Core\Config\Injectable(
176
-                    new class implements InjectorInterface {
186
+                    new class implements InjectorInterface
187
+                    {
177 188
                         public function createInjection(\ReflectionClass $class, mixed $context = null): Context
178 189
                         {
179 190
                             return new Context($context);
@@ -183,15 +194,19 @@  discard block
 block discarded – undo
183 194
             );
184 195
 
185 196
         FiberHelper::runFiberSequence(
186
-            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx) {
187
-                for ($i = 0; $i < 10; $i++) {
197
+            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $ctx)
198
+            {
199
+                for ($i = 0; $i < 10; $i++)
200
+                {
188 201
                     self::assertInstanceOf(ReflectionParameter::class, $ctx->getValue(), 'Context injected');
189 202
                     self::assertSame('ctx', $ctx->getValue()->getName());
190 203
                     \Fiber::suspend();
191 204
                 }
192 205
             }),
193
-            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context) {
194
-                for ($i = 0; $i < 10; $i++) {
206
+            static fn() => $root->runScope(new Scope(name: 'foo'), static function (ContextInterface $context)
207
+            {
208
+                for ($i = 0; $i < 10; $i++)
209
+                {
195 210
                     self::assertInstanceOf(ReflectionParameter::class, $context->getValue(), 'Context injected');
196 211
                     self::assertSame('context', $context->getValue()->getName());
197 212
                     \Fiber::suspend();
@@ -207,8 +222,10 @@  discard block
 block discarded – undo
207 222
 
208 223
         $root->runScope(
209 224
             new Scope(),
210
-            static function (#[Proxy] ContainerInterface $cp) use ($root) {
211
-                $root->runScope(new Scope(name: 'http'), static function (ContainerInterface $c) use ($cp) {
225
+            static function (#[Proxy] ContainerInterface $cp) use ($root)
226
+            {
227
+                $root->runScope(new Scope(name: 'http'), static function (ContainerInterface $c) use ($cp)
228
+                {
212 229
                     self::assertNotSame($c, $cp);
213 230
                     self::assertSame($c, $cp->get(ContainerInterface::class));
214 231
                     self::assertInstanceOf(KVLogger::class, $cp->get(LoggerInterface::class));
@@ -252,7 +269,8 @@  discard block
 block discarded – undo
252 269
     {
253 270
         $root = new Container();
254 271
         $context = (object)['destroyed' => false];
255
-        $class = new class($context) implements DestroyableInterface {
272
+        $class = new class($context) implements DestroyableInterface
273
+        {
256 274
             public function __construct(
257 275
                 private readonly \stdClass $context,
258 276
             ) {
Please login to merge, or discard this patch.