diff --git a/composer.json b/composer.json index 86a1d1940fd5..d35f3d505044 100644 --- a/composer.json +++ b/composer.json @@ -30,11 +30,12 @@ "symfony/console": "^4.4.8|^5.1", "symfony/dependency-injection": "^4.4.8|^5.1", "symfony/finder": "^4.4.8|^5.1", + "symfony/http-kernel": "^4.4.8|^5.1", "symfony/process": "^4.4.8|^5.1", "symplify/autowire-array-parameter": "^8.3.33", + "symplify/composer-json-manipulator": "^8.3.33", "symplify/console-color-diff": "^8.3.33", "symplify/easy-testing": "^8.3.33", - "symplify/composer-json-manipulator": "^8.3.33", "symplify/package-builder": "^8.3.33", "symplify/set-config-resolver": "^8.3.33", "symplify/smart-file-system": "^8.3.33", @@ -42,8 +43,6 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", - "johnkary/phpunit-speedtrap": "^3.2", - "migrify/easy-ci": "^0.3.45", "nette/application": "^3.0", "nette/forms": "^3.0", "ocramius/package-versions": "^1.9", @@ -55,57 +54,74 @@ "symplify/easy-testing": "^8.3.33", "symplify/monorepo-builder": "^8.3.33", "symplify/phpstan-extensions": "^8.3.33", - "tracy/tracy": "^2.7", - "thecodingmachine/phpstan-strict-rules": "^0.12" + "thecodingmachine/phpstan-strict-rules": "^0.12", + "tracy/tracy": "^2.7" }, "replace": { - "rector/rector-prefixed": "self.version" + "rector/rector-prefixed": "self.version", + "rector/simple-php-doc-parser": "self.version", + "rector/symfony-php-config": "self.version" }, "autoload": { + "files": [ + "packages/symfony-php-config/functions/functions.php", + "rules/restoration/tests/Rector/Use_/RestoreFullyQualifiedNameRector/Source/ShortClassOnly.php" + ], "psr-4": { "Rector\\Architecture\\": "rules/architecture/src", - "Rector\\PostRector\\": "packages/post-rector/src", "Rector\\AttributeAwarePhpDoc\\": "packages/attribute-aware-php-doc/src", "Rector\\Autodiscovery\\": "rules/autodiscovery/src", "Rector\\BetterPhpDocParser\\": "packages/better-php-doc-parser/src", + "Rector\\Caching\\": "packages/caching/src", "Rector\\CakePHP\\": "rules/cakephp/src", "Rector\\ChangesReporting\\": "packages/changes-reporting/src", "Rector\\CodeQuality\\": "rules/code-quality/src", - "Rector\\NodeRemoval\\": "packages/node-removal/src", - "Rector\\Generic\\": "rules/generic/src", - "Rector\\Reporting\\": "packages/reporting/src", "Rector\\CodingStyle\\": "rules/coding-style/src", "Rector\\ConsoleDiffer\\": "packages/console-differ/src", "Rector\\Core\\": "src", "Rector\\DeadCode\\": "rules/dead-code/src", - "Rector\\DocumentationGenerator\\": "packages/documentation-generator/src", + "Rector\\Decouple\\": "rules/decouple/src", + "Rector\\DoctrineAnnotationGenerated\\": "packages/doctrine-annotation-generated/src", "Rector\\DoctrineCodeQuality\\": "rules/doctrine-code-quality/src", "Rector\\DoctrineGedmoToKnplabs\\": "rules/doctrine-gedmo-to-knplabs/src", "Rector\\Doctrine\\": "rules/doctrine/src", + "Rector\\DocumentationGenerator\\": "packages/documentation-generator/src", + "Rector\\DowngradePhp71\\": "rules/downgrade-php71/src", + "Rector\\DowngradePhp72\\": "rules/downgrade-php72/src", + "Rector\\DowngradePhp73\\": "rules/downgrade-php73/src", + "Rector\\DowngradePhp74\\": "rules/downgrade-php74/src", + "Rector\\DowngradePhp80\\": "rules/downgrade-php80/src", "Rector\\DynamicTypeAnalysis\\": "packages/dynamic-type-analysis/src", - "Rector\\DoctrineAnnotationGenerated\\": "packages/doctrine-annotation-generated/src", - "Rector\\FileSystemRector\\": "packages/file-system-rector/src", "Rector\\FamilyTree\\": "packages/family-tree/src", + "Rector\\FileSystemRector\\": "packages/file-system-rector/src", + "Rector\\Generic\\": "rules/generic/src", "Rector\\JMS\\": "rules/jms/src", "Rector\\Laravel\\": "rules/laravel/src", "Rector\\Legacy\\": "rules/legacy/src", "Rector\\MagicDisclosure\\": "rules/magic-disclosure/src", + "Rector\\MockeryToProphecy\\": "rules/mockery-to-prophecy/src", + "Rector\\MockistaToMockery\\": "rules/mockista-to-mockery/src", "Rector\\MysqlToMysqli\\": "rules/mysql-to-mysqli/src", + "Rector\\Naming\\": "rules/naming/src", + "Rector\\NetteCodeQuality\\": "rules/nette-code-quality/src", + "Rector\\NetteKdyby\\": "rules/nette-kdyby/src", "Rector\\NetteTesterToPHPUnit\\": "rules/nette-tester-to-phpunit/src", "Rector\\NetteToSymfony\\": "rules/nette-to-symfony/src", + "Rector\\NetteUtilsCodeQuality\\": "rules/nette-utils-code-quality/src", "Rector\\Nette\\": "rules/nette/src", "Rector\\NodeCollector\\": "packages/node-collector/src", - "Rector\\Decouple\\": "rules/decouple/src", "Rector\\NodeNameResolver\\": "packages/node-name-resolver/src", "Rector\\NodeNestingScope\\": "packages/node-nesting-scope/src", + "Rector\\NodeRemoval\\": "packages/node-removal/src", "Rector\\NodeTypeResolver\\": "packages/node-type-resolver/src", - "Rector\\PhpAttribute\\": "packages/php-attribute/src", + "Rector\\Order\\": "rules/order/src", + "Rector\\PHPOffice\\": "rules/php-office/src", "Rector\\PHPStanStaticTypeMapper\\": "packages/phpstan-static-type-mapper/src", "Rector\\PHPStan\\": "rules/phpstan/src", "Rector\\PHPUnitSymfony\\": "rules/phpunit-symfony/src", - "Rector\\Caching\\": "packages/caching/src", "Rector\\PHPUnit\\": "rules/phpunit/src", "Rector\\PSR4\\": "rules/psr4/src", + "Rector\\Performance\\": "rules/performance/src", "Rector\\Phalcon\\": "rules/phalcon/src", "Rector\\Php52\\": "rules/php52/src", "Rector\\Php53\\": "rules/php53/src", @@ -118,81 +134,116 @@ "Rector\\Php73\\": "rules/php73/src", "Rector\\Php74\\": "rules/php74/src", "Rector\\Php80\\": "rules/php80/src", - "Rector\\PHPOffice\\": "rules/php-office/src", + "Rector\\PhpAttribute\\": "packages/php-attribute/src", "Rector\\PhpDeglobalize\\": "rules/php-deglobalize/src", "Rector\\PhpSpecToPHPUnit\\": "rules/php-spec-to-phpunit/src", "Rector\\Polyfill\\": "rules/polyfill/src", + "Rector\\PostRector\\": "packages/post-rector/src", "Rector\\Privatization\\": "rules/privatization/src", "Rector\\RectorGenerator\\": "packages/rector-generator/src", "Rector\\RemovingStatic\\": "rules/removing-static/src", "Rector\\Renaming\\": "rules/renaming/src", + "Rector\\Reporting\\": "packages/reporting/src", "Rector\\Restoration\\": "rules/restoration/src", - "Rector\\Set\\": "packages/set/src", "Rector\\SOLID\\": "rules/solid/src", - "Rector\\Transform\\": "rules/transform/src", "Rector\\Sensio\\": "rules/sensio/src", + "Rector\\Set\\": "packages/set/src", + "Rector\\SimplePhpDocParser\\": "packages/simple-php-doc-parser/src", "Rector\\StaticTypeMapper\\": "packages/static-type-mapper/src", "Rector\\StrictCodeQuality\\": "rules/strict-code-quality/src", "Rector\\SymfonyCodeQuality\\": "rules/symfony-code-quality/src", "Rector\\SymfonyPHPUnit\\": "rules/symfony-phpunit/src", + "Rector\\SymfonyPhpConfig\\": [ + "packages/symfony-php-config/src", + "rules/symfony-php-config/src" + ], "Rector\\Symfony\\": "rules/symfony/src", + "Rector\\Transform\\": "rules/transform/src", "Rector\\Twig\\": "rules/twig/src", "Rector\\TypeDeclaration\\": "rules/type-declaration/src", - "Rector\\VendorLocker\\": "packages/vendor-locker/src", - "Rector\\Performance\\": "rules/performance/src", - "Rector\\Naming\\": "rules/naming/src", - "Rector\\Order\\": "rules/order/src", - "Rector\\MockeryToProphecy\\": "rules/mockery-to-prophecy/src", - "Rector\\MockistaToMockery\\": "rules/mockista-to-mockery/src", - "Rector\\NetteKdyby\\": "rules/nette-kdyby/src", - "Rector\\NetteUtilsCodeQuality\\": "rules/nette-utils-code-quality/src", - "Rector\\NetteCodeQuality\\": "rules/nette-code-quality/src", - "Rector\\DowngradePhp71\\": "rules/downgrade-php71/src", - "Rector\\DowngradePhp72\\": "rules/downgrade-php72/src", - "Rector\\DowngradePhp73\\": "rules/downgrade-php73/src", - "Rector\\DowngradePhp74\\": "rules/downgrade-php74/src", - "Rector\\DowngradePhp80\\": "rules/downgrade-php80/src", - "Rector\\SymfonyPhpConfig\\": ["packages/symfony-php-config/src", "rules/symfony-php-config/src"] - }, - "files": [ - "rules/restoration/tests/Rector/Use_/RestoreFullyQualifiedNameRector/Source/ShortClassOnly.php", - "packages/symfony-php-config/functions/functions.php" - ] + "Rector\\VendorLocker\\": "packages/vendor-locker/src" + } }, "autoload-dev": { + "classmap": [ + "rules/autodiscovery/tests/Rector/FileSystem/MoveInterfacesToContractNamespaceDirectoryRector/Expected", + "rules/autodiscovery/tests/Rector/FileSystem/MoveServicesBySuffixToDirectoryRector/Expected", + "rules/cakephp/tests/Rector/FileWithoutNamespace/ImplicitShortClassNameUseStatementRector/Source", + "rules/cakephp/tests/Rector/Namespace_/AppUsesStaticCallToUseStatementRector/Source", + "rules/psr4/tests/Rector/MultipleClassFileToPsr4ClassesRector/Source", + "rules/renaming/tests/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source", + "rules/symfony/tests/Rector/MethodCall/ContainerGetToConstructorInjectionRector/Source", + "tests/Source" + ], + "files": [ + "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/AnotherClass.php", + "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/Foo.php", + "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/Function_/count.php", + "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/YetAnotherClass.php", + "rules/coding-style/tests/Rector/Throw_/AnnotateThrowablesRector/Source/i_throw_an_exception.func.php", + "rules/dead-code/tests/Rector/MethodCall/RemoveDefaultArgumentValueRector/Source/UserDefined.php", + "rules/naming/tests/ValueObjectFactory/PropertyRenameFactory/Fixture/SomeClass.php.inc", + "rules/renaming/tests/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source/ChangeMeAnotherNamespace.php", + "rules/renaming/tests/Rector/Name/RenameClassRector/Source/ClassImportingSameName.php", + "rules/renaming/tests/Rector/Name/RenameClassRector/Source/Manual_Twig_Filter.php", + "rules/renaming/tests/Rector/Name/RenameClassRector/Source/SomeInterface.php", + "rules/renaming/tests/Rector/Name/RenameClassRector/Source/TwigFilter.php", + "rules/renaming/tests/Rector/Name/RenameClassRector/Source/Twig_Extension_Sandbox.php", + "rules/solid/tests/Rector/ClassMethod/UseInterfaceOverImplementationInConstructorRector/Source/Coconut.php", + "rules/transform/tests/Rector/FuncCall/FuncCallToMethodCallRector/Source/some_view_function.php", + "rules/type-declaration/tests/Rector/FunctionLike/ReturnTypeDeclarationRector/Source/MyBar.php", + "rules/type-declaration/tests/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php", + "stubs/Nette/Localization/ITranslation.php", + "vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php" + ], "psr-4": { "Rector\\Architecture\\Tests\\": "rules/architecture/tests", "Rector\\Autodiscovery\\Tests\\": "rules/autodiscovery/tests", "Rector\\BetterPhpDocParser\\Tests\\": "packages/better-php-doc-parser/tests", + "Rector\\Caching\\Tests\\": "packages/caching/tests", "Rector\\CakePHP\\Tests\\": "rules/cakephp/tests", "Rector\\CodeQuality\\Tests\\": "rules/code-quality/tests", - "Rector\\Caching\\Tests\\": "packages/caching/tests", "Rector\\CodingStyle\\Tests\\": "rules/coding-style/tests", + "Rector\\Compiler\\Tests\\": "compiler/tests", "Rector\\Core\\Tests\\": "tests", - "Rector\\DocumentationGenerator\\Tests\\": "packages/documentation-generator/tests", - "Rector\\Decouple\\Tests\\": "rules/decouple/tests", "Rector\\DeadCode\\Tests\\": "rules/dead-code/tests", + "Rector\\Decouple\\Tests\\": "rules/decouple/tests", "Rector\\DoctrineCodeQuality\\Tests\\": "rules/doctrine-code-quality/tests", "Rector\\DoctrineGedmoToKnplabs\\Tests\\": "rules/doctrine-gedmo-to-knplabs/tests", "Rector\\Doctrine\\Tests\\": "rules/doctrine/tests", + "Rector\\DocumentationGenerator\\Tests\\": "packages/documentation-generator/tests", + "Rector\\DowngradePhp71\\Tests\\": "rules/downgrade-php71/tests", + "Rector\\DowngradePhp72\\Tests\\": "rules/downgrade-php72/tests", + "Rector\\DowngradePhp73\\Tests\\": "rules/downgrade-php73/tests", + "Rector\\DowngradePhp74\\Tests\\": "rules/downgrade-php74/tests", + "Rector\\DowngradePhp80\\Tests\\": "rules/downgrade-php80/tests", "Rector\\DynamicTypeAnalysis\\Tests\\": "packages/dynamic-type-analysis/tests", "Rector\\Generic\\Tests\\": "rules/generic/tests", "Rector\\JMS\\Tests\\": "rules/jms/tests", "Rector\\Laravel\\Tests\\": "rules/laravel/tests", "Rector\\Legacy\\Tests\\": "rules/legacy/tests", - "Rector\\RectorGenerator\\Tests\\": "packages/rector-generator/tests", "Rector\\MagicDisclosure\\Tests\\": "rules/magic-disclosure/tests", + "Rector\\MockeryToProphecy\\Tests\\": "rules/mockery-to-prophecy/tests", + "Rector\\MockistaToMockery\\Tests\\": "rules/mockista-to-mockery/tests", "Rector\\MysqlToMysqli\\Tests\\": "rules/mysql-to-mysqli/tests", + "Rector\\Naming\\Tests\\": "rules/naming/tests", + "Rector\\NetteCodeQuality\\Tests\\": "rules/nette-code-quality/tests", + "Rector\\NetteKdyby\\Tests\\": "rules/nette-kdyby/tests", "Rector\\NetteTesterToPHPUnit\\Tests\\": "rules/nette-tester-to-phpunit/tests", "Rector\\NetteToSymfony\\Tests\\": "rules/nette-to-symfony/tests", + "Rector\\NetteUtilsCodeQuality\\Tests\\": "rules/nette-utils-code-quality/tests", "Rector\\Nette\\Tests\\": "rules/nette/tests", "Rector\\NodeTypeResolver\\Tests\\": "packages/node-type-resolver/tests", + "Rector\\Order\\Tests\\": "rules/order/tests", + "Rector\\PHPOffice\\Tests\\": "rules/php-office/tests", "Rector\\PHPStanExtensions\\": "utils/phpstan-extensions/src", "Rector\\PHPStanExtensions\\Tests\\": "utils/phpstan-extensions/tests", + "Rector\\PHPStanStaticTypeMapper\\Tests\\": "packages/phpstan-static-type-mapper/tests", "Rector\\PHPStan\\Tests\\": "rules/phpstan/tests", "Rector\\PHPUnitSymfony\\Tests\\": "rules/phpunit-symfony/tests", "Rector\\PHPUnit\\Tests\\": "rules/phpunit/tests", "Rector\\PSR4\\Tests\\": "rules/psr4/tests", + "Rector\\Performance\\Tests\\": "rules/performance/tests", "Rector\\Phalcon\\Tests\\": "rules/phalcon/tests", "Rector\\Php52\\Tests\\": "rules/php52/tests", "Rector\\Php53\\Tests\\": "rules/php53/tests", @@ -205,78 +256,37 @@ "Rector\\Php73\\Tests\\": "rules/php73/tests", "Rector\\Php74\\Tests\\": "rules/php74/tests", "Rector\\Php80\\Tests\\": "rules/php80/tests", - "Rector\\Utils\\NodeDocumentationGenerator\\": "utils/node-documentation-generator/src", - "Rector\\Utils\\NodeDocumentationGenerator\\Tests\\": "utils/node-documentation-generator/tests", - "Rector\\PHPOffice\\Tests\\": "rules/php-office/tests", "Rector\\PhpDeglobalize\\Tests\\": "rules/php-deglobalize/tests", "Rector\\PhpSpecToPHPUnit\\Tests\\": "rules/php-spec-to-phpunit/tests", "Rector\\Polyfill\\Tests\\": "rules/polyfill/tests", "Rector\\Privatization\\Tests\\": "rules/privatization/tests", + "Rector\\RectorGenerator\\Tests\\": "packages/rector-generator/tests", "Rector\\RemovingStatic\\Tests\\": "rules/removing-static/tests", "Rector\\Renaming\\Tests\\": "rules/renaming/tests", "Rector\\Restoration\\Tests\\": "rules/restoration/tests", "Rector\\SOLID\\Tests\\": "rules/solid/tests", "Rector\\Sensio\\Tests\\": "rules/sensio/tests", + "Rector\\SimplePhpDocParser\\Tests\\": "packages/simple-php-doc-parser/tests", "Rector\\StrictCodeQuality\\Tests\\": "rules/strict-code-quality/tests", "Rector\\SymfonyCodeQuality\\Tests\\": "rules/symfony-code-quality/tests", "Rector\\SymfonyPHPUnit\\Tests\\": "rules/symfony-phpunit/tests", + "Rector\\SymfonyPhpConfig\\Tests\\": [ + "packages/symfony-php-config/tests", + "rules/symfony-php-config/tests" + ], + "Rector\\SymfonyPhpDocParser\\Tests\\": "packages/simple-php-doc-parser/tests", "Rector\\Symfony\\Tests\\": "rules/symfony/tests", "Rector\\Transform\\Tests\\": "rules/transform/tests", "Rector\\Twig\\Tests\\": "rules/twig/tests", "Rector\\TypeDeclaration\\Tests\\": "rules/type-declaration/tests", - "Rector\\Utils\\DocumentationGenerator\\": "utils/node-documentation-generator/src", - "Rector\\Utils\\ProjectValidator\\": "utils/project-validator/src", "Rector\\Utils\\DoctrineAnnotationParserSyncer\\": "utils/doctrine-annotation-parser-syncer/src", + "Rector\\Utils\\DocumentationGenerator\\": "utils/node-documentation-generator/src", + "Rector\\Utils\\NodeDocumentationGenerator\\": "utils/node-documentation-generator/src", + "Rector\\Utils\\NodeDocumentationGenerator\\Tests\\": "utils/node-documentation-generator/tests", "Rector\\Utils\\PHPStanAttributeTypeSyncer\\": "utils/phpstan-attribute-type-syncer/src", "Rector\\Utils\\PHPStanStaticTypeMapperChecker\\": "utils/phpstan-static-type-mapper-checker/src", - "Rector\\Performance\\Tests\\": "rules/performance/tests", - "Rector\\Naming\\Tests\\": "rules/naming/tests", - "Rector\\Order\\Tests\\": "rules/order/tests", - "Rector\\MockeryToProphecy\\Tests\\": "rules/mockery-to-prophecy/tests", - "Rector\\MockistaToMockery\\Tests\\": "rules/mockista-to-mockery/tests", - "Rector\\Compiler\\Tests\\": "compiler/tests", - "Rector\\NetteKdyby\\Tests\\": "rules/nette-kdyby/tests", - "Rector\\NetteUtilsCodeQuality\\Tests\\": "rules/nette-utils-code-quality/tests", - "Rector\\NetteCodeQuality\\Tests\\": "rules/nette-code-quality/tests", - "Rector\\DowngradePhp71\\Tests\\": "rules/downgrade-php71/tests", - "Rector\\DowngradePhp72\\Tests\\": "rules/downgrade-php72/tests", - "Rector\\DowngradePhp73\\Tests\\": "rules/downgrade-php73/tests", - "Rector\\DowngradePhp74\\Tests\\": "rules/downgrade-php74/tests", - "Rector\\DowngradePhp80\\Tests\\": "rules/downgrade-php80/tests", - "Rector\\SymfonyPhpConfig\\Tests\\": ["rules/symfony-php-config/tests", "packages/symfony-php-config/tests"], - "Rector\\PHPStanStaticTypeMapper\\Tests\\": "packages/phpstan-static-type-mapper/tests" - }, - "classmap": [ - "rules/cakephp/tests/Rector/FileWithoutNamespace/ImplicitShortClassNameUseStatementRector/Source", - "rules/symfony/tests/Rector/MethodCall/ContainerGetToConstructorInjectionRector/Source", - "rules/autodiscovery/tests/Rector/FileSystem/MoveInterfacesToContractNamespaceDirectoryRector/Expected", - "rules/autodiscovery/tests/Rector/FileSystem/MoveServicesBySuffixToDirectoryRector/Expected", - "rules/cakephp/tests/Rector/Namespace_/AppUsesStaticCallToUseStatementRector/Source", - "tests/Source", - "rules/psr4/tests/Rector/MultipleClassFileToPsr4ClassesRector/Source", - "rules/renaming/tests/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source" - ], - "files": [ - "rules/naming/tests/ValueObjectFactory/PropertyRenameFactory/Fixture/SomeClass.php.inc", - "rules/transform/tests/Rector/FuncCall/FuncCallToMethodCallRector/Source/some_view_function.php", - "rules/coding-style/tests/Rector/Throw_/AnnotateThrowablesRector/Source/i_throw_an_exception.func.php", - "rules/dead-code/tests/Rector/MethodCall/RemoveDefaultArgumentValueRector/Source/UserDefined.php", - "rules/type-declaration/tests/Rector/Property/CompleteVarDocTypePropertyRector/Source/EventDispatcher.php", - "rules/type-declaration/tests/Rector/FunctionLike/ReturnTypeDeclarationRector/Source/MyBar.php", - "rules/renaming/tests/Rector/Name/RenameClassRector/Source/SomeInterface.php", - "rules/renaming/tests/Rector/Name/RenameClassRector/Source/ClassImportingSameName.php", - "rules/renaming/tests/Rector/Name/RenameClassRector/Source/Twig_Extension_Sandbox.php", - "rules/renaming/tests/Rector/Name/RenameClassRector/Source/TwigFilter.php", - "rules/renaming/tests/Rector/Name/RenameClassRector/Source/Manual_Twig_Filter.php", - "rules/renaming/tests/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector/Source/ChangeMeAnotherNamespace.php", - "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/Foo.php", - "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/Function_/count.php", - "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/AnotherClass.php", - "rules/coding-style/tests/Rector/Namespace_/ImportFullyQualifiedNamesRector/Source/YetAnotherClass.php", - "rules/solid/tests/Rector/ClassMethod/UseInterfaceOverImplementationInConstructorRector/Source/Coconut.php", - "stubs/Nette/Localization/ITranslation.php", - "vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php" - ] + "Rector\\Utils\\ProjectValidator\\": "utils/project-validator/src" + } }, "scripts": { "complete-check": [ diff --git a/monorepo-builder.php b/monorepo-builder.php index 32f802573686..db6745cd10a7 100644 --- a/monorepo-builder.php +++ b/monorepo-builder.php @@ -17,6 +17,6 @@ $parameters = $containerConfigurator->parameters(); $parameters->set(Option::DIRECTORIES_TO_REPOSITORIES, [ __DIR__ . '/packages/symfony-php-config' => 'git@github.com:rectorphp/symfony-php-config.git', -// __DIR__ . '/packages/symfony-php-config' => 'git@github.com:rectorphp/symfony-php-config.git', + __DIR__ . '/packages/simple-php-doc-parser' => 'git@github.com:rectorphp/simple-php-doc-parser.git', ]); }; diff --git a/packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePhpDocNodeFactory.php b/packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePhpDocNodeFactory.php index 1148081c7962..dcd7a38d9338 100644 --- a/packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePhpDocNodeFactory.php +++ b/packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePhpDocNodeFactory.php @@ -9,9 +9,9 @@ use Rector\AttributeAwarePhpDoc\Ast\PhpDoc\AttributeAwarePhpDocNode; use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeAwareNodeFactoryAwareInterface; use Rector\AttributeAwarePhpDoc\Contract\AttributeNodeAwareFactory\AttributeNodeAwareFactoryInterface; -use Rector\BetterPhpDocParser\Ast\PhpDocNodeTraverser; use Rector\BetterPhpDocParser\Attributes\Ast\AttributeAwareNodeFactory; use Rector\BetterPhpDocParser\Contract\PhpDocNode\AttributeAwareNodeInterface; +use Rector\SimplePhpDocParser\PhpDocNodeTraverser; final class AttributeAwarePhpDocNodeFactory implements AttributeNodeAwareFactoryInterface, AttributeAwareNodeFactoryAwareInterface { diff --git a/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php b/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php index 396e1d81f291..90a7ab24b3bc 100644 --- a/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php +++ b/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php @@ -15,6 +15,7 @@ use Rector\BetterPhpDocParser\Contract\PhpDocNodeFactoryInterface; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocRemover; use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTypeChanger; +use Rector\BetterPhpDocParser\PhpDocParser\BetterPhpDocParser; use Rector\BetterPhpDocParser\ValueObject\StartAndEnd; use Rector\Core\Configuration\CurrentNodeProvider; use Rector\NodeTypeResolver\Node\AttributeKey; @@ -25,7 +26,7 @@ final class PhpDocInfoFactory /** * @var PhpDocParser */ - private $phpDocParser; + private $betterPhpDocParser; /** * @var Lexer @@ -61,12 +62,12 @@ public function __construct( AttributeAwareNodeFactory $attributeAwareNodeFactory, CurrentNodeProvider $currentNodeProvider, Lexer $lexer, - PhpDocParser $phpDocParser, + BetterPhpDocParser $betterPhpDocParser, PhpDocRemover $phpDocRemover, PhpDocTypeChanger $phpDocTypeChanger, StaticTypeMapper $staticTypeMapper ) { - $this->phpDocParser = $phpDocParser; + $this->betterPhpDocParser = $betterPhpDocParser; $this->lexer = $lexer; $this->currentNodeProvider = $currentNodeProvider; $this->staticTypeMapper = $staticTypeMapper; @@ -114,7 +115,7 @@ private function parseTokensToPhpDocNode(array $tokens): AttributeAwarePhpDocNod { $tokenIterator = new TokenIterator($tokens); - return $this->phpDocParser->parse($tokenIterator); + return $this->betterPhpDocParser->parse($tokenIterator); } /** diff --git a/packages/file-system-rector/config/config.php b/packages/file-system-rector/config/config.php index 96daaec82013..8cec952de6a9 100644 --- a/packages/file-system-rector/config/config.php +++ b/packages/file-system-rector/config/config.php @@ -5,15 +5,12 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $parameters = $containerConfigurator->parameters(); - - $parameters->set('project_directory', null); - $services = $containerConfigurator->services(); $services->defaults() ->public() - ->autowire(); + ->autowire() + ->autoconfigure(); $services->load('Rector\FileSystemRector\\', __DIR__ . '/../src') ->exclude([__DIR__ . '/../src/Rector']); diff --git a/packages/file-system-rector/src/Configuration/Option.php b/packages/file-system-rector/src/Configuration/Option.php deleted file mode 100644 index c30edf0d6d16..000000000000 --- a/packages/file-system-rector/src/Configuration/Option.php +++ /dev/null @@ -1,13 +0,0 @@ -getProjectDirectory(); + $projectDirectory = getcwd(); $relativePathInProject = $smartFileInfo->getRelativeFilePathFromDirectory($projectDirectory); @@ -66,25 +64,4 @@ public function configure(array $configuration): void { $this->filePathsToRemove = $configuration[self::FILE_PATHS_TO_REMOVE] ?? []; } - - private function getProjectDirectory(): string - { - $this->ensureProjectDirectoryIsSet(); - - return (string) $this->parameterProvider->provideParameter(Option::PROJECT_DIRECTORY_PARAMETER); - } - - private function ensureProjectDirectoryIsSet(): void - { - $projectDirectory = $this->parameterProvider->provideParameter(Option::PROJECT_DIRECTORY_PARAMETER); - - // has value? → skip - if ($projectDirectory) { - return; - } - - throw new ShouldNotHappenException( - 'Complete "$parameters->setParameter(Option::PROJECT_DIRECTORY_PARAMETER, ...);" in rector.php, so Rector can found your directory' - ); - } } diff --git a/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php b/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php index 491f3f9fd39b..ff44c3e3119a 100644 --- a/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php +++ b/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockClassRenamer.php @@ -10,8 +10,8 @@ use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\Type\ObjectType; use PHPStan\Type\Type; -use Rector\BetterPhpDocParser\Ast\PhpDocNodeTraverser; use Rector\PHPStan\Type\ShortenedObjectType; +use Rector\SimplePhpDocParser\PhpDocNodeTraverser; use Rector\StaticTypeMapper\StaticTypeMapper; final class DocBlockClassRenamer diff --git a/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php b/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php index 48909b22ba6b..cc77101a01ad 100644 --- a/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php +++ b/packages/node-type-resolver/src/PhpDoc/NodeAnalyzer/DocBlockNameImporter.php @@ -9,7 +9,6 @@ use PhpParser\Node\Stmt\ClassLike; use PHPStan\PhpDocParser\Ast\Node as PhpDocParserNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; -use Rector\BetterPhpDocParser\Ast\PhpDocNodeTraverser; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\CodingStyle\Imports\ImportSkipper; use Rector\Core\Configuration\Option; @@ -20,6 +19,7 @@ use Rector\PHPStan\Type\FullyQualifiedObjectType; use Rector\PHPStan\Type\ShortenedObjectType; use Rector\PostRector\Collector\UseNodesToAddCollector; +use Rector\SimplePhpDocParser\PhpDocNodeTraverser; use Rector\StaticTypeMapper\StaticTypeMapper; use Symplify\PackageBuilder\Parameter\ParameterProvider; diff --git a/packages/node-type-resolver/src/PhpDoc/PhpDocTypeRenamer.php b/packages/node-type-resolver/src/PhpDoc/PhpDocTypeRenamer.php index 8ad0abe8e5c8..e42c17c51bc1 100644 --- a/packages/node-type-resolver/src/PhpDoc/PhpDocTypeRenamer.php +++ b/packages/node-type-resolver/src/PhpDoc/PhpDocTypeRenamer.php @@ -9,10 +9,10 @@ use PHPStan\PhpDocParser\Ast\Node as PhpDocParserNode; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use PHPStan\Type\ObjectType; -use Rector\BetterPhpDocParser\Ast\PhpDocNodeTraverser; use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo; use Rector\Generic\ValueObject\PseudoNamespaceToNamespace; use Rector\NodeTypeResolver\Node\AttributeKey; +use Rector\SimplePhpDocParser\PhpDocNodeTraverser; use Rector\StaticTypeMapper\StaticTypeMapper; final class PhpDocTypeRenamer diff --git a/packages/simple-php-doc-parser/composer.json b/packages/simple-php-doc-parser/composer.json new file mode 100644 index 000000000000..81f0cfbae4c6 --- /dev/null +++ b/packages/simple-php-doc-parser/composer.json @@ -0,0 +1,26 @@ +{ + "name": "rector/simple-php-doc-parser", + "description": "Simple service integration of phpstan/phpdoc-parser", + "license": "MIT", + "require": { + "php": "^7.2.4|^8.0", + "symfony/dependency-injection": "^4.4.8|^5.1", + "symfony/config": "^4.4.8|^5.1", + "symfony/http-kernel": "^4.4.8|^5.1", + "symplify/package-builder": "^8.3.33" + }, + "require-dev": { + "phpunit/phpunit": "^8.5|^9.2", + "symplify/easy-testing": "^8.3.33" + }, + "autoload": { + "psr-4": { + "Rector\\SymfonyPhpDocParser\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Rector\\SymfonyPhpDocParser\\Tests\\": "tests" + } + } +} diff --git a/packages/simple-php-doc-parser/config/config.php b/packages/simple-php-doc-parser/config/config.php new file mode 100644 index 000000000000..451b725db62f --- /dev/null +++ b/packages/simple-php-doc-parser/config/config.php @@ -0,0 +1,21 @@ +services(); + + $services->defaults() + ->public() + ->autowire() + ->autoconfigure(); + + $services->load('Rector\SimplePhpDocParser\\', __DIR__ . '/../src'); + + $services->set(PhpDocParser::class); + $services->set(Lexer::class); +}; diff --git a/packages/simple-php-doc-parser/src/Bundle/DependencyInjection/Extension/SimplePhpDocParserExtension.php b/packages/simple-php-doc-parser/src/Bundle/DependencyInjection/Extension/SimplePhpDocParserExtension.php new file mode 100644 index 000000000000..91807885f201 --- /dev/null +++ b/packages/simple-php-doc-parser/src/Bundle/DependencyInjection/Extension/SimplePhpDocParserExtension.php @@ -0,0 +1,19 @@ +load('config.php'); + } +} diff --git a/packages/simple-php-doc-parser/src/Bundle/SimplePhpDocParserBundle.php b/packages/simple-php-doc-parser/src/Bundle/SimplePhpDocParserBundle.php new file mode 100644 index 000000000000..01536f691e2e --- /dev/null +++ b/packages/simple-php-doc-parser/src/Bundle/SimplePhpDocParserBundle.php @@ -0,0 +1,17 @@ +phpDocParser = $phpDocParser; + $this->lexer = $lexer; + } + + public function parseDocBlock(string $docBlock): PhpDocNode + { + $tokens = $this->lexer->tokenize($docBlock); + $tokenIterator = new TokenIterator($tokens); + + return $this->phpDocParser->parse($tokenIterator); + } +} diff --git a/packages/simple-php-doc-parser/tests/SimplePhpDocParser/Fixture/basic_doc.txt b/packages/simple-php-doc-parser/tests/SimplePhpDocParser/Fixture/basic_doc.txt new file mode 100644 index 000000000000..00b065e588d8 --- /dev/null +++ b/packages/simple-php-doc-parser/tests/SimplePhpDocParser/Fixture/basic_doc.txt @@ -0,0 +1,3 @@ +/** + * @var int + */ diff --git a/packages/simple-php-doc-parser/tests/SimplePhpDocParser/SimplePhpDocParserTest.php b/packages/simple-php-doc-parser/tests/SimplePhpDocParser/SimplePhpDocParserTest.php new file mode 100644 index 000000000000..f524ae533d6f --- /dev/null +++ b/packages/simple-php-doc-parser/tests/SimplePhpDocParser/SimplePhpDocParserTest.php @@ -0,0 +1,34 @@ +bootKernel(RectorKernel::class); + $this->simplePhpDocParser = self::$container->get(SimplePhpDocParser::class); + } + + public function test(): void + { + $fileInfo = new SmartFileInfo(__DIR__ . '/Fixture/basic_doc.txt'); + + $phpDocNode = $this->simplePhpDocParser->parseDocBlock($fileInfo->getContents()); + + $varTagValues = $phpDocNode->getVarTagValues(); + $this->assertCount(1, $varTagValues); + } +} diff --git a/packages/symfony-php-config/composer.json b/packages/symfony-php-config/composer.json index 96b985f1b656..fc73743937f3 100644 --- a/packages/symfony-php-config/composer.json +++ b/packages/symfony-php-config/composer.json @@ -2,17 +2,10 @@ "name": "rector/symfony-php-config", "description": "Tools that easy work with Symfony PHP Configs", "license": "MIT", - "authors": [ - { - "name": "Tomas Votruba", - "email": "tomas.vot@gmail.com", - "homepage": "https://tomasvotruba.com" - } - ], "require": { "php": "^7.2.4|^8.0", "symfony/dependency-injection": "^4.4.8|^5.1", - "symfony/http-kernel": "^4.4.8|^5.0.6", + "symfony/http-kernel": "^4.4.8|^5.1", "symplify/package-builder": "^8.3.33" }, "require-dev": { diff --git a/phpunit.xml b/phpunit.xml index 54f25da8287d..f68f64642345 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -19,31 +19,4 @@ rules/nette-tester-to-phpunit/tests/Rector/RenameTesterTestToPHPUnitToTestFileRector/Source/* - - - - rules/*/src - packages/*/src - src - - - rules/nette-tester-to-phpunit/tests/Rector/RenameTesterTestToPHPUnitToTestFileRector/Source/SomeCase.phpt - - - - - - - - - - 800 - - - 3 - - - - - diff --git a/rector.php.dist b/rector.php.dist index f0ed444ed479..9f249b044065 100644 --- a/rector.php.dist +++ b/rector.php.dist @@ -7,14 +7,12 @@ use Rector\Set\ValueObject\SetList; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - // get parameters $parameters = $containerConfigurator->parameters(); // Define what rule sets will be applied $parameters->set(Option::SETS, [ - SetList::NAMING, - SetList::CODE_QUALITY, + SetList::DEAD_CODE, ]); // get services (needed for register a single rule)