@@ -22,59 +22,59 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | return RectorConfig::configure() |
| 24 | 24 | ->withPaths([ |
| 25 | - __DIR__ . '/src/*/src', |
|
| 26 | - __DIR__ . '/src/*/tests', |
|
| 27 | - __DIR__ . '/tests', |
|
| 25 | + __DIR__.'/src/*/src', |
|
| 26 | + __DIR__.'/src/*/tests', |
|
| 27 | + __DIR__.'/tests', |
|
| 28 | 28 | ]) |
| 29 | 29 | ->withParallel() |
| 30 | 30 | ->withSkip([ |
| 31 | 31 | IfIssetToCoalescingRector::class, |
| 32 | 32 | RemoveUnusedPrivatePropertyRector::class => [ |
| 33 | - __DIR__ . '/src/Scaffolder/src/Command/BootloaderCommand.php', |
|
| 34 | - __DIR__ . '/src/Scaffolder/src/Command/CommandCommand.php', |
|
| 35 | - __DIR__ . '/src/Scaffolder/src/Command/ConfigCommand.php', |
|
| 36 | - __DIR__ . '/src/Scaffolder/src/Command/ControllerCommand.php', |
|
| 37 | - __DIR__ . '/src/Scaffolder/src/Command/FilterCommand.php', |
|
| 38 | - __DIR__ . '/src/Scaffolder/src/Command/JobHandlerCommand.php', |
|
| 39 | - __DIR__ . '/src/Scaffolder/src/Command/MiddlewareCommand.php', |
|
| 40 | - __DIR__ . '/src/Console/tests/PromptArgumentsTest.php', |
|
| 33 | + __DIR__.'/src/Scaffolder/src/Command/BootloaderCommand.php', |
|
| 34 | + __DIR__.'/src/Scaffolder/src/Command/CommandCommand.php', |
|
| 35 | + __DIR__.'/src/Scaffolder/src/Command/ConfigCommand.php', |
|
| 36 | + __DIR__.'/src/Scaffolder/src/Command/ControllerCommand.php', |
|
| 37 | + __DIR__.'/src/Scaffolder/src/Command/FilterCommand.php', |
|
| 38 | + __DIR__.'/src/Scaffolder/src/Command/JobHandlerCommand.php', |
|
| 39 | + __DIR__.'/src/Scaffolder/src/Command/MiddlewareCommand.php', |
|
| 40 | + __DIR__.'/src/Console/tests/PromptArgumentsTest.php', |
|
| 41 | 41 | ], |
| 42 | 42 | RemoveUnusedPrivateMethodRector::class => [ |
| 43 | - __DIR__ . '/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
| 44 | - __DIR__ . '/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php', |
|
| 45 | - __DIR__ . '/src/Cache/src/Bootloader/CacheBootloader.php', |
|
| 46 | - __DIR__ . '/src/Serializer/src/Bootloader/SerializerBootloader.php', |
|
| 47 | - __DIR__ . '/src/Validation/src/Bootloader/ValidationBootloader.php', |
|
| 48 | - __DIR__ . '/src/Translator/tests/IndexerTest.php', |
|
| 49 | - __DIR__ . '/src/Tokenizer/tests/ReflectionFileTest.php', |
|
| 50 | - __DIR__ . '/src/Core/tests/SingletonsTest.php', |
|
| 43 | + __DIR__.'/src/Boot/src/Bootloader/ConfigurationBootloader.php', |
|
| 44 | + __DIR__.'/src/Broadcasting/src/Bootloader/BroadcastingBootloader.php', |
|
| 45 | + __DIR__.'/src/Cache/src/Bootloader/CacheBootloader.php', |
|
| 46 | + __DIR__.'/src/Serializer/src/Bootloader/SerializerBootloader.php', |
|
| 47 | + __DIR__.'/src/Validation/src/Bootloader/ValidationBootloader.php', |
|
| 48 | + __DIR__.'/src/Translator/tests/IndexerTest.php', |
|
| 49 | + __DIR__.'/src/Tokenizer/tests/ReflectionFileTest.php', |
|
| 50 | + __DIR__.'/src/Core/tests/SingletonsTest.php', |
|
| 51 | 51 | ], |
| 52 | 52 | RemoveUselessVarTagRector::class => [ |
| 53 | - __DIR__ . '/src/Console/src/Traits/HelpersTrait.php', |
|
| 53 | + __DIR__.'/src/Console/src/Traits/HelpersTrait.php', |
|
| 54 | 54 | ], |
| 55 | 55 | RemoveAlwaysTrueIfConditionRector::class => [ |
| 56 | - __DIR__ . '/src/Boot/src/BootloadManager/Initializer.php', |
|
| 57 | - __DIR__ . '/src/Stempler/src/Traverser.php', |
|
| 58 | - __DIR__ . '/src/Prototype/src/NodeVisitors/LocateProperties.php', |
|
| 59 | - __DIR__ . '/src/Prototype/src/NodeVisitors/RemoveTrait.php', |
|
| 60 | - __DIR__ . '/src/Logger/src/ListenerRegistry.php', |
|
| 61 | - __DIR__ . '/src/Stempler/src/Transform/Merge/ExtendsParent.php', |
|
| 56 | + __DIR__.'/src/Boot/src/BootloadManager/Initializer.php', |
|
| 57 | + __DIR__.'/src/Stempler/src/Traverser.php', |
|
| 58 | + __DIR__.'/src/Prototype/src/NodeVisitors/LocateProperties.php', |
|
| 59 | + __DIR__.'/src/Prototype/src/NodeVisitors/RemoveTrait.php', |
|
| 60 | + __DIR__.'/src/Logger/src/ListenerRegistry.php', |
|
| 61 | + __DIR__.'/src/Stempler/src/Transform/Merge/ExtendsParent.php', |
|
| 62 | 62 | ], |
| 63 | 63 | RemoveExtraParametersRector::class => [ |
| 64 | - __DIR__ . '/src/Boot/src/BootloadManager/AbstractBootloadManager.php', |
|
| 64 | + __DIR__.'/src/Boot/src/BootloadManager/AbstractBootloadManager.php', |
|
| 65 | 65 | ], |
| 66 | 66 | RemoveUnusedPrivateMethodParameterRector::class => [ |
| 67 | - __DIR__ . '/src/Core/src/Internal/Factory.php', |
|
| 68 | - __DIR__ . '/src/Core/tests/InjectableTest.php', |
|
| 67 | + __DIR__.'/src/Core/src/Internal/Factory.php', |
|
| 68 | + __DIR__.'/src/Core/tests/InjectableTest.php', |
|
| 69 | 69 | ], |
| 70 | 70 | RemoveDoubleAssignRector::class => [ |
| 71 | - __DIR__ . '/src/Core/tests/Scope/FinalizeAttributeTest.php', |
|
| 71 | + __DIR__.'/src/Core/tests/Scope/FinalizeAttributeTest.php', |
|
| 72 | 72 | ], |
| 73 | 73 | RemoveUnusedVariableAssignRector::class => [ |
| 74 | - __DIR__ . '/src/Core/tests/ExceptionsTest.php', |
|
| 74 | + __DIR__.'/src/Core/tests/ExceptionsTest.php', |
|
| 75 | 75 | ], |
| 76 | 76 | RemoveDeadStmtRector::class => [ |
| 77 | - __DIR__ . '/src/Core/tests/ExceptionsTest.php', |
|
| 77 | + __DIR__.'/src/Core/tests/ExceptionsTest.php', |
|
| 78 | 78 | ], |
| 79 | 79 | |
| 80 | 80 | // to be enabled later for bc break 4.x |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | NewInInitializerRector::class, |
| 85 | 85 | |
| 86 | 86 | // start with short open tag |
| 87 | - __DIR__ . '/src/Views/tests/fixtures/other/var.php', |
|
| 88 | - __DIR__ . '/tests/app/views/native.php', |
|
| 87 | + __DIR__.'/src/Views/tests/fixtures/other/var.php', |
|
| 88 | + __DIR__.'/tests/app/views/native.php', |
|
| 89 | 89 | |
| 90 | 90 | // example code for test |
| 91 | 91 | '*/Fixture/*', |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | '*/Stubs/*', |
| 96 | 96 | '*/tests/Classes/*', |
| 97 | 97 | '*/tests/Internal/*', |
| 98 | - __DIR__ . '/src/Console/tests/Configurator', |
|
| 98 | + __DIR__.'/src/Console/tests/Configurator', |
|
| 99 | 99 | |
| 100 | 100 | // cache |
| 101 | 101 | '*/runtime/cache/*', |
| 102 | 102 | |
| 103 | 103 | ReadOnlyPropertyRector::class => [ |
| 104 | 104 | // used by Configurator |
| 105 | - __DIR__ . '/src/Scaffolder/src/Command', |
|
| 105 | + __DIR__.'/src/Scaffolder/src/Command', |
|
| 106 | 106 | ], |
| 107 | 107 | ]) |
| 108 | 108 | ->withPhpSets(php81: true) |
@@ -34,7 +34,8 @@ discard block |
||
| 34 | 34 | $root = new Container(); |
| 35 | 35 | $root->bind('foo', SampleClass::class); |
| 36 | 36 | |
| 37 | - $root->runScoped(function (ContainerInterface $c1) { |
|
| 37 | + $root->runScoped(function (ContainerInterface $c1) |
|
| 38 | + { |
|
| 38 | 39 | $c1->get('foo'); |
| 39 | 40 | }, bindings: ['foo' => SampleClass::class]); |
| 40 | 41 | |
@@ -67,7 +68,8 @@ discard block |
||
| 67 | 68 | { |
| 68 | 69 | $root = new Container(); |
| 69 | 70 | |
| 70 | - $root->runScoped(function (ContainerInterface $c1) use ($theSame, $alias) { |
|
| 71 | + $root->runScoped(function (ContainerInterface $c1) use ($theSame, $alias) |
|
| 72 | + { |
|
| 71 | 73 | $obj1 = $c1->get($alias); |
| 72 | 74 | $obj2 = $c1->get($alias); |
| 73 | 75 | |
@@ -92,14 +94,16 @@ discard block |
||
| 92 | 94 | { |
| 93 | 95 | $root = new Container(); |
| 94 | 96 | |
| 95 | - $root->runScoped(function (ContainerInterface $c1) use ($root) { |
|
| 97 | + $root->runScoped(function (ContainerInterface $c1) use ($root) |
|
| 98 | + { |
|
| 96 | 99 | $obj1 = $c1->get('foo'); |
| 97 | 100 | $this->weakMap->offsetSet($obj1, true); |
| 98 | 101 | |
| 99 | 102 | self::assertNotSame($root, $c1); |
| 100 | 103 | self::assertInstanceOf(stdClass::class, $obj1); |
| 101 | 104 | |
| 102 | - $c1->runScoped(function (ContainerInterface $c2) use ($root, $c1, $obj1) { |
|
| 105 | + $c1->runScoped(function (ContainerInterface $c2) use ($root, $c1, $obj1) |
|
| 106 | + { |
|
| 103 | 107 | $obj2 = $c2->get('foo'); |
| 104 | 108 | $this->weakMap->offsetSet($obj2, true); |
| 105 | 109 | |
@@ -128,14 +132,16 @@ discard block |
||
| 128 | 132 | $root->bindSingleton('bar', (new Factory())->makeStdClass(...)); |
| 129 | 133 | $root->bind(stdClass::class, new stdClass()); |
| 130 | 134 | |
| 131 | - $root->runScoped(function (ContainerInterface $c1) use ($root) { |
|
| 135 | + $root->runScoped(function (ContainerInterface $c1) use ($root) |
|
| 136 | + { |
|
| 132 | 137 | $obj1 = $c1->get('foo'); |
| 133 | 138 | $this->weakMap->offsetSet($obj1, true); |
| 134 | 139 | |
| 135 | 140 | self::assertInstanceOf(stdClass::class, $obj1); |
| 136 | 141 | // Singleton must be the same |
| 137 | 142 | self::assertSame($c1->get('bar'), $root->get('bar')); |
| 138 | - $c1->runScoped(function (ContainerInterface $c2) use ($root, $obj1) { |
|
| 143 | + $c1->runScoped(function (ContainerInterface $c2) use ($root, $obj1) |
|
| 144 | + { |
|
| 139 | 145 | $obj2 = $c2->get('foo'); |
| 140 | 146 | |
| 141 | 147 | self::assertInstanceOf(stdClass::class, $obj2); |
@@ -268,7 +274,8 @@ discard block |
||
| 268 | 274 | { |
| 269 | 275 | $root = new Container(); |
| 270 | 276 | |
| 271 | - $root->invoke(static function () use ($root) { |
|
| 277 | + $root->invoke(static function () use ($root) |
|
| 278 | + { |
|
| 272 | 279 | self::assertNotNull(\Spiral\Core\ContainerScope::getContainer()); |
| 273 | 280 | self::assertSame($root, \Spiral\Core\ContainerScope::getContainer()); |
| 274 | 281 | }); |
@@ -277,7 +284,8 @@ discard block |
||
| 277 | 284 | public function testRegisterContainerOnGet(): void |
| 278 | 285 | { |
| 279 | 286 | $root = new Container(); |
| 280 | - $root->bind('foo', function () use ($root) { |
|
| 287 | + $root->bind('foo', function () use ($root) |
|
| 288 | + { |
|
| 281 | 289 | self::assertNotNull(\Spiral\Core\ContainerScope::getContainer()); |
| 282 | 290 | self::assertSame($root, \Spiral\Core\ContainerScope::getContainer()); |
| 283 | 291 | }); |
@@ -288,7 +296,8 @@ discard block |
||
| 288 | 296 | public function testRegisterContainerOnMake(): void |
| 289 | 297 | { |
| 290 | 298 | $root = new Container(); |
| 291 | - $root->bind('foo', function () use ($root) { |
|
| 299 | + $root->bind('foo', function () use ($root) |
|
| 300 | + { |
|
| 292 | 301 | self::assertNotNull(\Spiral\Core\ContainerScope::getContainer()); |
| 293 | 302 | self::assertSame($root, \Spiral\Core\ContainerScope::getContainer()); |
| 294 | 303 | }); |
@@ -306,7 +315,8 @@ discard block |
||
| 306 | 315 | $root->bind('isFoo', new Scalar(false)); |
| 307 | 316 | $root->getBinder('foo')->bind('isFoo', new Scalar(true)); |
| 308 | 317 | |
| 309 | - $root->bind('foo', function (#[Proxy] ContainerInterface $c, ContainerInterface $r) use ($root) { |
|
| 318 | + $root->bind('foo', function (#[Proxy] ContainerInterface $c, ContainerInterface $r) use ($root) |
|
| 319 | + { |
|
| 310 | 320 | // Direct |
| 311 | 321 | self::assertNotNull(\Spiral\Core\ContainerScope::getContainer()); |
| 312 | 322 | self::assertNotSame($root, \Spiral\Core\ContainerScope::getContainer()); |
@@ -321,7 +331,8 @@ discard block |
||
| 321 | 331 | |
| 322 | 332 | $root->runScope( |
| 323 | 333 | new Scope('foo'), |
| 324 | - function (ContainerInterface $c) { |
|
| 334 | + function (ContainerInterface $c) |
|
| 335 | + { |
|
| 325 | 336 | self::assertTrue($c->get('isFoo')); |
| 326 | 337 | $c->get('foo'); |
| 327 | 338 | } |
@@ -334,7 +345,8 @@ discard block |
||
| 334 | 345 | $root = new Container(); |
| 335 | 346 | $root->getBinder($scope)->bindSingleton('foo', SampleClass::class); |
| 336 | 347 | |
| 337 | - $root->runScope(new Scope($scope), function (Container $container) { |
|
| 348 | + $root->runScope(new Scope($scope), function (Container $container) |
|
| 349 | + { |
|
| 338 | 350 | $this->assertTrue($container->has('foo')); |
| 339 | 351 | $this->assertInstanceOf(SampleClass::class, $container->get('foo')); |
| 340 | 352 | }); |
@@ -346,20 +358,25 @@ discard block |
||
| 346 | 358 | $root = new Container(); |
| 347 | 359 | $root->bindSingleton('sampleClass', SampleClass::class); |
| 348 | 360 | |
| 349 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 361 | + $root->runScope(new Scope('foo'), function (Container $container) |
|
| 362 | + { |
|
| 350 | 363 | $this->assertTrue($container->has('sampleClass')); |
| 351 | 364 | }); |
| 352 | 365 | |
| 353 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 354 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 366 | + $root->runScope(new Scope('foo'), function (Container $container) |
|
| 367 | + { |
|
| 368 | + $container->runScope(new Scope('bar'), function (Container $container) |
|
| 369 | + { |
|
| 355 | 370 | $this->assertTrue($container->has('sampleClass')); |
| 356 | 371 | }); |
| 357 | 372 | }); |
| 358 | 373 | |
| 359 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 374 | + $root->runScope(new Scope('foo'), function (Container $container) |
|
| 375 | + { |
|
| 360 | 376 | $container->bindSingleton('otherClass', SampleClass::class); |
| 361 | 377 | |
| 362 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 378 | + $container->runScope(new Scope('bar'), function (Container $container) |
|
| 379 | + { |
|
| 363 | 380 | $this->assertTrue($container->has('sampleClass')); |
| 364 | 381 | $this->assertTrue($container->has('otherClass')); |
| 365 | 382 | }); |
@@ -371,33 +388,41 @@ discard block |
||
| 371 | 388 | $root = new Container(); |
| 372 | 389 | $root->getBinder('foo')->bindSingleton('sampleClass', AttrScopeFoo::class); |
| 373 | 390 | |
| 374 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 391 | + $root->runScope(new Scope('foo'), function (Container $container) |
|
| 392 | + { |
|
| 375 | 393 | $this->assertTrue($container->has('sampleClass')); |
| 376 | 394 | }); |
| 377 | 395 | |
| 378 | - $root->runScope(new Scope('bar'), function (Container $container) { |
|
| 396 | + $root->runScope(new Scope('bar'), function (Container $container) |
|
| 397 | + { |
|
| 379 | 398 | $this->assertFalse($container->has('sampleClass')); |
| 380 | 399 | }); |
| 381 | 400 | |
| 382 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 383 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 401 | + $root->runScope(new Scope('foo'), function (Container $container) |
|
| 402 | + { |
|
| 403 | + $container->runScope(new Scope('bar'), function (Container $container) |
|
| 404 | + { |
|
| 384 | 405 | $this->assertTrue($container->has('sampleClass')); |
| 385 | 406 | }); |
| 386 | 407 | }); |
| 387 | 408 | |
| 388 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 409 | + $root->runScope(new Scope('foo'), function (Container $container) |
|
| 410 | + { |
|
| 389 | 411 | $container->bindSingleton('otherClass', AttrScopeFoo::class); |
| 390 | 412 | |
| 391 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 413 | + $container->runScope(new Scope('bar'), function (Container $container) |
|
| 414 | + { |
|
| 392 | 415 | $this->assertTrue($container->has('sampleClass')); |
| 393 | 416 | $this->assertTrue($container->has('otherClass')); |
| 394 | 417 | }); |
| 395 | 418 | }); |
| 396 | 419 | |
| 397 | - $root->runScope(new Scope('baz'), function (Container $container) { |
|
| 420 | + $root->runScope(new Scope('baz'), function (Container $container) |
|
| 421 | + { |
|
| 398 | 422 | $container->getBinder('foo')->bindSingleton('otherClass', AttrScopeFoo::class); |
| 399 | 423 | |
| 400 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 424 | + $container->runScope(new Scope('bar'), function (Container $container) |
|
| 425 | + { |
|
| 401 | 426 | $this->assertFalse($container->has('sampleClass')); |
| 402 | 427 | $this->assertFalse($container->has('otherClass')); |
| 403 | 428 | }); |
@@ -18,21 +18,21 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | abstract public function bucket(?string $name = null): BucketInterface; |
| 20 | 20 | |
| 21 | - public function getContents(string|\Stringable $id): string |
|
| 21 | + public function getContents(string | \Stringable $id): string |
|
| 22 | 22 | { |
| 23 | 23 | [$name, $pathname] = $this->parseUri($id); |
| 24 | 24 | |
| 25 | 25 | return $this->bucket($name)->getContents($pathname); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function getStream(string|\Stringable $id) |
|
| 28 | + public function getStream(string | \Stringable $id) |
|
| 29 | 29 | { |
| 30 | 30 | [$name, $pathname] = $this->parseUri($id); |
| 31 | 31 | |
| 32 | 32 | return $this->bucket($name)->getStream($pathname); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function exists(string|\Stringable $id): bool |
|
| 35 | + public function exists(string | \Stringable $id): bool |
|
| 36 | 36 | { |
| 37 | 37 | [$name, $pathname] = $this->parseUri($id); |
| 38 | 38 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @return int<0, max> |
| 44 | 44 | */ |
| 45 | - public function getLastModified(string|\Stringable $id): int |
|
| 45 | + public function getLastModified(string | \Stringable $id): int |
|
| 46 | 46 | { |
| 47 | 47 | [$name, $pathname] = $this->parseUri($id); |
| 48 | 48 | |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @return int<0, max> |
| 54 | 54 | */ |
| 55 | - public function getSize(string|\Stringable $id): int |
|
| 55 | + public function getSize(string | \Stringable $id): int |
|
| 56 | 56 | { |
| 57 | 57 | [$name, $pathname] = $this->parseUri($id); |
| 58 | 58 | |
| 59 | 59 | return $this->bucket($name)->getSize($pathname); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function getMimeType(string|\Stringable $id): string |
|
| 62 | + public function getMimeType(string | \Stringable $id): string |
|
| 63 | 63 | { |
| 64 | 64 | [$name, $pathname] = $this->parseUri($id); |
| 65 | 65 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return Visibility::VISIBILITY_* |
| 71 | 71 | */ |
| 72 | 72 | #[ExpectedValues(valuesFromClass: Visibility::class)] |
| 73 | - public function getVisibility(string|\Stringable $id): string |
|
| 73 | + public function getVisibility(string | \Stringable $id): string |
|
| 74 | 74 | { |
| 75 | 75 | [$name, $pathname] = $this->parseUri($id); |
| 76 | 76 | |
@@ -80,5 +80,5 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * {@see Storage::parseUri()} |
| 82 | 82 | */ |
| 83 | - abstract protected function parseUri(string|\Stringable $uri, bool $withScheme = true): array; |
|
| 83 | + abstract protected function parseUri(string | \Stringable $uri, bool $withScheme = true): array; |
|
| 84 | 84 | } |