diff --git a/config/config.php b/config/config.php index a16dff0ef94..229b09cfc53 100644 --- a/config/config.php +++ b/config/config.php @@ -29,4 +29,5 @@ return static function (ContainerConfigurator $containerConfigurator): void { $parameters->set(Option::PROJECT_TYPE, Option::PROJECT_TYPE_PROPRIETARY); $parameters->set(Option::NESTED_CHAIN_METHOD_CALL_LIMIT, 30); + $parameters->set(Option::SKIP, []); }; diff --git a/config/set/laravel57.php b/config/set/laravel57.php index 0ec7f980bd5..b0469e97ba5 100644 --- a/config/set/laravel57.php +++ b/config/set/laravel57.php @@ -53,7 +53,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services->set(ArgumentRemoverRector::class) ->call('configure', [[ ArgumentRemoverRector::REMOVED_ARGUMENTS => inline_value_objects([ - new ArgumentRemover('Illuminate\Foundation\Application', 'register', 1, ['name' => 'options']), + new ArgumentRemover('Illuminate\Foundation\Application', 'register', 1, [ + 'name' => 'options', + ]), ]), ]]); }; diff --git a/docs/rector_rules_overview.md b/docs/rector_rules_overview.md index afda249238e..563d0a08a5e 100644 --- a/docs/rector_rules_overview.md +++ b/docs/rector_rules_overview.md @@ -194,7 +194,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MoveServicesBySuffixToDirectoryRector::class) - ->call('configure', [[MoveServicesBySuffixToDirectoryRector::GROUP_NAMES_BY_SUFFIX => ['Repository']]]); + ->call('configure', [[ + MoveServicesBySuffixToDirectoryRector::GROUP_NAMES_BY_SUFFIX => ['Repository'], + ]]); }; ``` @@ -232,7 +234,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MoveValueObjectsToValueObjectDirectoryRector::class) - ->call('configure', [[MoveValueObjectsToValueObjectDirectoryRector::TYPES => ['ValueObjectInterfaceClassName'], MoveValueObjectsToValueObjectDirectoryRector::SUFFIXES => ['Search'], MoveValueObjectsToValueObjectDirectoryRector::ENABLE_VALUE_OBJECT_GUESSING => true]]); + ->call( + 'configure', + [[ + MoveValueObjectsToValueObjectDirectoryRector::TYPES => ['ValueObjectInterfaceClassName'], + MoveValueObjectsToValueObjectDirectoryRector::SUFFIXES => ['Search'], + MoveValueObjectsToValueObjectDirectoryRector::ENABLE_VALUE_OBJECT_GUESSING => true, + ]] + ); }; ``` @@ -298,7 +307,17 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ArrayToFluentCallRector::class) - ->call('configure', [[ArrayToFluentCallRector::ARRAYS_TO_FLUENT_CALLS => inline_value_objects([new ArrayToFluentCall('ArticlesTable', ['foreignKey' => 'setForeignKey', 'propertyName' => 'setProperty'])])]]); + ->call( + 'configure', + [[ + ArrayToFluentCallRector::ARRAYS_TO_FLUENT_CALLS => inline_value_objects( + [new ArrayToFluentCall('ArticlesTable', [ + 'foreignKey' => 'setForeignKey', + 'propertyName' => 'setProperty', + ])] + ), + ]] + ); }; ``` @@ -384,7 +403,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ModalToGetSetRector::class) - ->call('configure', [[ModalToGetSetRector::UNPREFIXED_METHODS_TO_GET_SET => inline_value_objects([new ModalToGetSet('InstanceConfigTrait', 'config', 'getConfig', 'setConfig', 1, null)])]]); + ->call( + 'configure', + [[ + ModalToGetSetRector::UNPREFIXED_METHODS_TO_GET_SET => inline_value_objects( + [new ModalToGetSet('InstanceConfigTrait', 'config', 'getConfig', 'setConfig', 1, null)] + ), + ]] + ); }; ``` @@ -427,7 +453,24 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameMethodCallBasedOnParameterRector::class) - ->call('configure', [[RenameMethodCallBasedOnParameterRector::CALLS_WITH_PARAM_RENAMES => inline_value_objects([new RenameMethodCallBasedOnParameter('getParam', 'paging', 'getAttribute', 'ServerRequest'), new RenameMethodCallBasedOnParameter('withParam', 'paging', 'withAttribute', 'ServerRequest')])]]); + ->call( + 'configure', + [[ + RenameMethodCallBasedOnParameterRector::CALLS_WITH_PARAM_RENAMES => inline_value_objects( + [new RenameMethodCallBasedOnParameter( + 'getParam', + 'paging', + 'getAttribute', + 'ServerRequest' + ), new RenameMethodCallBasedOnParameter( + 'withParam', + 'paging', + 'withAttribute', + 'ServerRequest' + )] + ), + ]] + ); }; ``` @@ -1853,7 +1896,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ConsistentPregDelimiterRector::class) - ->call('configure', [[ConsistentPregDelimiterRector::DELIMITER => '#']]); + ->call('configure', [[ + ConsistentPregDelimiterRector::DELIMITER => '#', + ]]); }; ``` @@ -1933,7 +1978,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(FunctionCallToConstantRector::class) - ->call('configure', [[FunctionCallToConstantRector::FUNCTIONS_TO_CONSTANTS => ['php_sapi_name' => 'PHP_SAPI']]]); + ->call( + 'configure', + [[ + FunctionCallToConstantRector::FUNCTIONS_TO_CONSTANTS => [ + 'php_sapi_name' => 'PHP_SAPI', + ], + ]] + ); }; ``` @@ -1961,7 +2013,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(FunctionCallToConstantRector::class) - ->call('configure', [[FunctionCallToConstantRector::FUNCTIONS_TO_CONSTANTS => ['pi' => 'M_PI']]]); + ->call('configure', [[ + FunctionCallToConstantRector::FUNCTIONS_TO_CONSTANTS => [ + 'pi' => 'M_PI', + ], + ]]); }; ``` @@ -2093,7 +2149,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(PreferThisOrSelfMethodCallRector::class) - ->call('configure', [[PreferThisOrSelfMethodCallRector::TYPE_TO_PREFERENCE => ['PHPUnit\TestCase' => 'self']]]); + ->call('configure', [[ + PreferThisOrSelfMethodCallRector::TYPE_TO_PREFERENCE => [ + 'PHPUnit\TestCase' => 'self', + ], + ]]); }; ``` @@ -2173,7 +2233,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ReturnArrayClassMethodToYieldRector::class) - ->call('configure', [[ReturnArrayClassMethodToYieldRector::METHODS_TO_YIELDS => inline_value_objects([new ReturnArrayClassMethodToYield('EventSubscriberInterface', 'getSubscribedEvents')])]]); + ->call( + 'configure', + [[ + ReturnArrayClassMethodToYieldRector::METHODS_TO_YIELDS => inline_value_objects( + [new ReturnArrayClassMethodToYield('EventSubscriberInterface', 'getSubscribedEvents')] + ), + ]] + ); }; ``` @@ -2494,7 +2561,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(YieldClassMethodToArrayClassMethodRector::class) - ->call('configure', [[YieldClassMethodToArrayClassMethodRector::METHODS_BY_TYPE => ['EventSubscriberInterface' => ['getSubscribedEvents']]]]); + ->call( + 'configure', + [[ + YieldClassMethodToArrayClassMethodRector::METHODS_BY_TYPE => [ + 'EventSubscriberInterface' => ['getSubscribedEvents'], + ], + ]] + ); }; ``` @@ -3414,7 +3488,20 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DecoupleClassMethodToOwnClassRector::class) - ->call('configure', [[DecoupleClassMethodToOwnClassRector::METHOD_NAMES_BY_CLASS => ['SomeClass' => ['someMethod' => ['class' => 'NewDecoupledClass', 'method' => 'someRenamedMethod', 'parent_class' => 'AddedParentClass']]]]]); + ->call( + 'configure', + [[ + DecoupleClassMethodToOwnClassRector::METHOD_NAMES_BY_CLASS => [ + 'SomeClass' => [ + 'someMethod' => [ + 'class' => 'NewDecoupledClass', + 'method' => 'someRenamedMethod', + 'parent_class' => 'AddedParentClass', + ], + ], + ], + ]] + ); }; ``` @@ -3438,14 +3525,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { ```php alsoCallThis(); } - private function alsoCallThis() + private function alsoCallThis(): void { } } @@ -3824,7 +3913,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(EntityAliasToClassConstantReferenceRector::class) - ->call('configure', [[EntityAliasToClassConstantReferenceRector::ALIASES_TO_NAMESPACES => [App::class => 'App\Entity']]]); + ->call( + 'configure', + [[ + EntityAliasToClassConstantReferenceRector::ALIASES_TO_NAMESPACES => [ + App::class => 'App\Entity', + ], + ]] + ); }; ``` @@ -4598,7 +4694,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeNullableTypeParamDeclarationRector::class) - ->call('configure', [[DowngradeNullableTypeParamDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeNullableTypeParamDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4641,7 +4739,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeNullableTypeReturnDeclarationRector::class) - ->call('configure', [[DowngradeNullableTypeReturnDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeNullableTypeReturnDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4687,7 +4787,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeVoidTypeReturnDeclarationRector::class) - ->call('configure', [[DowngradeVoidTypeReturnDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeVoidTypeReturnDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4732,7 +4834,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeParamObjectTypeDeclarationRector::class) - ->call('configure', [[DowngradeParamObjectTypeDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeParamObjectTypeDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4774,7 +4878,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeReturnObjectTypeDeclarationRector::class) - ->call('configure', [[DowngradeReturnObjectTypeDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeReturnObjectTypeDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4857,7 +4963,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeTypedPropertyRector::class) - ->call('configure', [[DowngradeTypedPropertyRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeTypedPropertyRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4897,7 +5005,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeParamMixedTypeDeclarationRector::class) - ->call('configure', [[DowngradeParamMixedTypeDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeParamMixedTypeDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4939,7 +5049,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeReturnMixedTypeDeclarationRector::class) - ->call('configure', [[DowngradeReturnMixedTypeDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeReturnMixedTypeDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -4985,7 +5097,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeReturnStaticTypeDeclarationRector::class) - ->call('configure', [[DowngradeReturnStaticTypeDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeReturnStaticTypeDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -5028,7 +5142,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeUnionTypeParamDeclarationRector::class) - ->call('configure', [[DowngradeUnionTypeParamDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeUnionTypeParamDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -5071,7 +5187,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeUnionTypeReturnDeclarationRector::class) - ->call('configure', [[DowngradeUnionTypeReturnDeclarationRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeUnionTypeReturnDeclarationRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -5117,7 +5235,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(DowngradeUnionTypeTypedPropertyRector::class) - ->call('configure', [[DowngradeUnionTypeTypedPropertyRector::ADD_DOC_BLOCK => true]]); + ->call('configure', [[ + DowngradeUnionTypeTypedPropertyRector::ADD_DOC_BLOCK => true, + ]]); }; ``` @@ -5217,7 +5337,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RemoveProjectFileRector::class) - ->call('configure', [[RemoveProjectFileRector::FILE_PATHS_TO_REMOVE => ['someFile/ToBeRemoved.txt']]]); + ->call('configure', [[ + RemoveProjectFileRector::FILE_PATHS_TO_REMOVE => ['someFile/ToBeRemoved.txt'], + ]]); }; ``` @@ -5280,7 +5402,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(AddInterfaceByTraitRector::class) - ->call('configure', [[AddInterfaceByTraitRector::INTERFACE_BY_TRAIT => ['SomeTrait' => SomeInterface::class]]]); + ->call('configure', [[ + AddInterfaceByTraitRector::INTERFACE_BY_TRAIT => [ + 'SomeTrait' => SomeInterface::class, + ], + ]]); }; ``` @@ -5315,7 +5441,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(AddMethodParentCallRector::class) - ->call('configure', [[AddMethodParentCallRector::METHODS_BY_PARENT_TYPES => ['ParentClassWithNewConstructor' => '__construct']]]); + ->call( + 'configure', + [[ + AddMethodParentCallRector::METHODS_BY_PARENT_TYPES => [ + 'ParentClassWithNewConstructor' => '__construct', + ], + ]] + ); }; ``` @@ -5354,7 +5487,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(AddPropertyByParentRector::class) - ->call('configure', [[AddPropertyByParentRector::PARENT_DEPENDENCIES => ['SomeParentClass' => ['SomeDependency']]]]); + ->call( + 'configure', + [[ + AddPropertyByParentRector::PARENT_DEPENDENCIES => [ + 'SomeParentClass' => ['SomeDependency'], + ], + ]] + ); }; ``` @@ -5398,7 +5538,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(AddReturnTypeDeclarationRector::class) - ->call('configure', [[AddReturnTypeDeclarationRector::METHOD_RETURN_TYPES => inline_value_objects([new AddReturnTypeDeclaration('SomeClass', 'getData', 'array')])]]); + ->call( + 'configure', + [[ + AddReturnTypeDeclarationRector::METHOD_RETURN_TYPES => inline_value_objects( + [new AddReturnTypeDeclaration('SomeClass', 'getData', 'array')] + ), + ]] + ); }; ``` @@ -5460,7 +5607,24 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ArgumentAdderRector::class) - ->call('configure', [[ArgumentAdderRector::ADDED_ARGUMENTS => inline_value_objects([new ArgumentAdder('SomeExampleClass', 'someMethod', 0, 'someArgument', 'true', 'SomeType', null)])]]); + ->call( + 'configure', + [[ + ArgumentAdderRector::ADDED_ARGUMENTS => inline_value_objects( + [ + new ArgumentAdder( + 'SomeExampleClass', + 'someMethod', + 0, + 'someArgument', + 'true', + 'SomeType', + null + ), + ] + ), + ]] + ); }; ``` @@ -5485,7 +5649,24 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ArgumentAdderRector::class) - ->call('configure', [[ArgumentAdderRector::ADDED_ARGUMENTS => inline_value_objects([new ArgumentAdder('SomeExampleClass', 'someMethod', 0, 'someArgument', 'true', 'SomeType', null)])]]); + ->call( + 'configure', + [[ + ArgumentAdderRector::ADDED_ARGUMENTS => inline_value_objects( + [ + new ArgumentAdder( + 'SomeExampleClass', + 'someMethod', + 0, + 'someArgument', + 'true', + 'SomeType', + null + ), + ] + ), + ]] + ); }; ``` @@ -5524,7 +5705,20 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ArgumentDefaultValueReplacerRector::class) - ->call('configure', [[ArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => inline_value_objects([new ArgumentDefaultValueReplacer('SomeExampleClass', 'someMethod', 0, 'SomeClass::OLD_CONSTANT', 'false')])]]); + ->call( + 'configure', + [[ + ArgumentDefaultValueReplacerRector::REPLACED_ARGUMENTS => inline_value_objects( + [new ArgumentDefaultValueReplacer( + 'SomeExampleClass', + 'someMethod', + 0, + 'SomeClass::OLD_CONSTANT', + 'false' + )] + ), + ]] + ); }; ``` @@ -5559,7 +5753,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ArgumentRemoverRector::class) - ->call('configure', [[ArgumentRemoverRector::REMOVED_ARGUMENTS => inline_value_objects([new ArgumentRemover('ExampleClass', 'someMethod', 0, 'true')])]]); + ->call( + 'configure', + [[ + ArgumentRemoverRector::REMOVED_ARGUMENTS => inline_value_objects( + [new ArgumentRemover('ExampleClass', 'someMethod', 0, 'true')] + ), + ]] + ); }; ``` @@ -5594,7 +5795,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ChangeConstantVisibilityRector::class) - ->call('configure', [[ChangeConstantVisibilityRector::CLASS_CONSTANT_VISIBILITY_CHANGES => inline_value_objects([new ClassConstantVisibilityChange('ParentObject', 'SOME_CONSTANT', 'protected')])]]); + ->call( + 'configure', + [[ + ChangeConstantVisibilityRector::CLASS_CONSTANT_VISIBILITY_CHANGES => inline_value_objects( + [new ClassConstantVisibilityChange('ParentObject', 'SOME_CONSTANT', 'protected')] + ), + ]] + ); }; ``` @@ -5634,7 +5842,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ChangeContractMethodSingleToManyRector::class) - ->call('configure', [[ChangeContractMethodSingleToManyRector::OLD_TO_NEW_METHOD_BY_TYPE => ['SomeClass' => ['getNode' => 'getNodes']]]]); + ->call( + 'configure', + [[ + ChangeContractMethodSingleToManyRector::OLD_TO_NEW_METHOD_BY_TYPE => [ + 'SomeClass' => [ + 'getNode' => 'getNodes', + ], + ], + ]] + ); }; ``` @@ -5678,7 +5895,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ChangeMethodVisibilityRector::class) - ->call('configure', [[ChangeMethodVisibilityRector::METHOD_VISIBILITIES => inline_value_objects([new ChangeMethodVisibility('FrameworkClass', 'someMethod', 'protected')])]]); + ->call( + 'configure', + [[ + ChangeMethodVisibilityRector::METHOD_VISIBILITIES => inline_value_objects( + [new ChangeMethodVisibility('FrameworkClass', 'someMethod', 'protected')] + ), + ]] + ); }; ``` @@ -5722,7 +5946,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ChangePropertyVisibilityRector::class) - ->call('configure', [[ChangePropertyVisibilityRector::PROPERTY_TO_VISIBILITY_BY_CLASS => ['FrameworkClass' => ['someProperty' => 'protected']]]]); + ->call( + 'configure', + [[ + ChangePropertyVisibilityRector::PROPERTY_TO_VISIBILITY_BY_CLASS => [ + 'FrameworkClass' => [ + 'someProperty' => 'protected', + ], + ], + ]] + ); }; ``` @@ -5786,7 +6019,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(FuncCallToNewRector::class) - ->call('configure', [[FuncCallToNewRector::FUNCTION_TO_NEW => ['collection' => ['Collection']]]]); + ->call('configure', [[ + FuncCallToNewRector::FUNCTION_TO_NEW => [ + 'collection' => ['Collection'], + ], + ]]); }; ``` @@ -5826,7 +6063,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(FuncCallToStaticCallRector::class) - ->call('configure', [[FuncCallToStaticCallRector::FUNC_CALLS_TO_STATIC_CALLS => inline_value_objects([new FuncCallToStaticCall('view', 'SomeStaticClass', 'render')])]]); + ->call( + 'configure', + [[ + FuncCallToStaticCallRector::FUNC_CALLS_TO_STATIC_CALLS => inline_value_objects( + [new FuncCallToStaticCall('view', 'SomeStaticClass', 'render')] + ), + ]] + ); }; ``` @@ -5860,7 +6104,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(InjectAnnotationClassRector::class) - ->call('configure', [[InjectAnnotationClassRector::ANNOTATION_CLASSES => [Inject::class, Inject::class]]]); + ->call('configure', [[ + InjectAnnotationClassRector::ANNOTATION_CLASSES => [Inject::class, Inject::class], + ]]); }; ``` @@ -5905,7 +6151,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MergeInterfacesRector::class) - ->call('configure', [[MergeInterfacesRector::OLD_TO_NEW_INTERFACES => ['SomeOldInterface' => SomeInterface::class]]]); + ->call( + 'configure', + [[ + MergeInterfacesRector::OLD_TO_NEW_INTERFACES => [ + 'SomeOldInterface' => SomeInterface::class, + ], + ]] + ); }; ``` @@ -5939,7 +6192,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MethodCallRemoverRector::class) - ->call('configure', [[MethodCallRemoverRector::METHOD_CALL_REMOVER_ARGUMENT => ['$methodCallRemoverArgument' => ['Car' => 'something']]]]); + ->call( + 'configure', + [[ + MethodCallRemoverRector::METHOD_CALL_REMOVER_ARGUMENT => [ + '$methodCallRemoverArgument' => [ + 'Car' => 'something', + ], + ], + ]] + ); }; ``` @@ -5972,7 +6234,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MethodCallToReturnRector::class) - ->call('configure', [[MethodCallToReturnRector::METHOD_CALL_WRAPS => ['SomeClass' => ['deny']]]]); + ->call('configure', [[ + MethodCallToReturnRector::METHOD_CALL_WRAPS => [ + 'SomeClass' => ['deny'], + ], + ]]); }; ``` @@ -6015,7 +6281,17 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(NewObjectToFactoryCreateRector::class) - ->call('configure', [[NewObjectToFactoryCreateRector::OBJECT_TO_FACTORY_METHOD => ['MyClass' => ['class' => 'MyClassFactory', 'method' => 'create']]]]); + ->call( + 'configure', + [[ + NewObjectToFactoryCreateRector::OBJECT_TO_FACTORY_METHOD => [ + 'MyClass' => [ + 'class' => 'MyClassFactory', + 'method' => 'create', + ], + ], + ]] + ); }; ``` @@ -6059,7 +6335,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(NormalToFluentRector::class) - ->call('configure', [[NormalToFluentRector::CALLS_TO_FLUENT => inline_value_objects([new NormalToFluent('SomeClass', ['someFunction', 'otherFunction'])])]]); + ->call( + 'configure', + [[ + NormalToFluentRector::CALLS_TO_FLUENT => inline_value_objects( + [new NormalToFluent('SomeClass', ['someFunction', 'otherFunction'])] + ), + ]] + ); }; ``` @@ -6094,7 +6377,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ParentClassToTraitsRector::class) - ->call('configure', [[ParentClassToTraitsRector::PARENT_CLASS_TO_TRAITS => ['Nette\Object' => ['Nette\SmartObject']]]]); + ->call( + 'configure', + [[ + ParentClassToTraitsRector::PARENT_CLASS_TO_TRAITS => [ + 'Nette\Object' => ['Nette\SmartObject'], + ], + ]] + ); }; ``` @@ -6131,7 +6421,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(PseudoNamespaceToNamespaceRector::class) - ->call('configure', [[PseudoNamespaceToNamespaceRector::NAMESPACE_PREFIXES_WITH_EXCLUDED_CLASSES => inline_value_objects([new PseudoNamespaceToNamespace('Some_', ['Some_Class_To_Keep'])])]]); + ->call( + 'configure', + [[ + PseudoNamespaceToNamespaceRector::NAMESPACE_PREFIXES_WITH_EXCLUDED_CLASSES => inline_value_objects( + [new PseudoNamespaceToNamespace('Some_', ['Some_Class_To_Keep'])] + ), + ]] + ); }; ``` @@ -6166,7 +6463,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RemoveAnnotationRector::class) - ->call('configure', [[RemoveAnnotationRector::ANNOTATIONS_TO_REMOVE => ['method']]]); + ->call('configure', [[ + RemoveAnnotationRector::ANNOTATIONS_TO_REMOVE => ['method'], + ]]); }; ``` @@ -6204,7 +6503,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RemoveFuncCallArgRector::class) - ->call('configure', [[RemoveFuncCallArgRector::REMOVED_FUNCTION_ARGUMENTS => inline_value_objects([new RemoveFuncCallArg('remove_last_arg', 1)])]]); + ->call( + 'configure', + [[ + RemoveFuncCallArgRector::REMOVED_FUNCTION_ARGUMENTS => inline_value_objects( + [new RemoveFuncCallArg('remove_last_arg', 1)] + ), + ]] + ); }; ``` @@ -6236,7 +6542,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RemoveIniGetSetFuncCallRector::class) - ->call('configure', [[RemoveIniGetSetFuncCallRector::KEYS_TO_REMOVE => ['y2k_compliance']]]); + ->call('configure', [[ + RemoveIniGetSetFuncCallRector::KEYS_TO_REMOVE => ['y2k_compliance'], + ]]); }; ``` @@ -6268,7 +6576,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RemoveInterfacesRector::class) - ->call('configure', [[RemoveInterfacesRector::INTERFACES_TO_REMOVE => [SomeInterface::class]]]); + ->call('configure', [[ + RemoveInterfacesRector::INTERFACES_TO_REMOVE => [SomeInterface::class], + ]]); }; ``` @@ -6302,7 +6612,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RemoveParentRector::class) - ->call('configure', [[RemoveParentRector::PARENT_TYPES_TO_REMOVE => ['SomeParentClass']]]); + ->call('configure', [[ + RemoveParentRector::PARENT_TYPES_TO_REMOVE => ['SomeParentClass'], + ]]); }; ``` @@ -6336,7 +6648,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RemoveTraitRector::class) - ->call('configure', [[RemoveTraitRector::TRAITS_TO_REMOVE => ['TraitNameToRemove']]]); + ->call('configure', [[ + RemoveTraitRector::TRAITS_TO_REMOVE => ['TraitNameToRemove'], + ]]); }; ``` @@ -6370,7 +6684,17 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameClassConstantsUseToStringsRector::class) - ->call('configure', [[RenameClassConstantsUseToStringsRector::OLD_CONSTANTS_TO_NEW_VALUES_BY_TYPE => ['Nette\Configurator' => ['DEVELOPMENT' => 'development', 'PRODUCTION' => 'production']]]]); + ->call( + 'configure', + [[ + RenameClassConstantsUseToStringsRector::OLD_CONSTANTS_TO_NEW_VALUES_BY_TYPE => [ + 'Nette\Configurator' => [ + 'DEVELOPMENT' => 'development', + 'PRODUCTION' => 'production', + ], + ], + ]] + ); }; ``` @@ -6404,7 +6728,20 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ReplaceParentCallByPropertyCallRector::class) - ->call('configure', [[ReplaceParentCallByPropertyCallRector::PARENT_CALLS_TO_PROPERTIES => inline_value_objects([new ReplaceParentCallByPropertyCall('SomeTypeToReplace', 'someMethodCall', 'someProperty')])]]); + ->call( + 'configure', + [[ + ReplaceParentCallByPropertyCallRector::PARENT_CALLS_TO_PROPERTIES => inline_value_objects( + [ + new ReplaceParentCallByPropertyCall( + 'SomeTypeToReplace', + 'someMethodCall', + 'someProperty' + ), + ] + ), + ]] + ); }; ``` @@ -6473,7 +6810,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(StringToClassConstantRector::class) - ->call('configure', [[StringToClassConstantRector::STRINGS_TO_CLASS_CONSTANTS => inline_value_objects([new StringToClassConstant('compiler.post_dump', 'Yet\AnotherClass', 'CONSTANT')])]]); + ->call( + 'configure', + [[ + StringToClassConstantRector::STRINGS_TO_CLASS_CONSTANTS => inline_value_objects( + [new StringToClassConstant('compiler.post_dump', 'Yet\AnotherClass', 'CONSTANT')] + ), + ]] + ); }; ``` @@ -6513,7 +6857,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(SwapClassMethodArgumentsRector::class) - ->call('configure', [[SwapClassMethodArgumentsRector::ARGUMENT_SWAPS => inline_value_objects([new SwapClassMethodArguments('SomeClass', 'run', [1, 0])])]]); + ->call( + 'configure', + [[ + SwapClassMethodArgumentsRector::ARGUMENT_SWAPS => inline_value_objects( + [new SwapClassMethodArguments('SomeClass', 'run', [1, 0])] + ), + ]] + ); }; ``` @@ -6554,7 +6905,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(SwapFuncCallArgumentsRector::class) - ->call('configure', [[SwapFuncCallArgumentsRector::FUNCTION_ARGUMENT_SWAPS => inline_value_objects([new SwapFuncCallArguments('some_function', [1, 0])])]]); + ->call( + 'configure', + [[ + SwapFuncCallArgumentsRector::FUNCTION_ARGUMENT_SWAPS => inline_value_objects( + [new SwapFuncCallArguments('some_function', [1, 0])] + ), + ]] + ); }; ``` @@ -6594,7 +6952,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(WrapReturnRector::class) - ->call('configure', [[WrapReturnRector::TYPE_METHOD_WRAPS => inline_value_objects([new WrapReturn('SomeClass', 'getItem', true)])]]); + ->call( + 'configure', + [[ + WrapReturnRector::TYPE_METHOD_WRAPS => inline_value_objects( + [new WrapReturn('SomeClass', 'getItem', true)] + ), + ]] + ); }; ``` @@ -6748,7 +7113,13 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(AddTopIncludeRector::class) - ->call('configure', [[AddTopIncludeRector::AUTOLOAD_FILE_PATH => '/../autoloader.php', AddTopIncludeRector::PATTERNS => ['pat*/*/?ame.php', 'somepath/?ame.php']]]); + ->call( + 'configure', + [[ + AddTopIncludeRector::AUTOLOAD_FILE_PATH => '/../autoloader.php', + AddTopIncludeRector::PATTERNS => ['pat*/*/?ame.php', 'somepath/?ame.php'], + ]] + ); }; ``` @@ -6885,7 +7256,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(GetAndSetToMethodCallRector::class) - ->call('configure', [[GetAndSetToMethodCallRector::TYPE_TO_METHOD_CALLS => ['SomeContainer' => ['set' => 'addService']]]]); + ->call( + 'configure', + [[ + GetAndSetToMethodCallRector::TYPE_TO_METHOD_CALLS => [ + 'SomeContainer' => [ + 'set' => 'addService', + ], + ], + ]] + ); }; ``` @@ -6908,7 +7288,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(GetAndSetToMethodCallRector::class) - ->call('configure', [[GetAndSetToMethodCallRector::TYPE_TO_METHOD_CALLS => ['SomeContainer' => ['get' => 'getService']]]]); + ->call( + 'configure', + [[ + GetAndSetToMethodCallRector::TYPE_TO_METHOD_CALLS => [ + 'SomeContainer' => [ + 'get' => 'getService', + ], + ], + ]] + ); }; ``` @@ -7018,7 +7407,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ToStringToMethodCallRector::class) - ->call('configure', [[ToStringToMethodCallRector::METHOD_NAMES_BY_TYPE => ['SomeObject' => 'getPath']]]); + ->call('configure', [[ + ToStringToMethodCallRector::METHOD_NAMES_BY_TYPE => [ + 'SomeObject' => 'getPath', + ], + ]]); }; ``` @@ -7055,7 +7448,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(UnsetAndIssetToMethodCallRector::class) - ->call('configure', [[UnsetAndIssetToMethodCallRector::ISSET_UNSET_TO_METHOD_CALL => inline_value_objects([new IssetUnsetToMethodCall('SomeContainer', 'hasService', 'removeService')])]]); + ->call( + 'configure', + [[ + UnsetAndIssetToMethodCallRector::ISSET_UNSET_TO_METHOD_CALL => inline_value_objects( + [new IssetUnsetToMethodCall('SomeContainer', 'hasService', 'removeService')] + ), + ]] + ); }; ``` @@ -7080,7 +7480,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(UnsetAndIssetToMethodCallRector::class) - ->call('configure', [[UnsetAndIssetToMethodCallRector::ISSET_UNSET_TO_METHOD_CALL => inline_value_objects([new IssetUnsetToMethodCall('SomeContainer', 'hasService', 'removeService')])]]); + ->call( + 'configure', + [[ + UnsetAndIssetToMethodCallRector::ISSET_UNSET_TO_METHOD_CALL => inline_value_objects( + [new IssetUnsetToMethodCall('SomeContainer', 'hasService', 'removeService')] + ), + ]] + ); }; ``` @@ -8311,16 +8718,20 @@ Change Form that extends Control to Controller and decoupled FormType **New file** ```php +add('name', TextType::class, [ - 'label' => 'Your name' + 'label' => 'Your name', ]); } } @@ -8604,7 +9015,15 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(OrderConstructorDependenciesByTypeAlphabeticallyRector::class) - ->call('configure', [[OrderConstructorDependenciesByTypeAlphabeticallyRector::SKIP_PATTERNS => ['Cla*ame', 'Ano?herClassName']]]); + ->call( + 'configure', + [[ + OrderConstructorDependenciesByTypeAlphabeticallyRector::SKIP_PATTERNS => [ + 'Cla*ame', + 'Ano?herClassName', + ], + ]] + ); }; ``` @@ -8771,7 +9190,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(OrderPublicInterfaceMethodRector::class) - ->call('configure', [[OrderPublicInterfaceMethodRector::METHOD_ORDER_BY_INTERFACES => ['FoodRecipeInterface' => ['getDescription', 'process']]]]); + ->call( + 'configure', + [[ + OrderPublicInterfaceMethodRector::METHOD_ORDER_BY_INTERFACES => [ + 'FoodRecipeInterface' => ['getDescription', 'process'], + ], + ]] + ); }; ``` @@ -9235,7 +9661,19 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ArrayArgumentInTestToDataProviderRector::class) - ->call('configure', [[ArrayArgumentInTestToDataProviderRector::ARRAY_ARGUMENTS_TO_DATA_PROVIDERS => inline_value_objects([new ArrayArgumentToDataProvider('PHPUnit\Framework\TestCase', 'doTestMultiple', 'doTestSingle', 'number')])]]); + ->call( + 'configure', + [[ + ArrayArgumentInTestToDataProviderRector::ARRAY_ARGUMENTS_TO_DATA_PROVIDERS => inline_value_objects( + [new ArrayArgumentToDataProvider( + 'PHPUnit\Framework\TestCase', + 'doTestMultiple', + 'doTestSingle', + 'number' + )] + ), + ]] + ); }; ``` @@ -10485,7 +10923,12 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(StringClassNameToClassConstantRector::class) - ->call('configure', [[StringClassNameToClassConstantRector::CLASSES_TO_SKIP => ['ClassName', 'AnotherClassName']]]); + ->call( + 'configure', + [[ + StringClassNameToClassConstantRector::CLASSES_TO_SKIP => ['ClassName', 'AnotherClassName'], + ]] + ); }; ``` @@ -11052,7 +11495,15 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ReservedObjectRector::class) - ->call('configure', [[ReservedObjectRector::RESERVED_KEYWORDS_TO_REPLACEMENTS => ['ReservedObject' => 'SmartObject', 'Object' => 'AnotherSmartObject']]]); + ->call( + 'configure', + [[ + ReservedObjectRector::RESERVED_KEYWORDS_TO_REPLACEMENTS => [ + 'ReservedObject' => 'SmartObject', + 'Object' => 'AnotherSmartObject', + ], + ]] + ); }; ``` @@ -11701,7 +12152,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ReservedFnFunctionRector::class) - ->call('configure', [[ReservedFnFunctionRector::RESERVED_NAMES_TO_NEW_ONES => ['fn' => 'someFunctionName']]]); + ->call('configure', [[ + ReservedFnFunctionRector::RESERVED_NAMES_TO_NEW_ONES => [ + 'fn' => 'someFunctionName', + ], + ]]); }; ``` @@ -11762,7 +12217,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(TypedPropertyRector::class) - ->call('configure', [[TypedPropertyRector::CLASS_LIKE_TYPE_ONLY => false]]); + ->call('configure', [[ + TypedPropertyRector::CLASS_LIKE_TYPE_ONLY => false, + ]]); }; ``` @@ -12603,7 +13060,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(NewUniqueObjectToEntityFactoryRector::class) - ->call('configure', [[NewUniqueObjectToEntityFactoryRector::TYPES_TO_SERVICES => ['ClassName']]]); + ->call('configure', [[ + NewUniqueObjectToEntityFactoryRector::TYPES_TO_SERVICES => ['ClassName'], + ]]); }; ``` @@ -12656,7 +13115,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(PHPUnitStaticToKernelTestCaseGetRector::class) - ->call('configure', [[PHPUnitStaticToKernelTestCaseGetRector::STATIC_CLASS_TYPES => ['EntityFactory']]]); + ->call('configure', [[ + PHPUnitStaticToKernelTestCaseGetRector::STATIC_CLASS_TYPES => ['EntityFactory'], + ]]); }; ``` @@ -12710,7 +13171,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(PassFactoryToUniqueObjectRector::class) - ->call('configure', [[PassFactoryToUniqueObjectRector::TYPES_TO_SERVICES => ['StaticClass']]]); + ->call('configure', [[ + PassFactoryToUniqueObjectRector::TYPES_TO_SERVICES => ['StaticClass'], + ]]); }; ``` @@ -12787,7 +13250,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(SingleStaticServiceToDynamicRector::class) - ->call('configure', [[SingleStaticServiceToDynamicRector::CLASS_TYPES => ['SomeClass']]]); + ->call('configure', [[ + SingleStaticServiceToDynamicRector::CLASS_TYPES => ['SomeClass'], + ]]); }; ``` @@ -12849,7 +13314,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(StaticTypeToSetterInjectionRector::class) - ->call('configure', [[StaticTypeToSetterInjectionRector::STATIC_TYPES => ['SomeStaticClass']]]); + ->call('configure', [[ + StaticTypeToSetterInjectionRector::STATIC_TYPES => ['SomeStaticClass'], + ]]); }; ``` @@ -12903,7 +13370,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameAnnotationRector::class) - ->call('configure', [[RenameAnnotationRector::RENAMED_ANNOTATIONS_IN_TYPES => inline_value_objects([new RenameAnnotation('PHPUnit\Framework\TestCase', 'test', 'scenario')])]]); + ->call( + 'configure', + [[ + RenameAnnotationRector::RENAMED_ANNOTATIONS_IN_TYPES => inline_value_objects( + [new RenameAnnotation('PHPUnit\Framework\TestCase', 'test', 'scenario')] + ), + ]] + ); }; ``` @@ -12945,7 +13419,21 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameClassConstantRector::class) - ->call('configure', [[RenameClassConstantRector::CLASS_CONSTANT_RENAME => inline_value_objects([new RenameClassConstant('SomeClass', 'OLD_CONSTANT', 'NEW_CONSTANT'), new RenameClassConstant('SomeClass', 'OTHER_OLD_CONSTANT', 'DifferentClass::NEW_CONSTANT')])]]); + ->call( + 'configure', + [[ + RenameClassConstantRector::CLASS_CONSTANT_RENAME => inline_value_objects( + [ + new RenameClassConstant('SomeClass', 'OLD_CONSTANT', 'NEW_CONSTANT'), + new RenameClassConstant( + 'SomeClass', + 'OTHER_OLD_CONSTANT', + 'DifferentClass::NEW_CONSTANT' + ), + ] + ), + ]] + ); }; ``` @@ -12979,7 +13467,11 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameClassRector::class) - ->call('configure', [[RenameClassRector::OLD_TO_NEW_CLASSES => ['App\SomeOldClass' => 'App\SomeNewClass']]]); + ->call('configure', [[ + RenameClassRector::OLD_TO_NEW_CLASSES => [ + 'App\SomeOldClass' => 'App\SomeNewClass', + ], + ]]); }; ``` @@ -13023,7 +13515,15 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameConstantRector::class) - ->call('configure', [[RenameConstantRector::OLD_TO_NEW_CONSTANTS => ['MYSQL_ASSOC' => 'MYSQLI_ASSOC', 'OLD_CONSTANT' => 'NEW_CONSTANT']]]); + ->call( + 'configure', + [[ + RenameConstantRector::OLD_TO_NEW_CONSTANTS => [ + 'MYSQL_ASSOC' => 'MYSQLI_ASSOC', + 'OLD_CONSTANT' => 'NEW_CONSTANT', + ], + ]] + ); }; ``` @@ -13061,7 +13561,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameFunctionRector::class) - ->call('configure', [[RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => ['view' => 'Laravel\Templating\render']]]); + ->call( + 'configure', + [[ + RenameFunctionRector::OLD_FUNCTION_TO_NEW_FUNCTION => [ + 'view' => 'Laravel\Templating\render', + ], + ]] + ); }; ``` @@ -13095,7 +13602,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameMethodRector::class) - ->call('configure', [[RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects([new MethodCallRename('SomeExampleClass', 'oldMethod', 'newMethod')])]]); + ->call( + 'configure', + [[ + RenameMethodRector::METHOD_CALL_RENAMES => inline_value_objects( + [new MethodCallRename('SomeExampleClass', 'oldMethod', 'newMethod')] + ), + ]] + ); }; ``` @@ -13128,7 +13642,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameNamespaceRector::class) - ->call('configure', [[RenameNamespaceRector::OLD_TO_NEW_NAMESPACES => ['SomeOldNamespace' => 'SomeNewNamespace']]]); + ->call( + 'configure', + [[ + RenameNamespaceRector::OLD_TO_NEW_NAMESPACES => [ + 'SomeOldNamespace' => 'SomeNewNamespace', + ], + ]] + ); }; ``` @@ -13162,7 +13683,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenamePropertyRector::class) - ->call('configure', [[RenamePropertyRector::RENAMED_PROPERTIES => inline_value_objects([new RenameProperty('SomeClass', 'someOldProperty', 'someNewProperty')])]]); + ->call( + 'configure', + [[ + RenamePropertyRector::RENAMED_PROPERTIES => inline_value_objects( + [new RenameProperty('SomeClass', 'someOldProperty', 'someNewProperty')] + ), + ]] + ); }; ``` @@ -13196,7 +13724,21 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameStaticMethodRector::class) - ->call('configure', [[RenameStaticMethodRector::OLD_TO_NEW_METHODS_BY_CLASSES => inline_value_objects([new RenameStaticMethod('SomeClass', 'oldMethod', 'AnotherExampleClass', 'newStaticMethod')])]]); + ->call( + 'configure', + [[ + RenameStaticMethodRector::OLD_TO_NEW_METHODS_BY_CLASSES => inline_value_objects( + [ + new RenameStaticMethod( + 'SomeClass', + 'oldMethod', + 'AnotherExampleClass', + 'newStaticMethod' + ), + ] + ), + ]] + ); }; ``` @@ -13220,7 +13762,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(RenameStaticMethodRector::class) - ->call('configure', [[RenameStaticMethodRector::OLD_TO_NEW_METHODS_BY_CLASSES => inline_value_objects([new RenameStaticMethod('SomeClass', 'oldMethod', 'SomeClass', 'newStaticMethod')])]]); + ->call( + 'configure', + [[ + RenameStaticMethodRector::OLD_TO_NEW_METHODS_BY_CLASSES => inline_value_objects( + [new RenameStaticMethod('SomeClass', 'oldMethod', 'SomeClass', 'newStaticMethod')] + ), + ]] + ); }; ``` @@ -13256,7 +13805,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(CompleteImportForPartialAnnotationRector::class) - ->call('configure', [[CompleteImportForPartialAnnotationRector::USE_IMPORTS_TO_RESTORE => inline_value_objects([new UseWithAlias('Doctrine\ORM\Mapping', 'ORM')])]]); + ->call( + 'configure', + [[ + CompleteImportForPartialAnnotationRector::USE_IMPORTS_TO_RESTORE => inline_value_objects( + [new UseWithAlias('Doctrine\ORM\Mapping', 'ORM')] + ), + ]] + ); }; ``` @@ -13295,7 +13851,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(CompleteMissingDependencyInNewRector::class) - ->call('configure', [[CompleteMissingDependencyInNewRector::CLASS_TO_INSTANTIATE_BY_TYPE => ['RandomDependency' => 'RandomDependency']]]); + ->call( + 'configure', + [[ + CompleteMissingDependencyInNewRector::CLASS_TO_INSTANTIATE_BY_TYPE => [ + 'RandomDependency' => 'RandomDependency', + ], + ]] + ); }; ``` @@ -13674,7 +14237,9 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MultiParentingToAbstractDependencyRector::class) - ->call('configure', [[MultiParentingToAbstractDependencyRector::FRAMEWORK => 'nette']]); + ->call('configure', [[ + MultiParentingToAbstractDependencyRector::FRAMEWORK => 'nette', + ]]); }; ``` @@ -14036,7 +14601,13 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ChangeFileLoaderInExtensionAndKernelRector::class) - ->call('configure', [[ChangeFileLoaderInExtensionAndKernelRector::FROM => 'xml', ChangeFileLoaderInExtensionAndKernelRector::TO => 'yaml']]); + ->call( + 'configure', + [[ + ChangeFileLoaderInExtensionAndKernelRector::FROM => 'xml', + ChangeFileLoaderInExtensionAndKernelRector::TO => 'yaml', + ]] + ); }; ``` @@ -14154,7 +14725,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ContainerGetToConstructorInjectionRector::class) - ->call('configure', [[ContainerGetToConstructorInjectionRector::CONTAINER_AWARE_PARENT_TYPES => ['ContainerAwareParentClassName', 'ContainerAwareParentCommandClassName', 'ThisClassCallsMethodInConstructorClassName']]]); + ->call( + 'configure', + [[ + ContainerGetToConstructorInjectionRector::CONTAINER_AWARE_PARENT_TYPES => [ + 'ContainerAwareParentClassName', + 'ContainerAwareParentCommandClassName', + 'ThisClassCallsMethodInConstructorClassName', + ], + ]] + ); }; ``` @@ -14321,7 +14901,15 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(GetToConstructorInjectionRector::class) - ->call('configure', [[GetToConstructorInjectionRector::GET_METHOD_AWARE_TYPES => ['SymfonyControllerClassName', 'GetTraitClassName']]]); + ->call( + 'configure', + [[ + GetToConstructorInjectionRector::GET_METHOD_AWARE_TYPES => [ + 'SymfonyControllerClassName', + 'GetTraitClassName', + ], + ]] + ); }; ``` @@ -14762,7 +15350,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ChangeServiceArgumentsToMethodCallRector::class) - ->call('configure', [[ChangeServiceArgumentsToMethodCallRector::CLASS_TYPE_TO_METHOD_NAME => ['SomeClass' => 'configure']]]); + ->call( + 'configure', + [[ + ChangeServiceArgumentsToMethodCallRector::CLASS_TYPE_TO_METHOD_NAME => [ + 'SomeClass' => 'configure', + ], + ]] + ); }; ``` @@ -14805,7 +15400,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ReplaceArrayWithObjectRector::class) - ->call('configure', [[ReplaceArrayWithObjectRector::CONSTANT_NAMES_TO_VALUE_OBJECTS => [RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => MethodCallRename::class]]]); + ->call( + 'configure', + [[ + ReplaceArrayWithObjectRector::CONSTANT_NAMES_TO_VALUE_OBJECTS => [ + RenameMethodRector::OLD_TO_NEW_METHODS_BY_CLASS => MethodCallRename::class, + ], + ]] + ); }; ``` @@ -14858,7 +15460,21 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ArgumentFuncCallToMethodCallRector::class) - ->call('configure', [[ArgumentFuncCallToMethodCallRector::FUNCTIONS_TO_METHOD_CALLS => inline_value_objects([new ArgumentFuncCallToMethodCall('view', 'Illuminate\Contracts\View\Factory', null, 'make')])]]); + ->call( + 'configure', + [[ + ArgumentFuncCallToMethodCallRector::FUNCTIONS_TO_METHOD_CALLS => inline_value_objects( + [ + new ArgumentFuncCallToMethodCall( + 'view', + 'Illuminate\Contracts\View\Factory', + null, + 'make' + ), + ] + ), + ]] + ); }; ``` @@ -14910,7 +15526,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(FuncCallToMethodCallRector::class) - ->call('configure', [[FuncCallToMethodCallRector::FUNC_CALL_TO_CLASS_METHOD_CALL => inline_value_objects([new FuncNameToMethodCallName('view', 'Namespaced\SomeRenderer', 'render')])]]); + ->call( + 'configure', + [[ + FuncCallToMethodCallRector::FUNC_CALL_TO_CLASS_METHOD_CALL => inline_value_objects( + [new FuncNameToMethodCallName('view', 'Namespaced\SomeRenderer', 'render')] + ), + ]] + ); }; ``` @@ -14960,7 +15583,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MethodCallToAnotherMethodCallWithArgumentsRector::class) - ->call('configure', [[MethodCallToAnotherMethodCallWithArgumentsRector::METHOD_CALL_RENAMES_WITH_ADDED_ARGUMENTS => inline_value_objects([new MethodCallRenameWithArrayKey('Nette\DI\ServiceDefinition', 'setInject', 'addTag', 'inject')])]]); + ->call( + 'configure', + [[ + MethodCallToAnotherMethodCallWithArgumentsRector::METHOD_CALL_RENAMES_WITH_ADDED_ARGUMENTS => inline_value_objects( + [new MethodCallRenameWithArrayKey('Nette\DI\ServiceDefinition', 'setInject', 'addTag', 'inject')] + ), + ]] + ); }; ``` @@ -14993,7 +15623,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MethodCallToPropertyFetchRector::class) - ->call('configure', [[MethodCallToPropertyFetchRector::METHOD_CALL_TO_PROPERTY_FETCHES => ['someMethod' => 'someProperty']]]); + ->call( + 'configure', + [[ + MethodCallToPropertyFetchRector::METHOD_CALL_TO_PROPERTY_FETCHES => [ + 'someMethod' => 'someProperty', + ], + ]] + ); }; ``` @@ -15033,7 +15670,21 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(MethodCallToStaticCallRector::class) - ->call('configure', [[MethodCallToStaticCallRector::METHOD_CALLS_TO_STATIC_CALLS => inline_value_objects([new MethodCallToStaticCall('AnotherDependency', 'process', 'StaticCaller', 'anotherMethod')])]]); + ->call( + 'configure', + [[ + MethodCallToStaticCallRector::METHOD_CALLS_TO_STATIC_CALLS => inline_value_objects( + [ + new MethodCallToStaticCall( + 'AnotherDependency', + 'process', + 'StaticCaller', + 'anotherMethod' + ), + ] + ), + ]] + ); }; ``` @@ -15080,7 +15731,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(NewToStaticCallRector::class) - ->call('configure', [[NewToStaticCallRector::TYPE_TO_STATIC_CALLS => inline_value_objects([new NewToStaticCall('Cookie', 'Cookie', 'create')])]]); + ->call( + 'configure', + [[ + NewToStaticCallRector::TYPE_TO_STATIC_CALLS => inline_value_objects( + [new NewToStaticCall('Cookie', 'Cookie', 'create')] + ), + ]] + ); }; ``` @@ -15120,7 +15778,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(PropertyAssignToMethodCallRector::class) - ->call('configure', [[PropertyAssignToMethodCallRector::PROPERTY_ASSIGNS_TO_METHODS_CALLS => inline_value_objects([new PropertyAssignToMethodCall('SomeClass', 'oldProperty', 'newMethodCall')])]]); + ->call( + 'configure', + [[ + PropertyAssignToMethodCallRector::PROPERTY_ASSIGNS_TO_METHODS_CALLS => inline_value_objects( + [new PropertyAssignToMethodCall('SomeClass', 'oldProperty', 'newMethodCall')] + ), + ]] + ); }; ``` @@ -15155,7 +15820,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(PropertyToMethodRector::class) - ->call('configure', [[PropertyToMethodRector::PROPERTIES_TO_METHOD_CALLS => inline_value_objects([new PropertyToMethod('SomeObject', 'property', 'getProperty', [], 'setProperty')])]]); + ->call( + 'configure', + [[ + PropertyToMethodRector::PROPERTIES_TO_METHOD_CALLS => inline_value_objects( + [new PropertyToMethod('SomeObject', 'property', 'getProperty', [], 'setProperty')] + ), + ]] + ); }; ``` @@ -15181,7 +15853,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(PropertyToMethodRector::class) - ->call('configure', [[PropertyToMethodRector::PROPERTIES_TO_METHOD_CALLS => inline_value_objects([new PropertyToMethod('SomeObject', 'property', 'getConfig', ['someArg'], null)])]]); + ->call( + 'configure', + [[ + PropertyToMethodRector::PROPERTIES_TO_METHOD_CALLS => inline_value_objects( + [new PropertyToMethod('SomeObject', 'property', 'getConfig', ['someArg'], null)] + ), + ]] + ); }; ``` @@ -15215,7 +15894,20 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ServiceGetterToConstructorInjectionRector::class) - ->call('configure', [[ServiceGetterToConstructorInjectionRector::METHOD_CALL_TO_SERVICES => inline_value_objects([new ServiceGetterToConstructorInjection('FirstService', 'getAnotherService', 'AnotherService')])]]); + ->call( + 'configure', + [[ + ServiceGetterToConstructorInjectionRector::METHOD_CALL_TO_SERVICES => inline_value_objects( + [ + new ServiceGetterToConstructorInjection( + 'FirstService', + 'getAnotherService', + 'AnotherService' + ), + ] + ), + ]] + ); }; ``` @@ -15288,7 +15980,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(StaticCallToFuncCallRector::class) - ->call('configure', [[StaticCallToFuncCallRector::STATIC_CALLS_TO_FUNCTIONS => inline_value_objects([new StaticCallToFuncCall('OldClass', 'oldMethod', 'new_function')])]]); + ->call( + 'configure', + [[ + StaticCallToFuncCallRector::STATIC_CALLS_TO_FUNCTIONS => inline_value_objects( + [new StaticCallToFuncCall('OldClass', 'oldMethod', 'new_function')] + ), + ]] + ); }; ``` @@ -15322,7 +16021,19 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(StaticCallToMethodCallRector::class) - ->call('configure', [[StaticCallToMethodCallRector::STATIC_CALLS_TO_METHOD_CALLS => inline_value_objects([new StaticCallToMethodCall('Nette\Utils\FileSystem', 'write', 'Symplify\SmartFileSystem\SmartFileSystem', 'dumpFile')])]]); + ->call( + 'configure', + [[ + StaticCallToMethodCallRector::STATIC_CALLS_TO_METHOD_CALLS => inline_value_objects( + [new StaticCallToMethodCall( + 'Nette\Utils\FileSystem', + 'write', + 'Symplify\SmartFileSystem\SmartFileSystem', + 'dumpFile' + )] + ), + ]] + ); }; ``` @@ -15514,7 +16225,14 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(AddParamTypeDeclarationRector::class) - ->call('configure', [[AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => inline_value_objects([new AddParamTypeDeclaration('SomeClass', 'process', 0, 'string')])]]); + ->call( + 'configure', + [[ + AddParamTypeDeclarationRector::PARAMETER_TYPEHINTS => inline_value_objects( + [new AddParamTypeDeclaration('SomeClass', 'process', 0, 'string')] + ), + ]] + ); }; ``` diff --git a/ecs.php b/ecs.php index dbb1f41f2ce..d8de96f1a8c 100644 --- a/ecs.php +++ b/ecs.php @@ -91,10 +91,8 @@ return static function (ContainerConfigurator $containerConfigurator): void { '*TypeResolverTest.php', ], UnaryOperatorSpacesFixer::class => null, - // breaks on-purpose annotated variables ReturnAssignmentFixer::class => null, - StrictComparisonFixer::class => [__DIR__ . '/rules/polyfill/src/ConditionEvaluator.php'], ]); diff --git a/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php b/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php index 99544cf864c..396e1d81f29 100644 --- a/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php +++ b/packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php @@ -90,7 +90,8 @@ final class PhpDocInfoFactory $tokens = []; $phpDocNode = new AttributeAwarePhpDocNode([]); } else { - $content = $node->getDocComment()->getText(); + $content = $node->getDocComment() + ->getText(); $tokens = $this->lexer->tokenize($content); $phpDocNode = $this->parseTokensToPhpDocNode($tokens); $this->setPositionOfLastToken($phpDocNode); diff --git a/packages/better-php-doc-parser/src/PhpDocNodeFactory/MultiPhpDocNodeFactory.php b/packages/better-php-doc-parser/src/PhpDocNodeFactory/MultiPhpDocNodeFactory.php index 2ed2fc8d633..befc982681f 100644 --- a/packages/better-php-doc-parser/src/PhpDocNodeFactory/MultiPhpDocNodeFactory.php +++ b/packages/better-php-doc-parser/src/PhpDocNodeFactory/MultiPhpDocNodeFactory.php @@ -61,16 +61,13 @@ final class MultiPhpDocNodeFactory extends AbstractPhpDocNodeFactory implements IdTagValueNode::class => 'Doctrine\ORM\Mapping\Id', GeneratedValueTagValueNode::class => 'Doctrine\ORM\Mapping\GeneratedValue', JoinColumnTagValueNode::class => 'Doctrine\ORM\Mapping\JoinColumn', - // symfony/http-kernel SymfonyRouteTagValueNode::class => 'Symfony\Component\Routing\Annotation\Route', - // symfony/validator AssertRangeTagValueNode::class => 'Symfony\Component\Validator\Constraints\Range', AssertTypeTagValueNode::class => 'Symfony\Component\Validator\Constraints\Type', AssertChoiceTagValueNode::class => 'Symfony\Component\Validator\Constraints\Choice', AssertEmailTagValueNode::class => 'Symfony\Component\Validator\Constraints\Email', - // gedmo LocaleTagValueNode::class => 'Gedmo\Mapping\Annotation\Locale', BlameableTagValueNode::class => 'Gedmo\Mapping\Annotation\Blameable', @@ -85,17 +82,14 @@ final class MultiPhpDocNodeFactory extends AbstractPhpDocNodeFactory implements TranslatableTagValueNode::class => 'Gedmo\Mapping\Annotation\Translatable', LoggableTagValueNode::class => 'Gedmo\Mapping\Annotation\Loggable', TreeTagValueNode::class => 'Gedmo\Mapping\Annotation\Tree', - // Sensio SensioTemplateTagValueNode::class => 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Template', SensioMethodTagValueNode::class => 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Method', SensioRouteTagValueNode::class => 'Sensio\Bundle\FrameworkExtraBundle\Configuration\Route', - // JMS JMSInjectParamsTagValueNode::class => 'JMS\DiExtraBundle\Annotation\InjectParams', JMSServiceValueNode::class => 'JMS\DiExtraBundle\Annotation\Service', SerializerTypeTagValueNode::class => 'JMS\Serializer\Annotation\Type', - PHPDIInjectTagValueNode::class => 'DI\Annotation\Inject', ]; } diff --git a/packages/better-php-doc-parser/src/Printer/PhpDocInfoPrinter.php b/packages/better-php-doc-parser/src/Printer/PhpDocInfoPrinter.php index b92106e5cd5..8fa8aa21274 100644 --- a/packages/better-php-doc-parser/src/Printer/PhpDocInfoPrinter.php +++ b/packages/better-php-doc-parser/src/Printer/PhpDocInfoPrinter.php @@ -339,7 +339,8 @@ final class PhpDocInfoPrinter /** @var AttributeAwareNodeInterface[] $removedNodes */ $removedNodes = array_diff( - $this->phpDocInfo->getOriginalPhpDocNode()->children, + $this->phpDocInfo->getOriginalPhpDocNode() + ->children, $this->attributeAwarePhpDocNode->children ); diff --git a/packages/better-php-doc-parser/tests/PartPhpDocTagPrinter/Behavior/ArrayPartPhpDocTagPrinterTest.php b/packages/better-php-doc-parser/tests/PartPhpDocTagPrinter/Behavior/ArrayPartPhpDocTagPrinterTest.php index 0d9d5050309..d10fa90cd36 100644 --- a/packages/better-php-doc-parser/tests/PartPhpDocTagPrinter/Behavior/ArrayPartPhpDocTagPrinterTest.php +++ b/packages/better-php-doc-parser/tests/PartPhpDocTagPrinter/Behavior/ArrayPartPhpDocTagPrinterTest.php @@ -37,10 +37,14 @@ final class ArrayPartPhpDocTagPrinterTest extends TestCase public function provideData(): Iterator { - yield [['strict' => 'yes'], 'option', 'option={"strict":"yes"}']; + yield [[ + 'strict' => 'yes', + ], 'option', 'option={"strict":"yes"}']; // bool - yield [['strict' => false], 'option', 'option={"strict":false}']; + yield [[ + 'strict' => false, + ], 'option', 'option={"strict":false}']; // multiple items, separated by comma yield [ diff --git a/packages/better-php-doc-parser/tests/PhpDocParser/Helper/TagValueToPhpParserNodeMap.php b/packages/better-php-doc-parser/tests/PhpDocParser/Helper/TagValueToPhpParserNodeMap.php index e21b8897bbe..11ed247f2b3 100644 --- a/packages/better-php-doc-parser/tests/PhpDocParser/Helper/TagValueToPhpParserNodeMap.php +++ b/packages/better-php-doc-parser/tests/PhpDocParser/Helper/TagValueToPhpParserNodeMap.php @@ -36,7 +36,6 @@ final class TagValueToPhpParserNodeMap // symfony/validation AssertChoiceTagValueNode::class => Property::class, AssertTypeTagValueNode::class => Property::class, - // doctrine ColumnTagValueNode::class => Property::class, JoinTableTagValueNode::class => Property::class, @@ -44,10 +43,8 @@ final class TagValueToPhpParserNodeMap TableTagValueNode::class => Class_::class, CustomIdGeneratorTagValueNode::class => Property::class, GeneratedValueTagValueNode::class => Property::class, - // special case for constants GenericTagValueNode::class => Property::class, - SensioTemplateTagValueNode::class => Class_::class, SensioMethodTagValueNode::class => ClassMethod::class, TemplateTagValueNode::class => Class_::class, diff --git a/packages/better-php-doc-parser/tests/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php b/packages/better-php-doc-parser/tests/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php index 872fdc8f983..6a3a487a7b7 100644 --- a/packages/better-php-doc-parser/tests/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php +++ b/packages/better-php-doc-parser/tests/PhpDocParser/TagValueNodeReprint/TagValueNodeReprintTest.php @@ -64,7 +64,6 @@ final class TagValueNodeReprintTest extends AbstractPhpDocInfoTest TableTagValueNode::class => __DIR__ . '/Fixture/DoctrineTable', CustomIdGeneratorTagValueNode::class => __DIR__ . '/Fixture/DoctrineCustomIdGenerator', GeneratedValueTagValueNode::class => __DIR__ . '/Fixture/DoctrineGeneratedValue', - // special case GenericTagValueNode::class => __DIR__ . '/Fixture/ConstantReference', SensioTemplateTagValueNode::class => __DIR__ . '/Fixture/SensioTemplate', diff --git a/packages/changes-reporting/src/Output/ConsoleOutputFormatter.php b/packages/changes-reporting/src/Output/ConsoleOutputFormatter.php index d60f499290e..42580994263 100644 --- a/packages/changes-reporting/src/Output/ConsoleOutputFormatter.php +++ b/packages/changes-reporting/src/Output/ConsoleOutputFormatter.php @@ -138,7 +138,8 @@ final class ConsoleOutputFormatter implements OutputFormatterInterface $message = sprintf( 'Could not process "%s" file%s, due to: %s"%s".', - $error->getFileInfo()->getRelativeFilePathFromCwd(), + $error->getFileInfo() + ->getRelativeFilePathFromCwd(), $error->getRectorClass() ? ' by "' . $error->getRectorClass() . '"' : '', PHP_EOL, $errorMessage diff --git a/packages/changes-reporting/src/Output/JsonOutputFormatter.php b/packages/changes-reporting/src/Output/JsonOutputFormatter.php index 425e8d1cb8d..c5dc65bdf45 100644 --- a/packages/changes-reporting/src/Output/JsonOutputFormatter.php +++ b/packages/changes-reporting/src/Output/JsonOutputFormatter.php @@ -83,7 +83,8 @@ final class JsonOutputFormatter implements OutputFormatterInterface foreach ($errors as $error) { $errorData = [ 'message' => $error->getMessage(), - 'file' => $error->getFileInfo()->getPathname(), + 'file' => $error->getFileInfo() + ->getPathname(), ]; if ($error->getRectorClass()) { diff --git a/packages/changes-reporting/src/ValueObject/RectorWithFileAndLineChange.php b/packages/changes-reporting/src/ValueObject/RectorWithFileAndLineChange.php index 32bed1bc756..1552bbbdf16 100644 --- a/packages/changes-reporting/src/ValueObject/RectorWithFileAndLineChange.php +++ b/packages/changes-reporting/src/ValueObject/RectorWithFileAndLineChange.php @@ -32,7 +32,8 @@ final class RectorWithFileAndLineChange public function getRectorDefinitionsDescription(): string { - return $this->rector->getDefinition()->getDescription(); + return $this->rector->getDefinition() + ->getDescription(); } public function getRectorClass(): string diff --git a/packages/node-collector/src/NodeCollector/NodeRepository.php b/packages/node-collector/src/NodeCollector/NodeRepository.php index 29348ff6495..057c981b03a 100644 --- a/packages/node-collector/src/NodeCollector/NodeRepository.php +++ b/packages/node-collector/src/NodeCollector/NodeRepository.php @@ -275,7 +275,8 @@ final class NodeRepository $methodName = $methodReflection->getName(); /** @var string $className */ - $className = $methodReflection->getDeclaringClass()->getName(); + $className = $methodReflection->getDeclaringClass() + ->getName(); return $this->findClassMethod($className, $methodName); } diff --git a/packages/node-type-resolver/src/PHPStan/Scope/PHPStanNodeScopeResolver.php b/packages/node-type-resolver/src/PHPStan/Scope/PHPStanNodeScopeResolver.php index 2332ba6a683..bd864a97a04 100644 --- a/packages/node-type-resolver/src/PHPStan/Scope/PHPStanNodeScopeResolver.php +++ b/packages/node-type-resolver/src/PHPStan/Scope/PHPStanNodeScopeResolver.php @@ -133,7 +133,8 @@ final class PHPStanNodeScopeResolver // traversing trait inside class that is using it scope (from referenced) - the trait traversed by Rector is different (directly from parsed file) if ($scope->isInTrait()) { - $traitName = $scope->getTraitReflection()->getName(); + $traitName = $scope->getTraitReflection() + ->getName(); $this->traitNodeScopeCollector->addForTraitAndNode($traitName, $node, $scope); return; diff --git a/packages/reporting/src/EventSubscriber/PrintReportCollectorEventSubscriber.php b/packages/reporting/src/EventSubscriber/PrintReportCollectorEventSubscriber.php index f0204240152..b22f5a15c31 100644 --- a/packages/reporting/src/EventSubscriber/PrintReportCollectorEventSubscriber.php +++ b/packages/reporting/src/EventSubscriber/PrintReportCollectorEventSubscriber.php @@ -60,7 +60,9 @@ final class PrintReportCollectorEventSubscriber implements EventSubscriberInterf */ public static function getSubscribedEvents(): array { - return [AfterReportEvent::class => 'printReportCollector']; + return [ + AfterReportEvent::class => 'printReportCollector', + ]; } private function shouldSkip(): bool diff --git a/packages/static-type-mapper/src/PHPStan/NameScopeFactory.php b/packages/static-type-mapper/src/PHPStan/NameScopeFactory.php index 217dff5a0e7..25dc69c36c3 100644 --- a/packages/static-type-mapper/src/PHPStan/NameScopeFactory.php +++ b/packages/static-type-mapper/src/PHPStan/NameScopeFactory.php @@ -40,7 +40,8 @@ final class NameScopeFactory foreach ($useNodes as $useNode) { foreach ($useNode->uses as $useUse) { /** @var UseUse $useUse */ - $aliasName = $useUse->getAlias()->name; + $aliasName = $useUse->getAlias() + ->name; $useName = $useUse->name->toString(); if (! is_string($useName)) { diff --git a/phpstan.neon b/phpstan.neon index 48b9347e4fb..50e7b9c4946 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,20 +9,21 @@ includes: services: # require constant in argument position - - - class: Symplify\CodingStandard\Rules\ForceMethodCallArgumentConstantRule - tags: [phpstan.rules.rule] - arguments: - constantArgByMethodByType: - Symfony\Component\Console\Command\Command: - addArgument: [0] - addOption: [0] - Symfony\Component\Console\Input\InputInterface: - getOption: [0] - getArgument: [0] - PhpParser\Node: - getAttribute: [0] - setAttribute: [0] + + #- + # class: Symplify\CodingStandard\Rules\RequireMethodCallArgumentConstantRule + # tags: [phpstan.rules.rule] + # arguments: + # constantArgByMethodByType: + # Symfony\Component\Console\Command\Command: + # addArgument: [0] + # addOption: [0] + # Symfony\Component\Console\Input\InputInterface: + # getOption: [0] + # getArgument: [0] + # PhpParser\Node: + # getAttribute: [0] + # setAttribute: [0] - class: Symplify\CodingStandard\Rules\SeeAnnotationToTestRule @@ -512,10 +513,209 @@ parameters: - src/FileSystem/FilesFinder.php # @todo fix in symplify - - - message: '#Method call argument on position 0 must use constant over value#' - path: 'src/Rector/AbstractRector.php' + #- + # message: '#Method call argument on position 0 must use constant over value#' + # path: 'src/Rector/AbstractRector.php' - '#Method Rector\\DocumentationGenerator\\Tests\\Printer\\RectorsDocumentationPrinter\\RectorsDocumentationPrinterTest\:\:createRectorsFromRectorClasses\(\) should return array but returns array#' - '#Parameter \#1 \$rectors of method Rector\\DocumentationGenerator\\Printer\\RectorsDocumentationPrinter\:\:print\(\) expects array, array given#' + + - '#Use "Symplify\\SmartFileSystem\\SmartFileSystem\:\:dumpFile\(\)" static call over "file_put_contents\(\)" func call#' + - '#Class name start with Abstract must have abstract keyword#' + - '#Class with base "CheckNotTestsNamespaceOutsideTestsDirectoryRule" name is already used in "Rector\\PHPStanExtensions\\Rule\\CheckNotTestsNamespaceOutsideTestsDirectoryRule", "Symplify\\CodingStandard\\Rules\\CheckNotTestsNamespaceOutsideTestsDirectoryRule"\. Use unique name to make classes easy to recognize#' + - '#Class "Rector\\PHPStanExtensions\\Tests\\Rule\\CheckGetNodeTypesReturnPhpParserNodeRule\\CheckGetNodeTypesReturnPhpParserNodeRuleTest" inherits from forbidden parent class "PHPStan\\Testing\\RuleTestCase"\. Use "Symplify\\PHPStanExtensions\\Testing\\AbstractServiceAwareRuleTestCase" instead#' + - '#Class "Rector\\PHPStanExtensions\\Tests\\Rule\\CheckNotTestsNamespaceOutsideTestsDirectoryRule\\CheckNotTestsNamespaceOutsideTestsDirectoryRuleTest" inherits from forbidden parent class "PHPStan\\Testing\\RuleTestCase"\. Use "Symplify\\PHPStanExtensions\\Testing\\AbstractServiceAwareRuleTestCase" instead#' + - '#Class "Rector\\PHPStanExtensions\\Tests\\Rule\\ConfigurableRectorRule\\ConfigurableRectorRuleTest" inherits from forbidden parent class "PHPStan\\Testing\\RuleTestCase"\. Use "Symplify\\PHPStanExtensions\\Testing\\AbstractServiceAwareRuleTestCase" instead#' + - '#Class "Rector\\PHPStanExtensions\\Tests\\Rule\\KeepRectorNamespaceForRectorRule\\KeepRectorNamespaceForRectorRuleTest" inherits from forbidden parent class "PHPStan\\Testing\\RuleTestCase"\. Use "Symplify\\PHPStanExtensions\\Testing\\AbstractServiceAwareRuleTestCase" instead#' + - '#Class "Rector\\PHPStanExtensions\\Tests\\Rule\\RectorRuleAndValueObjectHaveSameStartsRule\\RectorRuleAndValueObjectHaveSameStartsRuleTest" inherits from forbidden parent class "PHPStan\\Testing\\RuleTestCase"\. Use "Symplify\\PHPStanExtensions\\Testing\\AbstractServiceAwareRuleTestCase" instead#' + - '#Class "Rector\\PHPStanExtensions\\Tests\\Rule\\RequireRectorCategoryByGetNodeTypesRule\\RequireRectorCategoryByGetNodeTypesRuleTest" inherits from forbidden parent class "PHPStan\\Testing\\RuleTestCase"\. Use "Symplify\\PHPStanExtensions\\Testing\\AbstractServiceAwareRuleTestCase" instead#' + - '#Class "Rector\\PHPStanExtensions\\Tests\\Rule\\ValueObjectHasNoValueObjectSuffixRule\\ValueObjectHasNoValueObjectSuffixRuleTest" inherits from forbidden parent class "PHPStan\\Testing\\RuleTestCase"\. Use "Symplify\\PHPStanExtensions\\Testing\\AbstractServiceAwareRuleTestCase" instead#' + - + message: '#Do not call parent method if no override process#' + paths: + - rules/symfony/tests/Rector/MethodCall/StringFormTypeToClassRector/WithContainerTest.php # 30 + - src/PhpParser/Builder/UseBuilder.php # 19 + + - + message: '#Use "Nette\\Utils\\Strings\:\:contains\(\)" static call over "strstr\(\)" func call#' + paths: + - utils/phpstan-extensions/src/Rule/CheckNotTestsNamespaceOutsideTestsDirectoryRule.php # 76 + - utils/phpstan-extensions/src/Rule/CheckNotTestsNamespaceOutsideTestsDirectoryRule.php # 81 + + - + message: '#Do not call parent method if parent method is empty#' + paths: + - rules/type-declaration/src/Exception/ConflictingPriorityException.php # 26 + - src/Exception/Application/FileProcessingException.php # 22 + - src/Exception/Rector/RectorNotFoundOrNotValidRectorClassException.php # 15 + - src/Exception/ShouldNotHappenException.php # 18 + - src/Testing/PHPUnit/AbstractGenericRectorTestCase.php # 77 + + - + message: '#Do not use factory in constructor#' + paths: + - compiler/src/Console/Command/CompileCommand.php # 70 + - packages/node-type-resolver/src/DependencyInjection/PHPStanServicesFactory.php # 38 + - packages/node-type-resolver/src/PHPStan/Scope/NodeVisitor/RemoveDeepChainMethodCallNodeVisitor.php # 37 + - packages/phpstan-static-type-mapper/src/PHPStanStaticTypeMapper.php # 37 + - packages/post-rector/src/Rector/NameImportingPostRector.php # 39 + - rules/nette-code-quality/src/NodeResolver/MethodNamesByInputNamesResolver.php # 21 + - rules/nette-to-symfony/src/Rector/ClassMethod/RenameEventNamesInEventSubscriberRector.php # 37 + - rules/type-declaration/src/Exception/ConflictingPriorityException.php # 12 + - src/Application/ActiveRectorsProvider.php # 27 + - src/Autoloading/AdditionalAutoloader.php # 39 + - src/Configuration/Configuration.php # 104 + - src/Console/Application.php # 39 + - src/Console/Output/OutputFormatterCollector.php # 20 + - src/Exception/Application/FileProcessingException.php # 13 + - src/FileSystem/FilesFinder.php # 56 + - src/Php/TypeAnalyzer.php # 47 + - src/PhpParser/NodeTraverser/RectorNodeTraverser.php # 30 + - src/Skip/Skipper.php # 30 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareMethodTagValueNodeFactory.php # 53 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareMethodTagValueParameterNodeFactory.php # 50 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareParamTagValueNodeFactory.php # 48 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePhpDocNodeFactory.php # 61 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePropertyTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareReturnTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareThrowsTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareVarTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareArrayShapeItemNodeFactory.php # 41 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareArrayShapeNodeFactory.php # 45 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareArrayTypeNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareCallableTypeNodeFactory.php # 48 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareGenericTypeNodeFactory.php # 47 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareIntersectionTypeNodeFactory.php # 44 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareNullableTypeNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareUnionTypeNodeFactory.php # 44 + - packages/better-php-doc-parser/src/PhpDocNodeFactory/PHPUnitDataProviderDocNodeFactory.php # 52 + - packages/better-php-doc-parser/src/PhpDocNodeFactory/ParamPhpDocNodeFactory.php # 81 + - packages/dynamic-type-analysis/src/Probe/TypeStaticProbe.php # 82 + - packages/node-type-resolver/src/FileSystem/CurrentFileInfoProvider.php # 22 + - packages/node-type-resolver/src/FileSystem/CurrentFileInfoProvider.php # 35 + - packages/phpstan-static-type-mapper/src/TypeMapper/ObjectTypeMapper.php # 123 + - packages/phpstan-static-type-mapper/src/TypeMapper/ObjectWithoutClassTypeMapper.php # 72 + - packages/rector-generator/src/Rector/Closure/AddNewServiceToSymfonyPhpConfigRector.php # 39 + - rules/nette-code-quality/src/FormControlTypeResolver/AssignedVariablesMethodCallsFormTypeResolver.php # 50 + - rules/nette-code-quality/src/FormControlTypeResolver/ClassMethodFormTypeResolver.php # 67 + - rules/nette-code-quality/src/FormControlTypeResolver/ConstructorFormControlTypeResolver.php # 62 + - rules/nette-code-quality/src/FormControlTypeResolver/GetComponentMethodCallFormControlTypeResolver.php # 110 + - rules/nette-code-quality/src/FormControlTypeResolver/MagicNetteFactoryInterfaceFormControlTypeResolver.php # 95 + - rules/nette-code-quality/src/FormControlTypeResolver/MethodCallFormControlTypeResolver.php # 59 + - rules/nette-code-quality/src/FormControlTypeResolver/NewFormControlTypeResolver.php # 61 + - rules/nette-code-quality/src/FormControlTypeResolver/ReturnFormControlTypeResolver.php # 54 + - rules/nette-code-quality/src/FormControlTypeResolver/ThisVariableInAnotherMethodFormControlTypeResolver.php # 52 + - rules/nette-code-quality/src/FormControlTypeResolver/VariableConstructorFormControlTypeResolver.php # 84 + - src/Configuration/ChangeConfiguration.php # 17 + - src/Configuration/Configuration.php # 149 + - src/Configuration/Configuration.php # 172 + - src/Configuration/Configuration.php # 204 + - src/Configuration/Configuration.php # 227 + - src/Configuration/CurrentNodeProvider.php # 16 + - src/HttpKernel/RectorKernel.php # 70 + - src/Rector/AbstractRector/CallableNodeTraverserTrait.php # 24 + - src/Rector/AbstractRector/CallableNodeTraverserTrait.php # 24 + - src/Rector/AbstractRector/ConstFetchAnalyzerTrait.php # 24 + - src/Rector/AbstractRector/ConstFetchAnalyzerTrait.php # 24 + - src/Testing/NodeVisitor/AttributeCollectingNodeVisitor.php # 24 + + - + message: '#Do not use factory in constructor#' + paths: + - src/Testing/PHPUnit/Runnable/ClassLikeNamesSuffixer.php # 27 + - src/Testing/PHPUnit/Runnable/RunnableClassFinder.php # 29 + - utils/node-documentation-generator/src/ValueObject/NodeInfo.php # 29 + + - + message: '#Method with @required need to be named autowire\+class name#' + paths: + - packages/node-collector/src/NodeCollector/NodeRepository.php # 126 + - packages/node-collector/src/NodeCollector/ParsedClassConstFetchNodeCollector.php # 44 + - packages/node-collector/src/NodeCollector/ParsedPropertyFetchNodeCollector.php # 46 + - packages/node-name-resolver/src/NodeNameResolver/ClassConstFetchNameResolver.php # 22 + - packages/node-name-resolver/src/NodeNameResolver/ClassConstNameResolver.php # 22 + - packages/node-name-resolver/src/NodeNameResolver/ParamNameResolver.php # 22 + - packages/node-name-resolver/src/NodeNameResolver/PropertyNameResolver.php # 22 + - packages/node-name-resolver/src/NodeNameResolver/UseNameResolver.php # 22 + - packages/node-type-resolver/src/NodeTypeResolver/ArrayDimFetchTypeResolver.php # 24 + - packages/node-type-resolver/src/NodeTypeResolver/CastTypeResolver.php # 23 + - packages/node-type-resolver/src/NodeTypeResolver/ClassConstFetchTypeResolver.php # 23 + - packages/node-type-resolver/src/NodeTypeResolver/ClassMethodOrClassConstTypeResolver.php # 27 + - packages/node-type-resolver/src/NodeTypeResolver/ParamTypeResolver.php # 58 + - packages/node-type-resolver/src/NodeTypeResolver/PropertyFetchTypeResolver.php # 79 + - packages/node-type-resolver/src/NodeTypeResolver/StaticCallTypeResolver.php # 37 + - packages/node-type-resolver/src/NodeTypeResolver/VariableTypeResolver.php # 92 + - packages/phpstan-static-type-mapper/src/TypeMapper/CallableTypeMapper.php # 28 + - packages/static-type-mapper/src/PhpDocParser/ArrayTypeMapper.php # 35 + - packages/static-type-mapper/src/PhpDocParser/NullableTypeMapper.php # 32 + - rules/naming/src/Guard/PropertyConflictingNameGuard/MatchPropertyTypeConflictingNameGuard.php # 14 + - rules/naming/src/Guard/PropertyConflictingNameGuard/UnderscoreCamelCaseConflictingNameGuard.php # 14 + - rules/symfony/src/Rector/MethodCall/AbstractToConstructorInjectionRector.php # 37 + - rules/type-declaration/src/TypeInferer/ParamTypeInferer/PHPUnitDataProviderParamTypeInferer.php # 51 + - src/Console/Command/AbstractCommand.php # 26 + - src/Rector/AbstractRector.php # 125 + - src/Rector/AbstractRector/BetterStandardPrinterTrait.php # 37 + - src/Rector/AbstractRector/BetterStandardPrinterTrait.php # 37 + - src/Rector/AbstractRector/CallableNodeTraverserTrait.php # 24 + - src/Rector/AbstractRector/CallableNodeTraverserTrait.php # 24 + - src/Rector/AbstractRector/ComplexRemovalTrait.php # 59 + - src/Rector/AbstractRector/ComplexRemovalTrait.php # 59 + - src/Rector/AbstractRector/ConstFetchAnalyzerTrait.php # 24 + - src/Rector/AbstractRector/ConstFetchAnalyzerTrait.php # 24 + - src/Rector/AbstractRector/NodeTypeResolverTrait.php # 59 + - src/Rector/AbstractRector/NodeTypeResolverTrait.php # 59 + - src/Rector/AbstractRector/VisibilityTrait.php # 29 + - src/Rector/AbstractRector/VisibilityTrait.php # 29 + + - + message: '#Do not use setter on a service#' + paths: + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareExtendsTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareImplementsTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareMethodTagValueNodeFactory.php # 53 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareMethodTagValueParameterNodeFactory.php # 50 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareParamTagValueNodeFactory.php # 48 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePhpDocNodeFactory.php # 61 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwarePropertyTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareReturnTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareThrowsTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/PhpDoc/AttributeAwareVarTagValueNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareArrayShapeItemNodeFactory.php # 41 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareArrayShapeNodeFactory.php # 45 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareArrayTypeNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareCallableTypeNodeFactory.php # 48 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareGenericTypeNodeFactory.php # 47 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareIntersectionTypeNodeFactory.php # 44 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareNullableTypeNodeFactory.php # 42 + - packages/attribute-aware-php-doc/src/AttributeAwareNodeFactory/Type/AttributeAwareUnionTypeNodeFactory.php # 44 + - packages/better-php-doc-parser/src/PhpDocNodeFactory/PHPUnitDataProviderDocNodeFactory.php # 52 + - packages/better-php-doc-parser/src/PhpDocNodeFactory/ParamPhpDocNodeFactory.php # 81 + - packages/dynamic-type-analysis/src/Probe/TypeStaticProbe.php # 82 + - packages/node-type-resolver/src/FileSystem/CurrentFileInfoProvider.php # 22 + - packages/node-type-resolver/src/FileSystem/CurrentFileInfoProvider.php # 35 + - packages/phpstan-static-type-mapper/src/TypeMapper/ObjectTypeMapper.php # 123 + - packages/phpstan-static-type-mapper/src/TypeMapper/ObjectWithoutClassTypeMapper.php # 72 + - packages/rector-generator/src/Rector/Closure/AddNewServiceToSymfonyPhpConfigRector.php # 39 + - rules/nette-code-quality/src/FormControlTypeResolver/AssignedVariablesMethodCallsFormTypeResolver.php # 50 + - rules/nette-code-quality/src/FormControlTypeResolver/ClassMethodFormTypeResolver.php # 67 + - rules/nette-code-quality/src/FormControlTypeResolver/ConstructorFormControlTypeResolver.php # 62 + - rules/nette-code-quality/src/FormControlTypeResolver/GetComponentMethodCallFormControlTypeResolver.php # 110 + - rules/nette-code-quality/src/FormControlTypeResolver/MagicNetteFactoryInterfaceFormControlTypeResolver.php # 95 + - rules/nette-code-quality/src/FormControlTypeResolver/MethodCallFormControlTypeResolver.php # 59 + - rules/nette-code-quality/src/FormControlTypeResolver/NewFormControlTypeResolver.php # 61 + - rules/nette-code-quality/src/FormControlTypeResolver/ReturnFormControlTypeResolver.php # 54 + - rules/nette-code-quality/src/FormControlTypeResolver/ThisVariableInAnotherMethodFormControlTypeResolver.php # 52 + - rules/nette-code-quality/src/FormControlTypeResolver/VariableConstructorFormControlTypeResolver.php # 84 + - src/Configuration/ChangeConfiguration.php # 17 + - src/Configuration/Configuration.php # 149 + - src/Configuration/Configuration.php # 172 + - src/Configuration/Configuration.php # 204 + - src/Configuration/Configuration.php # 227 + - src/Configuration/CurrentNodeProvider.php # 16 + - src/HttpKernel/RectorKernel.php # 70 + - src/Rector/AbstractRector/CallableNodeTraverserTrait.php # 24 + - src/Rector/AbstractRector/CallableNodeTraverserTrait.php # 24 + - src/Rector/AbstractRector/ConstFetchAnalyzerTrait.php # 24 + - src/Rector/AbstractRector/ConstFetchAnalyzerTrait.php # 24 + - src/Testing/NodeVisitor/AttributeCollectingNodeVisitor.php # 24 \ No newline at end of file diff --git a/rules/doctrine/src/EventSubscriber/ReportEntitiesWithAddedPropertiesEventSubscriber.php b/rules/doctrine/src/EventSubscriber/ReportEntitiesWithAddedPropertiesEventSubscriber.php index e9304ab3f90..f3a5b5e4248 100644 --- a/rules/doctrine/src/EventSubscriber/ReportEntitiesWithAddedPropertiesEventSubscriber.php +++ b/rules/doctrine/src/EventSubscriber/ReportEntitiesWithAddedPropertiesEventSubscriber.php @@ -56,7 +56,9 @@ final class ReportEntitiesWithAddedPropertiesEventSubscriber implements EventSub */ public static function getSubscribedEvents(): array { - return [AfterProcessEvent::class => 'reportEntities']; + return [ + AfterProcessEvent::class => 'reportEntities', + ]; } /** @@ -68,7 +70,9 @@ final class ReportEntitiesWithAddedPropertiesEventSubscriber implements EventSub return; } - $jsonContent = Json::encode(['new_columns_by_class' => $data], Json::PRETTY); + $jsonContent = Json::encode([ + 'new_columns_by_class' => $data, + ], Json::PRETTY); $filePath = getcwd() . '/' . $fileName; $this->smartFileSystem->dumpFile($filePath, $jsonContent); diff --git a/rules/doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php b/rules/doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php index 937250d9a75..51313d0adb8 100644 --- a/rules/doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php +++ b/rules/doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php @@ -68,8 +68,12 @@ final class PhpDocTagNodeFactory $joinTableTagValueNode = new JoinTableTagValueNode( $uuidJoinTable, null, - [new JoinColumnTagValueNode(['referencedColumnName' => self::UUID])], - [new JoinColumnTagValueNode(['referencedColumnName' => self::UUID])], + [new JoinColumnTagValueNode([ + 'referencedColumnName' => self::UUID, + ])], + [new JoinColumnTagValueNode([ + 'referencedColumnName' => self::UUID, + ])], '', new OpeningAndClosingSpace('', ''), new OpeningAndClosingSpace('', '') diff --git a/rules/generic/tests/Rector/ClassMethod/ArgumentRemoverRector/ArgumentRemoverRectorTest.php b/rules/generic/tests/Rector/ClassMethod/ArgumentRemoverRector/ArgumentRemoverRectorTest.php index 50eea03c03f..7a70b31a15f 100644 --- a/rules/generic/tests/Rector/ClassMethod/ArgumentRemoverRector/ArgumentRemoverRectorTest.php +++ b/rules/generic/tests/Rector/ClassMethod/ArgumentRemoverRector/ArgumentRemoverRectorTest.php @@ -43,7 +43,9 @@ final class ArgumentRemoverRectorTest extends AbstractRectorTestCase 55, 5.5, ]), - new ArgumentRemover(RemoveInTheMiddle::class, 'run', 1, ['name' => 'second']), + new ArgumentRemover(RemoveInTheMiddle::class, 'run', 1, [ + 'name' => 'second', + ]), ], ], ]; diff --git a/rules/magic-disclosure/src/ValueObject/AssignAndRootExpr.php b/rules/magic-disclosure/src/ValueObject/AssignAndRootExpr.php index 2b68b30da3e..c8405ef44dc 100644 --- a/rules/magic-disclosure/src/ValueObject/AssignAndRootExpr.php +++ b/rules/magic-disclosure/src/ValueObject/AssignAndRootExpr.php @@ -75,7 +75,8 @@ final class AssignAndRootExpr { if ($this->isFirstCallFactory && $this->getFirstAssign() !== null) { /** @var Assign $currentMethodCall */ - $currentMethodCall = $this->getFirstAssign()->expr; + $currentMethodCall = $this->getFirstAssign() + ->expr; while ($currentMethodCall->var instanceof MethodCall) { $currentMethodCall = $currentMethodCall->var; } diff --git a/rules/naming/src/Guard/NotPrivatePropertyGuard.php b/rules/naming/src/Guard/NotPrivatePropertyGuard.php index 469c2c09494..1f3c715f711 100644 --- a/rules/naming/src/Guard/NotPrivatePropertyGuard.php +++ b/rules/naming/src/Guard/NotPrivatePropertyGuard.php @@ -14,6 +14,7 @@ final class NotPrivatePropertyGuard implements GuardInterface */ public function check(RenameValueObjectInterface $renameValueObject): bool { - return ! $renameValueObject->getNode()->isPrivate(); + return ! $renameValueObject->getNode() + ->isPrivate(); } } diff --git a/rules/nette-kdyby/src/NodeFactory/EventValueObjectClassFactory.php b/rules/nette-kdyby/src/NodeFactory/EventValueObjectClassFactory.php index 05a413a0fe0..667db621ace 100644 --- a/rules/nette-kdyby/src/NodeFactory/EventValueObjectClassFactory.php +++ b/rules/nette-kdyby/src/NodeFactory/EventValueObjectClassFactory.php @@ -130,7 +130,8 @@ final class EventValueObjectClassFactory { $usedVariableNames = []; - $className = $classBuilder->getNode()->name; + $className = $classBuilder->getNode() + ->name; foreach ($variablesWithTypes as $variablesWithType) { if (in_array($variablesWithType->getName(), $usedVariableNames, true)) { diff --git a/rules/nette-to-symfony/src/Rector/MethodCall/NetteFormToSymfonyFormRector.php b/rules/nette-to-symfony/src/Rector/MethodCall/NetteFormToSymfonyFormRector.php index 69ab086c200..a73179b69b8 100644 --- a/rules/nette-to-symfony/src/Rector/MethodCall/NetteFormToSymfonyFormRector.php +++ b/rules/nette-to-symfony/src/Rector/MethodCall/NetteFormToSymfonyFormRector.php @@ -41,17 +41,14 @@ final class NetteFormToSymfonyFormRector extends AbstractRector 'addHidden' => 'Symfony\Component\Form\Extension\Core\Type\HiddenType', // https://symfony.com/doc/current/reference/forms/types/checkbox.html 'addCheckbox' => 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', - 'addUpload' => 'Symfony\Component\Form\Extension\Core\Type\FileType', 'addImage' => 'Symfony\Component\Form\Extension\Core\Type\FileType', 'addMultiUpload' => 'Symfony\Component\Form\Extension\Core\Type\FileType', - // https://symfony.com/doc/current/reference/forms/types/choice.html#select-tag-checkboxes-or-radio-buttons 'addSelect' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', 'addRadioList' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', 'addCheckboxList' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', 'addMultiSelect' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', - 'addSubmit' => 'Symfony\Component\Form\Extension\Core\Type\SubmitType', 'addButton' => 'Symfony\Component\Form\Extension\Core\Type\ButtonType', ]; diff --git a/rules/phpstan/src/Rector/Assign/PHPStormVarAnnotationRector.php b/rules/phpstan/src/Rector/Assign/PHPStormVarAnnotationRector.php index 75e3ff60ada..6afe8d10139 100644 --- a/rules/phpstan/src/Rector/Assign/PHPStormVarAnnotationRector.php +++ b/rules/phpstan/src/Rector/Assign/PHPStormVarAnnotationRector.php @@ -125,7 +125,8 @@ CODE_SAMPLE private function getDocContent(Node $node): string { if ($node->getDocComment() !== null) { - return $node->getDocComment()->getText(); + return $node->getDocComment() + ->getText(); } if ($node->getComments() !== []) { diff --git a/rules/type-declaration/src/Rector/ClassMethod/AddArrayReturnDocTypeRector.php b/rules/type-declaration/src/Rector/ClassMethod/AddArrayReturnDocTypeRector.php index 498eac3b73d..880b52c1d2d 100644 --- a/rules/type-declaration/src/Rector/ClassMethod/AddArrayReturnDocTypeRector.php +++ b/rules/type-declaration/src/Rector/ClassMethod/AddArrayReturnDocTypeRector.php @@ -261,7 +261,9 @@ CODE_SAMPLE return false; } - return $currentReturnType->getItemType()->isCallable()->yes(); + return $currentReturnType->getItemType() + ->isCallable() + ->yes(); } private function isClassStringArrayByStringArrayOverride(ArrayType $arrayType, ClassMethod $classMethod): bool diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index 5a9bc7783a9..64ce7469de6 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -36,11 +36,13 @@ abstract class AbstractCommand extends Command } catch (RuntimeException $runtimeException) { if (Strings::contains($runtimeException->getMessage(), 'Not enough arguments')) { // sometimes there is "command" argument, not really needed on fail of chosen command and missing argument - $arguments = $this->getDefinition()->getArguments(); + $arguments = $this->getDefinition() + ->getArguments(); if (isset($arguments['command'])) { unset($arguments['command']); - $this->getDefinition()->setArguments($arguments); + $this->getDefinition() + ->setArguments($arguments); } $this->textDescriptor->describe($output, $this); @@ -59,7 +61,8 @@ abstract class AbstractCommand extends Command return; } - $this->getApplication()->setCatchExceptions(false); + $this->getApplication() + ->setCatchExceptions(false); } } } diff --git a/src/PhpParser/Node/Value/ValueResolver.php b/src/PhpParser/Node/Value/ValueResolver.php index b64b1b6465a..dc6165bb687 100644 --- a/src/PhpParser/Node/Value/ValueResolver.php +++ b/src/PhpParser/Node/Value/ValueResolver.php @@ -86,7 +86,8 @@ final class ValueResolver } try { - $value = $this->getConstExprEvaluator()->evaluateDirectly($expr); + $value = $this->getConstExprEvaluator() + ->evaluateDirectly($expr); } catch (ConstExprEvaluationException $constExprEvaluationException) { $value = null; } diff --git a/src/Skip/Skipper.php b/src/Skip/Skipper.php index adc47875b8c..9e061ae4609 100644 --- a/src/Skip/Skipper.php +++ b/src/Skip/Skipper.php @@ -5,7 +5,9 @@ declare(strict_types=1); namespace Rector\Core\Skip; use Nette\Utils\Strings; +use Rector\Core\Configuration\Option; use Rector\Core\Rector\AbstractRector; +use Symplify\PackageBuilder\Parameter\ParameterProvider; use Symplify\SmartFileSystem\SmartFileInfo; final class Skipper @@ -21,30 +23,28 @@ final class Skipper private const ONLY_STARTS_WITH_ASTERISK_REGEX = '#^\*(.*?)[^*]$#'; /** - * @var mixed[] + * @var ParameterProvider */ - private $skip = []; + private $parameterProvider; - /** - * @param mixed[] $skip - */ - public function __construct(array $skip = []) + public function __construct(ParameterProvider $parameterProvider) { - $this->skip = $skip; + $this->parameterProvider = $parameterProvider; } public function shouldSkipFileInfoAndRule(SmartFileInfo $smartFileInfo, AbstractRector $rector): bool { - if ($this->skip === []) { + $skip = $this->parameterProvider->provideArrayParameter(Option::SKIP); + if ($skip === []) { return false; } $rectorClass = get_class($rector); - if (! array_key_exists($rectorClass, $this->skip)) { + if (! array_key_exists($rectorClass, $skip)) { return false; } - $locations = $this->skip[$rectorClass]; + $locations = $skip[$rectorClass]; $filePathName = $smartFileInfo->getPathName(); if (in_array($filePathName, $locations, true)) { return true; diff --git a/src/Testing/NodeVisitor/AttributeCollectingNodeVisitor.php b/src/Testing/NodeVisitor/AttributeCollectingNodeVisitor.php index 9d24d154f04..76e2d0e79b8 100644 --- a/src/Testing/NodeVisitor/AttributeCollectingNodeVisitor.php +++ b/src/Testing/NodeVisitor/AttributeCollectingNodeVisitor.php @@ -37,7 +37,9 @@ final class AttributeCollectingNodeVisitor extends NodeVisitorAbstract } $attributes = $this->getFilteredAttributes($node); - $this->attributes[] = array_merge(['node_class' => get_class($node)], $attributes); + $this->attributes[] = array_merge([ + 'node_class' => get_class($node), + ], $attributes); return null; } diff --git a/src/Testing/PHPUnit/AbstractGenericRectorTestCase.php b/src/Testing/PHPUnit/AbstractGenericRectorTestCase.php index 29f2422fda1..c555e60b7f8 100644 --- a/src/Testing/PHPUnit/AbstractGenericRectorTestCase.php +++ b/src/Testing/PHPUnit/AbstractGenericRectorTestCase.php @@ -198,7 +198,9 @@ abstract class AbstractGenericRectorTestCase extends AbstractKernelTestCase impl $rectorClass = $this->getRectorClass(); $this->ensureRectorClassIsValid($rectorClass, 'getRectorClass'); - return [$rectorClass => null]; + return [ + $rectorClass => null, + ]; } protected function yieldFilesFromDirectory(string $directory, string $suffix = '*.php.inc'): Iterator diff --git a/src/Testing/PHPUnit/Runnable/RunnableClassFinder.php b/src/Testing/PHPUnit/Runnable/RunnableClassFinder.php index 34c31b32244..b8af322cfff 100644 --- a/src/Testing/PHPUnit/Runnable/RunnableClassFinder.php +++ b/src/Testing/PHPUnit/Runnable/RunnableClassFinder.php @@ -49,7 +49,9 @@ final class RunnableClassFinder private function decorateNodesWithNames(array $nodes): void { $nodeTraverser = new NodeTraverser(); - $nodeTraverser->addVisitor(new NameResolver(null, ['preserveOriginalNames' => true])); + $nodeTraverser->addVisitor(new NameResolver(null, [ + 'preserveOriginalNames' => true, + ])); $nodeTraverser->traverse($nodes); } diff --git a/tests/PhpParser/Node/NodeFactoryTest.php b/tests/PhpParser/Node/NodeFactoryTest.php index 40b3bd08ad6..f68b6e0331e 100644 --- a/tests/PhpParser/Node/NodeFactoryTest.php +++ b/tests/PhpParser/Node/NodeFactoryTest.php @@ -48,6 +48,8 @@ final class NodeFactoryTest extends AbstractKernelTestCase $array = new Array_(); $array->items[] = new ArrayItem(new LNumber(1), new String_('a')); - yield [['a' => 1], $array]; + yield [[ + 'a' => 1, + ], $array]; } } diff --git a/utils/phpstan-extensions/src/Rule/CheckGetNodeTypesReturnPhpParserNodeRule.php b/utils/phpstan-extensions/src/Rule/CheckGetNodeTypesReturnPhpParserNodeRule.php index 30bec536e3e..b73217469ce 100644 --- a/utils/phpstan-extensions/src/Rule/CheckGetNodeTypesReturnPhpParserNodeRule.php +++ b/utils/phpstan-extensions/src/Rule/CheckGetNodeTypesReturnPhpParserNodeRule.php @@ -50,7 +50,8 @@ final class CheckGetNodeTypesReturnPhpParserNodeRule implements Rule return [sprintf( self::ERROR, - $scope->getClassReflection()->getName(), + $scope->getClassReflection() + ->getName(), Node::class, implode(",\n", $incorrectClassNames) )];