diff --git a/rector.php b/rector.php index 68d16bbb66e4..21f63c0eca1b 100644 --- a/rector.php +++ b/rector.php @@ -43,6 +43,7 @@ use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector; use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector; use Rector\PHPUnit\Set\PHPUnitSetList; +use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; @@ -59,6 +60,7 @@ $parameters = $containerConfigurator->parameters(); + $parameters->set(Option::PARALLEL, true); // paths to refactor; solid alternative to CLI arguments $parameters->set(Option::PATHS, [__DIR__ . '/app', __DIR__ . '/system', __DIR__ . '/tests', __DIR__ . '/utils/Rector']); @@ -145,4 +147,5 @@ $services->set(FuncGetArgsToVariadicParamRector::class); $services->set(MakeInheritedMethodVisibilitySameAsParentRector::class); $services->set(SimplifyEmptyArrayCheckRector::class); + $services->set(NormalizeNamespaceByPSR4ComposerAutoloadRector::class); }; diff --git a/tests/system/Commands/BaseCommandTest.php b/tests/system/Commands/BaseCommandTest.php index 7295c05e4d0c..5f9764208042 100644 --- a/tests/system/Commands/BaseCommandTest.php +++ b/tests/system/Commands/BaseCommandTest.php @@ -35,14 +35,14 @@ public function testMagicIssetTrue() { $command = new AppInfo($this->logger, service('commands')); - $this->assertTrue(isset($command->group)); + $this->assertObjectHasAttribute('group', $command); } public function testMagicIssetFalse() { $command = new AppInfo($this->logger, service('commands')); - $this->assertFalse(isset($command->foobar)); + $this->assertObjectNotHasAttribute('foobar', $command); } public function testMagicGet() diff --git a/tests/system/Files/FileCollectionTest.php b/tests/system/Files/FileCollectionTest.php index 5621151842e2..ec30f289100e 100644 --- a/tests/system/Files/FileCollectionTest.php +++ b/tests/system/Files/FileCollectionTest.php @@ -9,9 +9,9 @@ * the LICENSE file that was distributed with this source code. */ +namespace CodeIgniter\Files; + use CodeIgniter\Files\Exceptions\FileException; -use CodeIgniter\Files\File; -use CodeIgniter\Files\FileCollection; use CodeIgniter\Test\CIUnitTestCase; /** diff --git a/tests/system/Publisher/PublisherInputTest.php b/tests/system/Publisher/PublisherInputTest.php index a6f6b8eec582..8e6d0a4368f1 100644 --- a/tests/system/Publisher/PublisherInputTest.php +++ b/tests/system/Publisher/PublisherInputTest.php @@ -9,7 +9,8 @@ * the LICENSE file that was distributed with this source code. */ -use CodeIgniter\Publisher\Publisher; +namespace CodeIgniter\Publisher; + use CodeIgniter\Test\CIUnitTestCase; /** diff --git a/tests/system/Publisher/PublisherOutputTest.php b/tests/system/Publisher/PublisherOutputTest.php index 512e051f7663..f43fdf64971b 100644 --- a/tests/system/Publisher/PublisherOutputTest.php +++ b/tests/system/Publisher/PublisherOutputTest.php @@ -9,7 +9,8 @@ * the LICENSE file that was distributed with this source code. */ -use CodeIgniter\Publisher\Publisher; +namespace CodeIgniter\Publisher; + use CodeIgniter\Test\CIUnitTestCase; use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamDirectory; diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index 692e49d7680b..a3750f1427ad 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -9,8 +9,9 @@ * the LICENSE file that was distributed with this source code. */ +namespace CodeIgniter\Publisher; + use CodeIgniter\Publisher\Exceptions\PublisherException; -use CodeIgniter\Publisher\Publisher; use CodeIgniter\Test\CIUnitTestCase; /** diff --git a/tests/system/Publisher/PublisherSupportTest.php b/tests/system/Publisher/PublisherSupportTest.php index de1fb29fbd93..2f14a49c4dd2 100644 --- a/tests/system/Publisher/PublisherSupportTest.php +++ b/tests/system/Publisher/PublisherSupportTest.php @@ -9,8 +9,9 @@ * the LICENSE file that was distributed with this source code. */ +namespace CodeIgniter\Publisher; + use CodeIgniter\Publisher\Exceptions\PublisherException; -use CodeIgniter\Publisher\Publisher; use CodeIgniter\Test\CIUnitTestCase; use Tests\Support\Publishers\TestPublisher;