From cff4bc63ab25ad8d13d7a306de49facf2b958d86 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Thu, 6 May 2021 16:32:28 +0200 Subject: [PATCH] move from SETS parameter to explicit include --- README.md | 5 +-- build/config/config-downgrade-php70.php | 12 +++---- build/config/config-downgrade.php | 10 +++--- docs/init_command.md | 3 +- ecs.php | 5 ++- .../ParamPhpDocNodeVisitor.php | 5 ++- .../PhpDocParser/BetterPhpDocParser.php | 4 +-- packages/Caching/Config/FileHashComputer.php | 3 +- .../Rector/NodeAddingPostRector.php | 14 ++++---- .../Rector/NodeRemovingPostRector.php | 8 +++-- .../Rector/NodeToReplacePostRector.php | 10 +++--- .../Rector/PropertyAddingPostRector.php | 8 +++-- .../PostRector/Rector/UseAddingPostRector.php | 8 +++-- rector.php | 33 +++++++++---------- .../config/configured_rule.php | 6 ++-- .../config/configured_rule.php | 11 +++++-- .../config/configured_rule.php | 14 ++++---- .../config/configured_rule.php | 20 ++++++----- .../config/configured_rule.php | 3 +- .../config/configured_rule.php | 22 +++++++------ .../config/configured_rule.php | 10 +++--- .../FuncCall/SwapFuncCallArgumentsRector.php | 3 +- .../MethodCall/ValueObjectWrapArgRector.php | 8 ++--- .../MoveEntitiesToEntityDirectoryRector.php | 6 ++-- .../MoveServicesBySuffixToDirectoryRector.php | 12 +++---- ...acesToContractNamespaceDirectoryRector.php | 6 ++-- ...CarbonSingularMethodCallToPluralRector.php | 6 ++-- .../ChangeDiffForHumansArgsRector.php | 6 ++-- .../NodeManipulator/ExprBoolCaster.php | 2 +- .../ArrayThisCallToThisMethodCallRector.php | 5 +-- ...ableThisArrayToAnonymousFunctionRector.php | 5 +-- .../SplitListAssignToSeparateLineRector.php | 5 +-- .../SimplifyDeMorganBinaryRector.php | 5 +-- .../Rector/Concat/JoinStringConcatRector.php | 5 +-- ...seIdenticalOverEqualWithSameTypeRector.php | 5 +-- .../ForRepeatedCountToOwnVariableRector.php | 5 +-- ...hItemsAssignToEmptyArrayToAssignRector.php | 5 +-- .../SimplifyForeachToArrayFilterRector.php | 5 +-- .../SimplifyForeachToCoalescingRector.php | 5 +-- .../UnusedForeachValueToArrayKeysRector.php | 5 +-- ...ayKeysAndInArrayToArrayKeyExistsRector.php | 5 +-- ...rayMergeOfNonArraysToSimpleArrayRector.php | 5 +-- .../ChangeArrayPushToArrayAssignRector.php | 5 +-- .../FuncCall/IntvalToTypeCastRector.php | 5 +-- .../IsAWithStringWithThirdArgumentRector.php | 5 +-- .../FuncCall/SimplifyInArrayValuesRector.php | 3 +- .../FuncCall/SingleInArrayToCompareRector.php | 5 +-- ...aysTrueConditionSetInConstructorRector.php | 5 +-- ...lipTypeControlToUseExclusiveTypeRector.php | 5 +-- .../SimplifyBoolIdenticalTrueRector.php | 5 +-- ...StrlenZeroToIdenticalEmptyStringRector.php | 5 +-- .../If_/SimplifyIfElseToTernaryRector.php | 5 +-- .../If_/SimplifyIfNotNullReturnRector.php | 5 +-- .../Rector/If_/SimplifyIfReturnBoolRector.php | 5 +-- .../LogicalAnd/LogicalToBooleanRector.php | 5 +-- .../FixClassCaseSensitivityNameRector.php | 5 +-- .../Rector/New_/NewStaticToNewSelfRector.php | 1 - .../Rector/NotEqual/CommonNotEqualRector.php | 5 +-- ...istsTernaryThenValueToCoalescingRector.php | 5 +-- .../SimplifyDuplicatedTernaryRector.php | 5 +-- .../Ternary/SwitchNegatedTernaryRector.php | 5 +-- ...VariableDeclarationNearReferenceRector.php | 5 +-- .../Assign/PHPStormVarAnnotationRector.php | 5 +-- .../CatchExceptionNameMatchingTypeRector.php | 5 +-- .../ClassConst/VarConstantCommentRector.php | 5 +-- .../FuncGetArgsToVariadicParamRector.php | 1 - ...moveDoubleUnderscoreInMethodNameRector.php | 5 +-- .../AddArrayDefaultToArrayPropertyRector.php | 5 +-- .../EncapsedStringsToSprintfRector.php | 5 +-- .../FuncCall/ConsistentImplodeRector.php | 5 +-- ...CountArrayToEmptyArrayComparisonRector.php | 5 +-- .../FuncCall/PreslashSimpleFunctionRector.php | 5 +-- .../FuncCall/StrictArraySearchRector.php | 3 +- ...VersionCompareFuncCallToConstantRector.php | 5 +-- .../Include_/FollowRequireByDirRector.php | 5 +-- ...VariableForSprintfInSymfonyStyleRector.php | 2 +- .../AddFalseDefaultToBoolPropertyRector.php | 5 +-- ...ngClassConstantToClassConstFetchRector.php | 5 +-- .../String_/SymplifyQuoteEscapeRector.php | 5 +-- ...rnaryConditionVariableAssignmentRector.php | 5 +-- .../AddPackageToRequireComposerRector.php | 3 +- .../AddPackageToRequireDevComposerRector.php | 3 +- .../ChangePackageVersionComposerRector.php | 3 +- .../Rector/RemovePackageComposerRector.php | 3 +- ...ReplacePackageAndVersionComposerRector.php | 3 +- .../PhpDoc/DeadReturnTagValueNodeAnalyzer.php | 4 ++- ...RemoveAssignOfVoidReturnFunctionRector.php | 5 +-- .../RemoveDelegatingParentCallRector.php | 5 +-- .../RemoveEmptyClassMethodRector.php | 5 +-- .../RemoveUnusedConstructorParamRector.php | 1 - ...moveUnusedPrivateMethodParameterRector.php | 5 +-- .../RemoveUselessParamTagRector.php | 5 +-- .../RemoveUselessReturnTagRector.php | 5 +-- .../Concat/RemoveConcatAutocastRector.php | 5 +-- .../For_/RemoveDeadIfForeachForRector.php | 5 +-- .../Rector/For_/RemoveDeadLoopRector.php | 5 +-- .../FunctionLike/RemoveDeadReturnRector.php | 5 +-- .../RemoveDuplicatedIfReturnRector.php | 5 +-- .../RemoveOverriddenValuesRector.php | 5 +-- ...UnusedNonEmptyArrayBeforeForeachRector.php | 5 +-- ...FutureCompatibleIfFunctionExistsRector.php | 5 +-- ...wrapFutureCompatibleIfPhpVersionRector.php | 5 +-- .../RemoveNonExistingVarAnnotationRector.php | 5 +-- .../RemoveDeadZeroAndOneOperationRector.php | 5 +-- ...eSetterOnlyPropertyAndMethodCallRector.php | 5 +-- .../Property/RemoveUselessVarTagRector.php | 1 - ...RemoveNullPropertyInitializationRector.php | 5 +-- .../RemoveParentCallWithoutParentRector.php | 5 +-- .../RemoveDuplicatedCaseInSwitchRector.php | 5 +-- .../ClassMethod/ReturnThisRemoveRector.php | 7 ++-- ...hainMethodCallToNormalMethodCallRector.php | 5 +-- ...MethodCallToStandaloneMethodCallRector.php | 14 +++++--- ...tterMethodCallToStandaloneAssignRector.php | 5 +-- ...FluentChainMethodCallToNonFluentRector.php | 5 +-- ...FluentChainMethodCallToNonFluentRector.php | 5 +-- .../ClassMethod/AddMethodParentCallRector.php | 3 +- ...ymmetricArrayDestructuringToListRector.php | 4 +-- ...wngradePipeToMultiCatchExceptionRector.php | 2 +- ...adeTrailingCommasInFunctionCallsRector.php | 6 ++-- .../DowngradeFlexibleHeredocSyntaxRector.php | 5 +-- .../Array_/DowngradeArraySpreadRector.php | 5 +-- ...ArrowFunctionToAnonymousFunctionRector.php | 2 +- ...deArrayMergeCallWithoutArgumentsRector.php | 5 +-- .../DowngradeStripTagsCallWithArrayRector.php | 5 +-- ...ngradeFreadFwriteFalsyToNegationRector.php | 5 +-- ...DowngradeNumericLiteralSeparatorRector.php | 7 ++-- .../DowngradeNonCapturingCatchesRector.php | 1 - ...DowngradeClassOnObjectToGetClassRector.php | 1 - ...owngradeTrailingCommasInParamUseRector.php | 6 ++-- .../DowngradePropertyPromotionRector.php | 1 - .../DowngradeMatchToSwitchRector.php | 1 - .../Rector/If_/RemoveAlwaysElseRector.php | 5 +-- .../UnnededMethodTagValueNodeFilter.php | 3 +- ...GenericsPHPStormMethodAnnotationRector.php | 3 +- .../DispatchStringToObjectRector.php | 3 +- .../MysqlPConnectToMysqliConnectRector.php | 5 +-- .../MysqlQueryMysqlErrorWithLinkRector.php | 5 +-- ...etterClassMethodNameStartWithGetRector.php | 6 ++-- ...eIsserClassMethodNameStartWithIsRector.php | 6 ++-- .../RenamePropertyToMatchTypeRector.php | 5 +-- ...iableToMatchMethodCallReturnTypeRector.php | 6 ++-- ...rderClassConstantsByIntegerValueRector.php | 5 +-- .../OrderConstantsByVisibilityRector.php | 1 - .../OrderFirstLevelClassStatementsRector.php | 1 - .../Class_/OrderMethodsByVisibilityRector.php | 1 - .../Class_/OrderPrivateMethodsByUseRector.php | 5 +-- .../OrderPropertiesByVisibilityRector.php | 1 - .../ChangeConditionalGetConditionRector.php | 5 +-- .../ChangeConditionalSetConditionRector.php | 5 +-- ...licateStyleArrayToApplyFromArrayRector.php | 5 +-- .../MethodCall/IncreaseColumnIndexRector.php | 2 +- .../RemoveSetTempDirOnExcelWriterRector.php | 5 +-- .../ChangeDataTypeForValueRector.php | 5 +-- .../ChangeIOFactoryArgumentRector.php | 2 +- ...geSearchLocationToRegisterReaderRector.php | 5 +-- .../ClearReturnNewByReferenceRector.php | 5 +-- .../ReplaceHttpServerVarsByServerRector.php | 3 +- .../FuncCall/PregReplaceEModifierRector.php | 5 +-- ...DefaultValueForUndefinedVariableRector.php | 7 ++-- .../BreakNotInLoopOrSwitchToReturnRector.php | 5 +-- .../RenameMktimeWithoutArgsToTimeRector.php | 5 +-- .../Php70/Rector/If_/IfToSpaceshipRector.php | 5 +-- ...isCallOnStaticMethodToStaticCallRector.php | 5 +-- ...ticCallOnNonStaticToInstanceCallRector.php | 5 +-- .../ReduceMultipleDefaultSwitchRector.php | 5 +-- .../Ternary/TernaryToSpaceshipRector.php | 5 +-- ...ariableVariableNameInCurlyBracesRector.php | 5 +-- .../Assign/AssignArrayToStringRector.php | 6 ++-- .../Rector/BooleanOr/IsIterableRector.php | 3 +- .../Rector/FuncCall/CountOnNullRector.php | 4 +-- .../Rector/Name/ReservedObjectRector.php | 20 ++++++----- .../TryCatch/MultiExceptionCatchRector.php | 4 +-- ...reateFunctionToAnonymousFunctionRector.php | 5 +-- .../IsObjectOnIncompleteClassRector.php | 5 +-- .../ParseStrWithResultArgumentRector.php | 5 +-- .../FuncCall/StringsAssertNakedRector.php | 5 +-- .../FuncCall/ArrayKeyFirstLastRector.php | 4 +-- .../Rector/FuncCall/SensitiveDefineRector.php | 6 ++-- .../Php73/Rector/FuncCall/SetCookieRector.php | 4 +-- .../String_/SensitiveHereNowDocRector.php | 5 +-- .../ArrayKeyExistsOnPropertyRector.php | 5 +-- .../FuncCall/FilterVarToAddSlashesRector.php | 5 +-- ...bStrrposEncodingArgumentPositionRector.php | 3 +- .../AddLiteralSeparatorToNumberRector.php | 8 +++-- ...efaultNullToNullableTypePropertyRector.php | 5 +-- .../ExportToReflectionFunctionRector.php | 5 +-- .../OptionalParametersAfterRequiredRector.php | 1 - .../Class_/AnnotationToAttributeRector.php | 3 +- .../Class_/StringableForToStringRector.php | 5 +-- .../Rector/FuncCall/ClassOnObjectRector.php | 5 +-- .../FuncCall/TokenGetAllToObjectRector.php | 5 +-- .../Rector/FunctionLike/UnionTypesRector.php | 2 +- .../Rector/Identical/StrStartsWithRector.php | 5 +-- .../Rector/If_/NullsafeOperatorRector.php | 5 +-- .../Rector/NotIdentical/StrContainsRector.php | 5 +-- .../Rector/Ternary/GetDebugTypeRector.php | 5 +-- .../BeConstructedWithAssignFactory.php | 9 ++--- .../Class_/RenameSpecFileToTestFileRector.php | 5 +-- .../PropertyFetchByMethodAnalyzer.php | 10 +++--- ...hangeGlobalVariablesToPropertiesRector.php | 5 +-- .../PrivatizeFinalClassMethodRector.php | 5 +-- .../ChangeLocalPropertyToVariableRector.php | 5 +-- ...riableWithDefaultValueToConstantRector.php | 5 +-- .../RepeatedLiteralToClassConstantRector.php | 1 - .../PrivatizeLocalGetterToPropertyRector.php | 5 +-- ...opertyWithDefaultValueToConstantRector.php | 5 +-- .../Rector/Class_/RemoveParentRector.php | 3 +- .../FuncCall/RemoveFuncCallArgRector.php | 10 +++--- .../Rector/FuncCall/RemoveFuncCallRector.php | 18 +++++----- ...llyCalledStaticMethodToNonStaticRector.php | 6 ++-- .../PassFactoryToUniqueObjectRector.php | 22 +++++++------ .../StaticTypeToSetterInjectionRector.php | 4 +-- .../NodeManipulator/IdentifierManipulator.php | 8 ++--- .../RenameClassConstFetchRector.php | 5 +-- .../PseudoNamespaceToNamespaceRector.php | 4 +-- .../CompleteMissingDependencyInNewRector.php | 3 +- .../DimFetchAssignToMethodCallRector.php | 3 +- .../Assign/GetAndSetToMethodCallRector.php | 4 +-- .../PropertyAssignToMethodCallRector.php | 4 +-- .../ClassMethod/SingleToManyMethodRector.php | 8 +++-- .../Class_/AddInterfaceByParentRector.php | 12 ++++--- .../Class_/AddInterfaceByTraitRector.php | 12 ++++--- .../Class_/ChangeSingletonToServiceRector.php | 5 +-- .../Expression/MethodCallToReturnRector.php | 12 ++++--- .../FunctionToStaticMethodRector.php | 5 +-- .../UnsetAndIssetToMethodCallRector.php | 2 +- .../MethodCallToPropertyFetchRector.php | 4 +-- .../ReplaceParentCallByPropertyCallRector.php | 3 +- .../StaticCallToMethodCallRector.php | 22 +++++++------ .../String_/ToStringToMethodCallRector.php | 4 +-- .../ArgumentFuncCallToMethodCall.php | 5 ++- .../NullTypeAssignDetector.php | 3 +- .../AddArrayParamDocTypeRector.php | 5 +-- .../AddArrayReturnDocTypeRector.php | 5 +-- .../AddVoidReturnTypeWhereNoReturnRector.php | 1 - .../ClassMethod/ReturnNeverTypeRector.php | 1 - .../ReturnTypeFromReturnNewRector.php | 1 - .../ReturnTypeFromStrictTypedCallRector.php | 1 - ...eturnTypeFromStrictTypedPropertyRector.php | 1 - .../ParamTypeDeclarationRector.php | 5 +-- ...merNullableArgumentToScalarTypedRector.php | 5 +-- ...ParamTypeFromStrictTypedPropertyRector.php | 1 - .../CompleteVarDocTypePropertyRector.php | 5 +-- ...pedPropertyFromStrictConstructorRector.php | 1 - .../ChangeConstantVisibilityRector.php | 20 +++++------ .../ChangeMethodVisibilityRector.php | 4 +-- .../ChangePropertyVisibilityRector.php | 20 +++++------ src/Configuration/Option.php | 1 + src/Console/Command/ShowCommand.php | 1 - .../Rector/RenameClassNonPhpRector.php | 23 +++++++------ src/PhpParser/Node/Value/ValueResolver.php | 6 ++-- src/Reporting/MissingRectorRulesReporter.php | 3 +- templates/rector.php.dist | 4 +-- ...urableRectorImportConfigCallsMergeTest.php | 4 +-- tests/DependencyInjection/config/one_set.php | 5 +-- .../config/one_set_with_own_rename.php | 5 +-- tests/DependencyInjection/config/two_sets.php | 6 ++-- .../config/two_sets_with_own_rename.php | 9 +++-- 258 files changed, 798 insertions(+), 623 deletions(-) diff --git a/README.md b/README.md index 2815808c5005..4ba1b3866026 100644 --- a/README.md +++ b/README.md @@ -112,17 +112,14 @@ And modify it: ```php // rector.php -use Rector\Core\Configuration\Option; use Rector\Php74\Rector\Property\TypedPropertyRector; use Rector\Set\ValueObject\SetList; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { // here we can define, what sets of rules will be applied - $parameters = $containerConfigurator->parameters(); - // tip: use "SetList" class to autocomplete sets - $parameters->set(Option::SETS, [SetList::CODE_QUALITY]); + $containerConfigurator->import(SetList::CODE_QUALITY); // register single rule $services = $containerConfigurator->services(); diff --git a/build/config/config-downgrade-php70.php b/build/config/config-downgrade-php70.php index 5486a8856cb3..999e80f58cdd 100644 --- a/build/config/config-downgrade-php70.php +++ b/build/config/config-downgrade-php70.php @@ -16,13 +16,11 @@ $parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan-for-downgrade.neon'); - $parameters->set(Option::SETS, [ - DowngradeSetList::PHP_80, - DowngradeSetList::PHP_74, - DowngradeSetList::PHP_73, - DowngradeSetList::PHP_72, - DowngradeSetList::PHP_71, - ]); + $containerConfigurator->import(DowngradeSetList::PHP_80); + $containerConfigurator->import(DowngradeSetList::PHP_74); + $containerConfigurator->import(DowngradeSetList::PHP_73); + $containerConfigurator->import(DowngradeSetList::PHP_72); + $containerConfigurator->import(DowngradeSetList::PHP_71); }; /** diff --git a/build/config/config-downgrade.php b/build/config/config-downgrade.php index eca24203a8bc..50338800d554 100644 --- a/build/config/config-downgrade.php +++ b/build/config/config-downgrade.php @@ -25,12 +25,10 @@ $parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan-for-downgrade.neon'); - $parameters->set(Option::SETS, [ - DowngradeSetList::PHP_80, - DowngradeSetList::PHP_74, - DowngradeSetList::PHP_73, - DowngradeSetList::PHP_72, - ]); + $containerConfigurator->import(DowngradeSetList::PHP_80); + $containerConfigurator->import(DowngradeSetList::PHP_74); + $containerConfigurator->import(DowngradeSetList::PHP_73); + $containerConfigurator->import(DowngradeSetList::PHP_72); }; /** diff --git a/docs/init_command.md b/docs/init_command.md index 63e037a5e460..eb9bf1c3d980 100644 --- a/docs/init_command.md +++ b/docs/init_command.md @@ -17,8 +17,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura return static function (ContainerConfigurator $containerConfigurator): void { // here we can define, what sets of rules will be applied - $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::SETS, [SetList::CODE_QUALITY]); + $containerConfigurator->import(SetList::CODE_QUALITY); // register single rule $services = $containerConfigurator->services(); diff --git a/ecs.php b/ecs.php index 4481697f6511..cdb842441e90 100644 --- a/ecs.php +++ b/ecs.php @@ -52,7 +52,10 @@ __DIR__ . '/config/set', ]); - $parameters->set(Option::SETS, [SetList::PSR_12, SetList::SYMPLIFY, SetList::COMMON, SetList::CLEAN_CODE]); + $containerConfigurator->import(SetList::PSR_12); + $containerConfigurator->import(SetList::SYMPLIFY); + $containerConfigurator->import(SetList::COMMON); + $containerConfigurator->import(SetList::CLEAN_CODE); $parameters->set(Option::SKIP, [ '*/Source/*', diff --git a/packages/BetterPhpDocParser/PhpDocNodeVisitor/ParamPhpDocNodeVisitor.php b/packages/BetterPhpDocParser/PhpDocNodeVisitor/ParamPhpDocNodeVisitor.php index f5585272dbc7..f781146fd504 100644 --- a/packages/BetterPhpDocParser/PhpDocNodeVisitor/ParamPhpDocNodeVisitor.php +++ b/packages/BetterPhpDocParser/PhpDocNodeVisitor/ParamPhpDocNodeVisitor.php @@ -34,7 +34,10 @@ public function enterNode(Node $node): ?Node } $variadicAwareParamTagValueNode = new VariadicAwareParamTagValueNode( - $node->type, $node->isVariadic, $node->parameterName, $node->description + $node->type, + $node->isVariadic, + $node->parameterName, + $node->description ); $this->attributeMirrorer->mirror($node, $variadicAwareParamTagValueNode); diff --git a/packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php b/packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php index a721e7df5c23..c19233965d6c 100644 --- a/packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php +++ b/packages/BetterPhpDocParser/PhpDocParser/BetterPhpDocParser.php @@ -63,8 +63,8 @@ public function parse(TokenIterator $tokenIterator): PhpDocNode $children[] = $this->parseChildAndStoreItsPositions($tokenIterator); while ($tokenIterator->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL) && ! $tokenIterator->isCurrentTokenType( - Lexer::TOKEN_CLOSE_PHPDOC - )) { + Lexer::TOKEN_CLOSE_PHPDOC + )) { $children[] = $this->parseChildAndStoreItsPositions($tokenIterator); } } diff --git a/packages/Caching/Config/FileHashComputer.php b/packages/Caching/Config/FileHashComputer.php index 8bdd92c4a9bd..c6de54096d83 100644 --- a/packages/Caching/Config/FileHashComputer.php +++ b/packages/Caching/Config/FileHashComputer.php @@ -41,7 +41,8 @@ private function ensureIsPhp(SmartFileInfo $fileInfo): void throw new ShouldNotHappenException(sprintf( // getRealPath() cannot be used, as it breaks in phar - 'Provide only PHP file, ready for Symfony Dependency Injection. "%s" given', $fileInfo->getRelativeFilePath() + 'Provide only PHP file, ready for Symfony Dependency Injection. "%s" given', + $fileInfo->getRelativeFilePath() )); } diff --git a/packages/PostRector/Rector/NodeAddingPostRector.php b/packages/PostRector/Rector/NodeAddingPostRector.php index 078dc88fb217..7bd1b99e3297 100644 --- a/packages/PostRector/Rector/NodeAddingPostRector.php +++ b/packages/PostRector/Rector/NodeAddingPostRector.php @@ -65,9 +65,11 @@ public function leaveNode(Node $node) public function getRuleDefinition(): RuleDefinition { - return new RuleDefinition('Add nodes on weird positions', [ - new CodeSample( - <<<'CODE_SAMPLE' + return new RuleDefinition( + 'Add nodes on weird positions', + [ + new CodeSample( + <<<'CODE_SAMPLE' class SomeClass { public function run($value) @@ -76,8 +78,8 @@ public function run($value) } } CODE_SAMPLE - , - <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' class SomeClass { public function run($value) @@ -88,7 +90,7 @@ public function run($value) } } CODE_SAMPLE - ), ] + ), ] ); } } diff --git a/packages/PostRector/Rector/NodeRemovingPostRector.php b/packages/PostRector/Rector/NodeRemovingPostRector.php index 2b62e1303a41..8b7939f39e7e 100644 --- a/packages/PostRector/Rector/NodeRemovingPostRector.php +++ b/packages/PostRector/Rector/NodeRemovingPostRector.php @@ -109,8 +109,10 @@ public function leaveNode(Node $node) public function getRuleDefinition(): RuleDefinition { - return new RuleDefinition('Remove nodes from weird positions', [ - new CodeSample( + return new RuleDefinition( + 'Remove nodes from weird positions', + [ + new CodeSample( <<<'CODE_SAMPLE' class SomeClass { @@ -122,7 +124,7 @@ public function run($value) } } CODE_SAMPLE - , + , <<<'CODE_SAMPLE' class SomeClass { diff --git a/packages/PostRector/Rector/NodeToReplacePostRector.php b/packages/PostRector/Rector/NodeToReplacePostRector.php index 7278587eba90..8090ea0a84fa 100644 --- a/packages/PostRector/Rector/NodeToReplacePostRector.php +++ b/packages/PostRector/Rector/NodeToReplacePostRector.php @@ -39,8 +39,10 @@ public function leaveNode(Node $node): ?Node public function getRuleDefinition(): RuleDefinition { - return new RuleDefinition('Replaces nodes on weird positions', [ - new CodeSample( + return new RuleDefinition( + 'Replaces nodes on weird positions', + [ + new CodeSample( <<<'CODE_SAMPLE' class SomeClass { @@ -50,7 +52,7 @@ public function run($value) } } CODE_SAMPLE - , + , <<<'CODE_SAMPLE' class SomeClass { @@ -60,7 +62,7 @@ public function run($value) } } CODE_SAMPLE - ), ] + ), ] ); } } diff --git a/packages/PostRector/Rector/PropertyAddingPostRector.php b/packages/PostRector/Rector/PropertyAddingPostRector.php index d72b72209ba4..9c178d4d1ab7 100644 --- a/packages/PostRector/Rector/PropertyAddingPostRector.php +++ b/packages/PostRector/Rector/PropertyAddingPostRector.php @@ -80,8 +80,10 @@ public function enterNode(Node $node): ?Node public function getRuleDefinition(): RuleDefinition { - return new RuleDefinition('Add dependency properties', [ - new CodeSample( + return new RuleDefinition( + 'Add dependency properties', + [ + new CodeSample( <<<'CODE_SAMPLE' class SomeClass { @@ -91,7 +93,7 @@ public function run() } } CODE_SAMPLE - , + , <<<'CODE_SAMPLE' class SomeClass { diff --git a/packages/PostRector/Rector/UseAddingPostRector.php b/packages/PostRector/Rector/UseAddingPostRector.php index 863a961ff4a6..78d6b8903407 100644 --- a/packages/PostRector/Rector/UseAddingPostRector.php +++ b/packages/PostRector/Rector/UseAddingPostRector.php @@ -127,8 +127,10 @@ public function getPriority(): int public function getRuleDefinition(): RuleDefinition { - return new RuleDefinition('Add unique use imports collected during Rector run', [ - new CodeSample( + return new RuleDefinition( + 'Add unique use imports collected during Rector run', + [ + new CodeSample( <<<'CODE_SAMPLE' class SomeClass { @@ -137,7 +139,7 @@ public function run(AnotherClass $anotherClass) } } CODE_SAMPLE - , + , <<<'CODE_SAMPLE' use App\AnotherClass; diff --git a/rector.php b/rector.php index 85b39e77d6ae..0ae51d44f6c6 100644 --- a/rector.php +++ b/rector.php @@ -23,6 +23,22 @@ use Symplify\SymfonyPhpConfig\ValueObjectInliner; return static function (ContainerConfigurator $containerConfigurator): void { + // include sets + $containerConfigurator->import(SetList::CODING_STYLE); + $containerConfigurator->import(SetList::CODE_QUALITY); + $containerConfigurator->import(SetList::CODE_QUALITY_STRICT); + $containerConfigurator->import(SetList::DEAD_CODE); + $containerConfigurator->import(SetList::PRIVATIZATION); + $containerConfigurator->import(SetList::NAMING); + $containerConfigurator->import(SetList::TYPE_DECLARATION); + $containerConfigurator->import(SetList::PHP_71); + $containerConfigurator->import(SetList::PHP_72); + $containerConfigurator->import(SetList::PHP_73); + $containerConfigurator->import(SetList::EARLY_RETURN); + $containerConfigurator->import(SetList::TYPE_DECLARATION_STRICT); + $containerConfigurator->import(NetteSetList::NETTE_UTILS_CODE_QUALITY); + $containerConfigurator->import(PHPUnitSetList::PHPUNIT_CODE_QUALITY); + $services = $containerConfigurator->services(); $configuration = ValueObjectInliner::inline([ @@ -42,23 +58,6 @@ $parameters = $containerConfigurator->parameters(); - $parameters->set(Option::SETS, [ - SetList::CODING_STYLE, - SetList::CODE_QUALITY, - SetList::CODE_QUALITY_STRICT, - SetList::DEAD_CODE, - SetList::PRIVATIZATION, - SetList::NAMING, - SetList::TYPE_DECLARATION, - SetList::PHP_71, - SetList::PHP_72, - SetList::PHP_73, - SetList::EARLY_RETURN, - SetList::TYPE_DECLARATION_STRICT, - NetteSetList::NETTE_UTILS_CODE_QUALITY, - PHPUnitSetList::PHPUNIT_CODE_QUALITY, - ]); - $parameters->set(Option::PATHS, [ __DIR__ . '/src', __DIR__ . '/rules', diff --git a/rules-tests/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector/config/configured_rule.php b/rules-tests/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector/config/configured_rule.php index 2feb2213e411..e15f49ec9e76 100644 --- a/rules-tests/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector/config/configured_rule.php +++ b/rules-tests/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector/config/configured_rule.php @@ -9,10 +9,8 @@ $services = $containerConfigurator->services(); $services->set(SwapFuncCallArgumentsRector::class) ->call('configure', [[ - SwapFuncCallArgumentsRector::FUNCTION_ARGUMENT_SWAPS => ValueObjectInliner::inline([ - - new SwapFuncCallArguments('some_function', [1, 0]), - ] + SwapFuncCallArgumentsRector::FUNCTION_ARGUMENT_SWAPS => ValueObjectInliner::inline( + [new SwapFuncCallArguments('some_function', [1, 0])] ), ]]); }; diff --git a/rules-tests/Defluent/Rector/ClassMethod/NormalToFluentRector/config/configured_rule.php b/rules-tests/Defluent/Rector/ClassMethod/NormalToFluentRector/config/configured_rule.php index f01d62fa8d8b..29f1f4730708 100644 --- a/rules-tests/Defluent/Rector/ClassMethod/NormalToFluentRector/config/configured_rule.php +++ b/rules-tests/Defluent/Rector/ClassMethod/NormalToFluentRector/config/configured_rule.php @@ -10,10 +10,15 @@ $services = $containerConfigurator->services(); $services->set(NormalToFluentRector::class) ->call('configure', [[ - NormalToFluentRector::CALLS_TO_FLUENT => ValueObjectInliner::inline([ + NormalToFluentRector::CALLS_TO_FLUENT => ValueObjectInliner::inline( + [ - new NormalToFluent(FluentInterfaceClass::class, ['someFunction', 'otherFunction', 'joinThisAsWell']), - ] + new NormalToFluent(FluentInterfaceClass::class, [ + 'someFunction', + 'otherFunction', + 'joinThisAsWell', + ]), + ] ), ]]); }; diff --git a/rules-tests/Restoration/Rector/Namespace_/CompleteImportForPartialAnnotationRector/config/configured_rule.php b/rules-tests/Restoration/Rector/Namespace_/CompleteImportForPartialAnnotationRector/config/configured_rule.php index 6f46df54a36f..b29c6551472e 100644 --- a/rules-tests/Restoration/Rector/Namespace_/CompleteImportForPartialAnnotationRector/config/configured_rule.php +++ b/rules-tests/Restoration/Rector/Namespace_/CompleteImportForPartialAnnotationRector/config/configured_rule.php @@ -8,10 +8,12 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(CompleteImportForPartialAnnotationRector::class) - ->call('configure', [[ - CompleteImportForPartialAnnotationRector::USE_IMPORTS_TO_RESTORE => ValueObjectInliner::inline([ - new CompleteImportForPartialAnnotation('Doctrine\ORM\Mapping', 'ORM'), - ]), - ]] - ); + ->call( + 'configure', + [[ + CompleteImportForPartialAnnotationRector::USE_IMPORTS_TO_RESTORE => ValueObjectInliner::inline([ + new CompleteImportForPartialAnnotation('Doctrine\ORM\Mapping', 'ORM'), + ]), + ]] + ); }; diff --git a/rules-tests/Transform/Rector/Assign/PropertyFetchToMethodCallRector/config/configured_rule.php b/rules-tests/Transform/Rector/Assign/PropertyFetchToMethodCallRector/config/configured_rule.php index db94090c75e4..79e031c00cc5 100644 --- a/rules-tests/Transform/Rector/Assign/PropertyFetchToMethodCallRector/config/configured_rule.php +++ b/rules-tests/Transform/Rector/Assign/PropertyFetchToMethodCallRector/config/configured_rule.php @@ -10,16 +10,18 @@ $services = $containerConfigurator->services(); $services->set(PropertyFetchToMethodCallRector::class) ->call('configure', [[ - PropertyFetchToMethodCallRector::PROPERTIES_TO_METHOD_CALLS => ValueObjectInliner::inline([ + PropertyFetchToMethodCallRector::PROPERTIES_TO_METHOD_CALLS => ValueObjectInliner::inline( + [ - new PropertyFetchToMethodCall(Translator::class, 'locale', 'getLocale', 'setLocale'), - new PropertyFetchToMethodCall( - 'Rector\Tests\Transform\Rector\Assign\PropertyFetchToMethodCallRector\Fixture\Fixture2', - 'parameter', - 'getConfig', - null, - ['parameter']), - ] + new PropertyFetchToMethodCall(Translator::class, 'locale', 'getLocale', 'setLocale'), + new PropertyFetchToMethodCall( + 'Rector\Tests\Transform\Rector\Assign\PropertyFetchToMethodCallRector\Fixture\Fixture2', + 'parameter', + 'getConfig', + null, + ['parameter'] + ), + ] ), ]]); }; diff --git a/rules-tests/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector/config/configured_rule.php b/rules-tests/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector/config/configured_rule.php index 0a99e622aac2..c55c166ab03f 100644 --- a/rules-tests/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector/config/configured_rule.php +++ b/rules-tests/Transform/Rector/MethodCall/MethodCallToAnotherMethodCallWithArgumentsRector/config/configured_rule.php @@ -16,7 +16,8 @@ NetteServiceDefinition::class, 'setInject', 'addTag', - ['inject']), + ['inject'] + ), ]); $services->set(MethodCallToAnotherMethodCallWithArgumentsRector::class) diff --git a/rules-tests/Transform/Rector/MethodCall/ServiceGetterToConstructorInjectionRector/config/configured_rule.php b/rules-tests/Transform/Rector/MethodCall/ServiceGetterToConstructorInjectionRector/config/configured_rule.php index b1f0acb885ba..2525d9c3a05c 100644 --- a/rules-tests/Transform/Rector/MethodCall/ServiceGetterToConstructorInjectionRector/config/configured_rule.php +++ b/rules-tests/Transform/Rector/MethodCall/ServiceGetterToConstructorInjectionRector/config/configured_rule.php @@ -12,14 +12,16 @@ return static function (ContainerConfigurator $containerConfigurator): void { $services = $containerConfigurator->services(); $services->set(ServiceGetterToConstructorInjectionRector::class) - ->call('configure', [[ - ServiceGetterToConstructorInjectionRector::METHOD_CALL_TO_SERVICES => ValueObjectInliner::inline([ - new ServiceGetterToConstructorInjection( - FirstService::class, - 'getAnotherService', - AnotherService::class - ), - ]), - ]] - ); + ->call( + 'configure', + [[ + ServiceGetterToConstructorInjectionRector::METHOD_CALL_TO_SERVICES => ValueObjectInliner::inline([ + new ServiceGetterToConstructorInjection( + FirstService::class, + 'getAnotherService', + AnotherService::class + ), + ]), + ]] + ); }; diff --git a/rules-tests/Transform/Rector/MethodCall/VariableMethodCallToServiceCallRector/config/configured_rule.php b/rules-tests/Transform/Rector/MethodCall/VariableMethodCallToServiceCallRector/config/configured_rule.php index 178f847ae5d4..a932d5298de5 100644 --- a/rules-tests/Transform/Rector/MethodCall/VariableMethodCallToServiceCallRector/config/configured_rule.php +++ b/rules-tests/Transform/Rector/MethodCall/VariableMethodCallToServiceCallRector/config/configured_rule.php @@ -21,8 +21,10 @@ ]); $services->set(VariableMethodCallToServiceCallRector::class) - ->call('configure', [[ - VariableMethodCallToServiceCallRector::VARIABLE_METHOD_CALLS_TO_SERVICE_CALLS => $configuration, - ]] - ); + ->call( + 'configure', + [[ + VariableMethodCallToServiceCallRector::VARIABLE_METHOD_CALLS_TO_SERVICE_CALLS => $configuration, + ]] + ); }; diff --git a/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php b/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php index 0e936854ffa4..5a1b5ab34971 100644 --- a/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php +++ b/rules/Arguments/Rector/FuncCall/SwapFuncCallArgumentsRector.php @@ -51,7 +51,8 @@ public function run($one, $two) } } CODE_SAMPLE - , [ + , + [ self::FUNCTION_ARGUMENT_SWAPS => [new SwapFuncCallArguments('some_function', [1, 0])], ] ), diff --git a/rules/Arguments/Rector/MethodCall/ValueObjectWrapArgRector.php b/rules/Arguments/Rector/MethodCall/ValueObjectWrapArgRector.php index f40afecf381b..b51b37a3486f 100644 --- a/rules/Arguments/Rector/MethodCall/ValueObjectWrapArgRector.php +++ b/rules/Arguments/Rector/MethodCall/ValueObjectWrapArgRector.php @@ -59,10 +59,10 @@ public function run() } CODE_SAMPLE , - [ - self::VALUE_OBJECT_WRAP_ARGS => [new ValueObjectWrapArg('SomeClass', 'someMethod', 0, 'Number')], - ] - ), + [ + self::VALUE_OBJECT_WRAP_ARGS => [new ValueObjectWrapArg('SomeClass', 'someMethod', 0, 'Number')], + ] + ), ]); } diff --git a/rules/Autodiscovery/Rector/Class_/MoveEntitiesToEntityDirectoryRector.php b/rules/Autodiscovery/Rector/Class_/MoveEntitiesToEntityDirectoryRector.php index 6366a5b952bd..680f63e1b850 100644 --- a/rules/Autodiscovery/Rector/Class_/MoveEntitiesToEntityDirectoryRector.php +++ b/rules/Autodiscovery/Rector/Class_/MoveEntitiesToEntityDirectoryRector.php @@ -49,7 +49,7 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Move entities to Entity namespace', [ new CodeSample( - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' // file: app/Controller/Product.php namespace App\Controller; @@ -64,7 +64,7 @@ class Product } CODE_SAMPLE , - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' // file: app/Entity/Product.php namespace App\Entity; @@ -78,7 +78,7 @@ class Product { } CODE_SAMPLE - ), + ), ]); } diff --git a/rules/Autodiscovery/Rector/Class_/MoveServicesBySuffixToDirectoryRector.php b/rules/Autodiscovery/Rector/Class_/MoveServicesBySuffixToDirectoryRector.php index 8a38d6248faf..d3a616c84135 100644 --- a/rules/Autodiscovery/Rector/Class_/MoveServicesBySuffixToDirectoryRector.php +++ b/rules/Autodiscovery/Rector/Class_/MoveServicesBySuffixToDirectoryRector.php @@ -57,7 +57,7 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Move classes by their suffix to their own group/directory', [ new ConfiguredCodeSample( - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' // file: app/Entity/ProductRepository.php namespace App/Entity; @@ -67,7 +67,7 @@ class ProductRepository } CODE_SAMPLE , - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' // file: app/Repository/ProductRepository.php namespace App/Repository; @@ -77,10 +77,10 @@ class ProductRepository } CODE_SAMPLE , - [ - self::GROUP_NAMES_BY_SUFFIX => ['Repository'], - ] - ), + [ + self::GROUP_NAMES_BY_SUFFIX => ['Repository'], + ] + ), ]); } diff --git a/rules/Autodiscovery/Rector/Interface_/MoveInterfacesToContractNamespaceDirectoryRector.php b/rules/Autodiscovery/Rector/Interface_/MoveInterfacesToContractNamespaceDirectoryRector.php index f1e7f0635605..7672e2969768 100644 --- a/rules/Autodiscovery/Rector/Interface_/MoveInterfacesToContractNamespaceDirectoryRector.php +++ b/rules/Autodiscovery/Rector/Interface_/MoveInterfacesToContractNamespaceDirectoryRector.php @@ -42,7 +42,7 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Move interface to "Contract" namespace', [ new CodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' // file: app/Exception/Rule.php namespace App\Exception; @@ -52,7 +52,7 @@ interface Rule } CODE_SAMPLE , - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' // file: app/Contract/Rule.php namespace App\Contract; @@ -61,7 +61,7 @@ interface Rule { } CODE_SAMPLE - ), + ), ]); } diff --git a/rules/Carbon/Rector/MethodCall/ChangeCarbonSingularMethodCallToPluralRector.php b/rules/Carbon/Rector/MethodCall/ChangeCarbonSingularMethodCallToPluralRector.php index 08439fd7aa7c..6ee60fbf053b 100644 --- a/rules/Carbon/Rector/MethodCall/ChangeCarbonSingularMethodCallToPluralRector.php +++ b/rules/Carbon/Rector/MethodCall/ChangeCarbonSingularMethodCallToPluralRector.php @@ -68,9 +68,9 @@ public function run(Carbon $carbon, $value): void } } CODE_SAMPLE - - ), - ]); + ), + ] + ); } /** diff --git a/rules/Carbon/Rector/MethodCall/ChangeDiffForHumansArgsRector.php b/rules/Carbon/Rector/MethodCall/ChangeDiffForHumansArgsRector.php index efa428e4b3ea..45f285fb94bf 100644 --- a/rules/Carbon/Rector/MethodCall/ChangeDiffForHumansArgsRector.php +++ b/rules/Carbon/Rector/MethodCall/ChangeDiffForHumansArgsRector.php @@ -52,9 +52,9 @@ public function run(Carbon $carbon): void } } CODE_SAMPLE - - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php b/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php index 8f6ef9b5f25f..3015855e5a17 100644 --- a/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php +++ b/rules/CodeQuality/NodeManipulator/ExprBoolCaster.php @@ -41,7 +41,7 @@ final class ExprBoolCaster public function __construct( NodeTypeResolver $nodeTypeResolver, TypeUnwrapper $typeUnwrapper, - StaticTypeAnalyzer $staticTypeAnalyzer, + StaticTypeAnalyzer $staticTypeAnalyzer, NodeFactory $nodeFactory ) { $this->nodeTypeResolver = $nodeTypeResolver; diff --git a/rules/CodeQuality/Rector/Array_/ArrayThisCallToThisMethodCallRector.php b/rules/CodeQuality/Rector/Array_/ArrayThisCallToThisMethodCallRector.php index 212dee6ed1a7..89ee3bb938b9 100644 --- a/rules/CodeQuality/Rector/Array_/ArrayThisCallToThisMethodCallRector.php +++ b/rules/CodeQuality/Rector/Array_/ArrayThisCallToThisMethodCallRector.php @@ -81,8 +81,9 @@ public function giveMeMore() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php b/rules/CodeQuality/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php index d3f9e1932ec8..e5d0a3ecf798 100644 --- a/rules/CodeQuality/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php +++ b/rules/CodeQuality/Rector/Array_/CallableThisArrayToAnonymousFunctionRector.php @@ -90,8 +90,9 @@ private function compareSize($first, $second) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Assign/SplitListAssignToSeparateLineRector.php b/rules/CodeQuality/Rector/Assign/SplitListAssignToSeparateLineRector.php index 0f8d1f969128..1a7c861daa6e 100644 --- a/rules/CodeQuality/Rector/Assign/SplitListAssignToSeparateLineRector.php +++ b/rules/CodeQuality/Rector/Assign/SplitListAssignToSeparateLineRector.php @@ -47,8 +47,9 @@ public function run(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php b/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php index 55e502a087e6..543918b8f7cf 100644 --- a/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php +++ b/rules/CodeQuality/Rector/BooleanNot/SimplifyDeMorganBinaryRector.php @@ -45,8 +45,9 @@ public function getRuleDefinition(): RuleDefinition $b = 10; $result = $a <= 20 && $b > 50; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php b/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php index f322eb906863..3cebd0f2a022 100644 --- a/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php +++ b/rules/CodeQuality/Rector/Concat/JoinStringConcatRector.php @@ -54,8 +54,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php b/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php index 9ecc4b4434c8..3893183a8c38 100644 --- a/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php +++ b/rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php @@ -47,8 +47,9 @@ public function run(int $firstValue, int $secondValue) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php b/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php index d1d68ca5516a..642cf5c6d1d6 100644 --- a/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php +++ b/rules/CodeQuality/Rector/For_/ForRepeatedCountToOwnVariableRector.php @@ -60,8 +60,9 @@ public function run($items) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php b/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php index 4b4b83d5088c..8532f589e6bb 100644 --- a/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php +++ b/rules/CodeQuality/Rector/Foreach_/ForeachItemsAssignToEmptyArrayToAssignRector.php @@ -67,8 +67,9 @@ public function run($items) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToArrayFilterRector.php b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToArrayFilterRector.php index 78896b1cb2e3..79205527adab 100644 --- a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToArrayFilterRector.php +++ b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToArrayFilterRector.php @@ -44,8 +44,9 @@ public function getRuleDefinition(): RuleDefinition $possibleDirectories = []; $directories = array_filter($possibleDirectories, 'file_exists'); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php index b68e2d919cc8..e45a7624d07c 100644 --- a/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php +++ b/rules/CodeQuality/Rector/Foreach_/SimplifyForeachToCoalescingRector.php @@ -61,8 +61,9 @@ public function getRuleDefinition(): RuleDefinition <<<'CODE_SAMPLE' return $this->oldToNewFunctions[$currentFunction] ?? null; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php b/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php index b6ff3b9c0b12..22d561cf7096 100644 --- a/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php +++ b/rules/CodeQuality/Rector/Foreach_/UnusedForeachValueToArrayKeysRector.php @@ -50,8 +50,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/FuncCall/ArrayKeysAndInArrayToArrayKeyExistsRector.php b/rules/CodeQuality/Rector/FuncCall/ArrayKeysAndInArrayToArrayKeyExistsRector.php index 2516580b5148..b34663d399e7 100644 --- a/rules/CodeQuality/Rector/FuncCall/ArrayKeysAndInArrayToArrayKeyExistsRector.php +++ b/rules/CodeQuality/Rector/FuncCall/ArrayKeysAndInArrayToArrayKeyExistsRector.php @@ -44,8 +44,9 @@ public function run($packageName, $values) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php b/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php index 53b6cd6ea51e..a3216826052a 100644 --- a/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php +++ b/rules/CodeQuality/Rector/FuncCall/ArrayMergeOfNonArraysToSimpleArrayRector.php @@ -52,8 +52,9 @@ public function go() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php b/rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php index 5010484d4181..df64730a7670 100644 --- a/rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php +++ b/rules/CodeQuality/Rector/FuncCall/ChangeArrayPushToArrayAssignRector.php @@ -49,8 +49,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/FuncCall/IntvalToTypeCastRector.php b/rules/CodeQuality/Rector/FuncCall/IntvalToTypeCastRector.php index b8f66987de51..46c692b9a259 100644 --- a/rules/CodeQuality/Rector/FuncCall/IntvalToTypeCastRector.php +++ b/rules/CodeQuality/Rector/FuncCall/IntvalToTypeCastRector.php @@ -43,8 +43,9 @@ public function run($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/FuncCall/IsAWithStringWithThirdArgumentRector.php b/rules/CodeQuality/Rector/FuncCall/IsAWithStringWithThirdArgumentRector.php index b042e4965faf..cbb6c2f3c3cf 100644 --- a/rules/CodeQuality/Rector/FuncCall/IsAWithStringWithThirdArgumentRector.php +++ b/rules/CodeQuality/Rector/FuncCall/IsAWithStringWithThirdArgumentRector.php @@ -42,8 +42,9 @@ public function __construct(string $value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/FuncCall/SimplifyInArrayValuesRector.php b/rules/CodeQuality/Rector/FuncCall/SimplifyInArrayValuesRector.php index ea6808f2aad5..04360fc45306 100644 --- a/rules/CodeQuality/Rector/FuncCall/SimplifyInArrayValuesRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SimplifyInArrayValuesRector.php @@ -19,7 +19,8 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( 'Removes unneeded array_values() in in_array() call', - [new CodeSample('in_array("key", array_values($array), true);', 'in_array("key", $array, true);')]); + [new CodeSample('in_array("key", array_values($array), true);', 'in_array("key", $array, true);')] + ); } /** diff --git a/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php b/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php index 6b764a29f2e3..d4f1a682778b 100644 --- a/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php +++ b/rules/CodeQuality/Rector/FuncCall/SingleInArrayToCompareRector.php @@ -48,8 +48,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/FunctionLike/RemoveAlwaysTrueConditionSetInConstructorRector.php b/rules/CodeQuality/Rector/FunctionLike/RemoveAlwaysTrueConditionSetInConstructorRector.php index 85cf7e39eb74..11ae76a34512 100644 --- a/rules/CodeQuality/Rector/FunctionLike/RemoveAlwaysTrueConditionSetInConstructorRector.php +++ b/rules/CodeQuality/Rector/FunctionLike/RemoveAlwaysTrueConditionSetInConstructorRector.php @@ -90,8 +90,9 @@ public function go() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php b/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php index c9c77d32c63e..1ff79cfe83c9 100644 --- a/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php +++ b/rules/CodeQuality/Rector/Identical/FlipTypeControlToUseExclusiveTypeRector.php @@ -72,8 +72,9 @@ public function __construct(array $values) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php b/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php index 955a328cde8a..9d7c38318775 100644 --- a/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php +++ b/rules/CodeQuality/Rector/Identical/SimplifyBoolIdenticalTrueRector.php @@ -46,8 +46,9 @@ public function run(bool $value, string $items) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php b/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php index 2a78dd7828b4..44416170b9f5 100644 --- a/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php +++ b/rules/CodeQuality/Rector/Identical/StrlenZeroToIdenticalEmptyStringRector.php @@ -43,8 +43,9 @@ public function run($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php index f39160e93098..97c117b0d370 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfElseToTernaryRector.php @@ -54,8 +54,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php index 71f085ce63b4..09fccca7f897 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfNotNullReturnRector.php @@ -47,8 +47,9 @@ public function getRuleDefinition(): RuleDefinition $newNode = 'something ; return $newNode; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php b/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php index 7911283b8314..c6da7325187a 100644 --- a/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php +++ b/rules/CodeQuality/Rector/If_/SimplifyIfReturnBoolRector.php @@ -55,8 +55,9 @@ public function getRuleDefinition(): RuleDefinition CODE_SAMPLE , 'return strpos($docToken->getContent(), "\n") === false;' - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php b/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php index 06255bc6ea7d..f3aff4d44cc9 100644 --- a/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php +++ b/rules/CodeQuality/Rector/LogicalAnd/LogicalToBooleanRector.php @@ -37,8 +37,9 @@ public function getRuleDefinition(): RuleDefinition return $f; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Name/FixClassCaseSensitivityNameRector.php b/rules/CodeQuality/Rector/Name/FixClassCaseSensitivityNameRector.php index 665359425d1a..e3c7fe692141 100644 --- a/rules/CodeQuality/Rector/Name/FixClassCaseSensitivityNameRector.php +++ b/rules/CodeQuality/Rector/Name/FixClassCaseSensitivityNameRector.php @@ -67,8 +67,9 @@ final class AnotherClass { } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/New_/NewStaticToNewSelfRector.php b/rules/CodeQuality/Rector/New_/NewStaticToNewSelfRector.php index 852ae3f5b674..9e2205d75a29 100644 --- a/rules/CodeQuality/Rector/New_/NewStaticToNewSelfRector.php +++ b/rules/CodeQuality/Rector/New_/NewStaticToNewSelfRector.php @@ -44,7 +44,6 @@ public function build() } } CODE_SAMPLE - ), ]); } diff --git a/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php b/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php index 85c6833404a9..ff814402255c 100644 --- a/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php +++ b/rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php @@ -42,8 +42,9 @@ public function run($one, $two) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php b/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php index 5044e2440f3f..25e6395ed310 100644 --- a/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php +++ b/rules/CodeQuality/Rector/Ternary/ArrayKeyExistsTernaryThenValueToCoalescingRector.php @@ -45,8 +45,9 @@ public function run($values, $keyToMatch) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Ternary/SimplifyDuplicatedTernaryRector.php b/rules/CodeQuality/Rector/Ternary/SimplifyDuplicatedTernaryRector.php index 97fde8c2acaf..da2a574173d2 100644 --- a/rules/CodeQuality/Rector/Ternary/SimplifyDuplicatedTernaryRector.php +++ b/rules/CodeQuality/Rector/Ternary/SimplifyDuplicatedTernaryRector.php @@ -43,8 +43,9 @@ public function run(bool $value, string $name) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php b/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php index a4bb2ba22395..68c7de99ac21 100644 --- a/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php +++ b/rules/CodeQuality/Rector/Ternary/SwitchNegatedTernaryRector.php @@ -45,8 +45,9 @@ public function run(bool $upper, string $name) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector.php b/rules/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector.php index 42c61a76cf5b..138cf6682e87 100644 --- a/rules/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector.php +++ b/rules/CodeQualityStrict/Rector/Variable/MoveVariableDeclarationNearReferenceRector.php @@ -73,8 +73,9 @@ public function getRuleDefinition(): RuleDefinition return $var; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php b/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php index 7ae63e4c6b93..4106bf338a72 100644 --- a/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php +++ b/rules/CodingStyle/Rector/Assign/PHPStormVarAnnotationRector.php @@ -55,8 +55,9 @@ public function getRuleDefinition(): RuleDefinition /** @var \Shopsys\FrameworkBundle\Model\Product\Filter\ProductFilterConfig $config */ $config = 5; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php b/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php index db3fc3ced4b4..cde38b8c34fe 100644 --- a/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php +++ b/rules/CodingStyle/Rector/Catch_/CatchExceptionNameMatchingTypeRector.php @@ -56,8 +56,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/ClassConst/VarConstantCommentRector.php b/rules/CodingStyle/Rector/ClassConst/VarConstantCommentRector.php index bc53360c3918..ee2bf4216536 100644 --- a/rules/CodingStyle/Rector/ClassConst/VarConstantCommentRector.php +++ b/rules/CodingStyle/Rector/ClassConst/VarConstantCommentRector.php @@ -63,8 +63,9 @@ class SomeClass const HI = 'hi'; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php b/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php index 9aa7398dc4a5..73f3bedd62de 100644 --- a/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/FuncGetArgsToVariadicParamRector.php @@ -41,7 +41,6 @@ function run(...$args) { } CODE_SAMPLE - ), ]); } diff --git a/rules/CodingStyle/Rector/ClassMethod/RemoveDoubleUnderscoreInMethodNameRector.php b/rules/CodingStyle/Rector/ClassMethod/RemoveDoubleUnderscoreInMethodNameRector.php index acb9b049e2cd..f81058a04eb1 100644 --- a/rules/CodingStyle/Rector/ClassMethod/RemoveDoubleUnderscoreInMethodNameRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/RemoveDoubleUnderscoreInMethodNameRector.php @@ -51,8 +51,9 @@ public function getName($anotherObject) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php b/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php index 3f528445e0fc..c6bab94a2f5d 100644 --- a/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php +++ b/rules/CodingStyle/Rector/Class_/AddArrayDefaultToArrayPropertyRector.php @@ -82,8 +82,9 @@ public function isEmpty() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php index 43dda7a240d4..3792bacb2f5e 100644 --- a/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php +++ b/rules/CodingStyle/Rector/Encapsed/EncapsedStringsToSprintfRector.php @@ -62,8 +62,9 @@ public function run(string $format) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php b/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php index 4639033a8db8..c782a3924c6f 100644 --- a/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php +++ b/rules/CodingStyle/Rector/FuncCall/ConsistentImplodeRector.php @@ -61,8 +61,9 @@ public function run(array $items) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php b/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php index 23abd2412cea..adfd3521ca40 100644 --- a/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php +++ b/rules/CodingStyle/Rector/FuncCall/CountArrayToEmptyArrayComparisonRector.php @@ -45,8 +45,9 @@ public function getRuleDefinition(): RuleDefinition $array !== []; $array === []; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/FuncCall/PreslashSimpleFunctionRector.php b/rules/CodingStyle/Rector/FuncCall/PreslashSimpleFunctionRector.php index 043fe9ed9428..3c07de8c990e 100644 --- a/rules/CodingStyle/Rector/FuncCall/PreslashSimpleFunctionRector.php +++ b/rules/CodingStyle/Rector/FuncCall/PreslashSimpleFunctionRector.php @@ -44,8 +44,9 @@ public function shorten($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/FuncCall/StrictArraySearchRector.php b/rules/CodingStyle/Rector/FuncCall/StrictArraySearchRector.php index 3e7970913e37..8209ed407667 100644 --- a/rules/CodingStyle/Rector/FuncCall/StrictArraySearchRector.php +++ b/rules/CodingStyle/Rector/FuncCall/StrictArraySearchRector.php @@ -19,7 +19,8 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( 'Makes array_search search for identical elements', - [new CodeSample('array_search($value, $items);', 'array_search($value, $items, true);')]); + [new CodeSample('array_search($value, $items);', 'array_search($value, $items, true);')] + ); } /** diff --git a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php index f6f3aa2f6e01..b924eb6337e4 100644 --- a/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php +++ b/rules/CodingStyle/Rector/FuncCall/VersionCompareFuncCallToConstantRector.php @@ -80,8 +80,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/Include_/FollowRequireByDirRector.php b/rules/CodingStyle/Rector/Include_/FollowRequireByDirRector.php index 50878e6ad875..9909214479c3 100644 --- a/rules/CodingStyle/Rector/Include_/FollowRequireByDirRector.php +++ b/rules/CodingStyle/Rector/Include_/FollowRequireByDirRector.php @@ -44,8 +44,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/MethodCall/UseMessageVariableForSprintfInSymfonyStyleRector.php b/rules/CodingStyle/Rector/MethodCall/UseMessageVariableForSprintfInSymfonyStyleRector.php index 86965bc1a171..8ca3ca43fd36 100644 --- a/rules/CodingStyle/Rector/MethodCall/UseMessageVariableForSprintfInSymfonyStyleRector.php +++ b/rules/CodingStyle/Rector/MethodCall/UseMessageVariableForSprintfInSymfonyStyleRector.php @@ -49,7 +49,7 @@ public function run(SymfonyStyle $symfonyStyle) } } CODE_SAMPLE - ), + ), ] ); } diff --git a/rules/CodingStyle/Rector/Property/AddFalseDefaultToBoolPropertyRector.php b/rules/CodingStyle/Rector/Property/AddFalseDefaultToBoolPropertyRector.php index 152771a8bbd7..6be58af64db8 100644 --- a/rules/CodingStyle/Rector/Property/AddFalseDefaultToBoolPropertyRector.php +++ b/rules/CodingStyle/Rector/Property/AddFalseDefaultToBoolPropertyRector.php @@ -41,8 +41,9 @@ class SomeClass private $isDisabled = false; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/String_/SplitStringClassConstantToClassConstFetchRector.php b/rules/CodingStyle/Rector/String_/SplitStringClassConstantToClassConstFetchRector.php index 91128dfe451e..c5c3bb8e8ab8 100644 --- a/rules/CodingStyle/Rector/String_/SplitStringClassConstantToClassConstFetchRector.php +++ b/rules/CodingStyle/Rector/String_/SplitStringClassConstantToClassConstFetchRector.php @@ -64,8 +64,9 @@ public function get() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php b/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php index 92cd837e1d47..b60926499254 100644 --- a/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php +++ b/rules/CodingStyle/Rector/String_/SymplifyQuoteEscapeRector.php @@ -50,8 +50,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php b/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php index 6419956b8449..553f955fbb80 100644 --- a/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php +++ b/rules/CodingStyle/Rector/Ternary/TernaryConditionVariableAssignmentRector.php @@ -37,8 +37,9 @@ function ternary($value) $a = $value ? 1 : 0; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Composer/Rector/AddPackageToRequireComposerRector.php b/rules/Composer/Rector/AddPackageToRequireComposerRector.php index bf25efacfb2d..a17b1129ef96 100644 --- a/rules/Composer/Rector/AddPackageToRequireComposerRector.php +++ b/rules/Composer/Rector/AddPackageToRequireComposerRector.php @@ -58,7 +58,8 @@ public function getRuleDefinition(): RuleDefinition } } CODE_SAMPLE - , [ + , + [ self::PACKAGES_AND_VERSIONS => [new PackageAndVersion('symfony/console', '^3.4')], ] ), diff --git a/rules/Composer/Rector/AddPackageToRequireDevComposerRector.php b/rules/Composer/Rector/AddPackageToRequireDevComposerRector.php index 454440fec5f5..8816fba28773 100644 --- a/rules/Composer/Rector/AddPackageToRequireDevComposerRector.php +++ b/rules/Composer/Rector/AddPackageToRequireDevComposerRector.php @@ -61,7 +61,8 @@ public function getRuleDefinition(): RuleDefinition } } CODE_SAMPLE - , [ + , + [ self::PACKAGES_AND_VERSIONS => [new PackageAndVersion('symfony/console', '^3.4')], ] ), diff --git a/rules/Composer/Rector/ChangePackageVersionComposerRector.php b/rules/Composer/Rector/ChangePackageVersionComposerRector.php index 04672511a84d..5d39ec02eb65 100644 --- a/rules/Composer/Rector/ChangePackageVersionComposerRector.php +++ b/rules/Composer/Rector/ChangePackageVersionComposerRector.php @@ -64,7 +64,8 @@ public function getRuleDefinition(): RuleDefinition } } CODE_SAMPLE - , [ + , + [ self::PACKAGES_AND_VERSIONS => [new PackageAndVersion('symfony/console', '^4.4')], ] ), diff --git a/rules/Composer/Rector/RemovePackageComposerRector.php b/rules/Composer/Rector/RemovePackageComposerRector.php index ef247f3466a5..3cd0d639217c 100644 --- a/rules/Composer/Rector/RemovePackageComposerRector.php +++ b/rules/Composer/Rector/RemovePackageComposerRector.php @@ -46,7 +46,8 @@ public function getRuleDefinition(): RuleDefinition { } CODE_SAMPLE - , [ + , + [ self::PACKAGE_NAMES => ['symfony/console'], ] ), diff --git a/rules/Composer/Rector/ReplacePackageAndVersionComposerRector.php b/rules/Composer/Rector/ReplacePackageAndVersionComposerRector.php index 3ca9b3703091..8cbe4b479f17 100644 --- a/rules/Composer/Rector/ReplacePackageAndVersionComposerRector.php +++ b/rules/Composer/Rector/ReplacePackageAndVersionComposerRector.php @@ -65,7 +65,8 @@ public function getRuleDefinition(): RuleDefinition } } CODE_SAMPLE - , [ + , + [ self::REPLACE_PACKAGES_AND_VERSIONS => [new ReplacePackageAndVersion( 'symfony/console', 'symfony/http-kernel', diff --git a/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php b/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php index 443daa332419..c5e7f6b7cc97 100644 --- a/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php +++ b/rules/DeadCode/PhpDoc/DeadReturnTagValueNodeAnalyzer.php @@ -28,7 +28,9 @@ public function isDead(ReturnTagValueNode $returnTagValueNode, FunctionLike $fun return false; } - if (! $this->typeComparator->arePhpParserAndPhpStanPhpDocTypesEqual($returnType, $returnTagValueNode->type, + if (! $this->typeComparator->arePhpParserAndPhpStanPhpDocTypesEqual( + $returnType, + $returnTagValueNode->type, $functionLike )) { return false; diff --git a/rules/DeadCode/Rector/Assign/RemoveAssignOfVoidReturnFunctionRector.php b/rules/DeadCode/Rector/Assign/RemoveAssignOfVoidReturnFunctionRector.php index f8afc65259bb..bd0ee73cbdf4 100644 --- a/rules/DeadCode/Rector/Assign/RemoveAssignOfVoidReturnFunctionRector.php +++ b/rules/DeadCode/Rector/Assign/RemoveAssignOfVoidReturnFunctionRector.php @@ -52,8 +52,9 @@ private function getOne(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveDelegatingParentCallRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveDelegatingParentCallRector.php index 66d60aa64c0e..955cca0b8f54 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveDelegatingParentCallRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveDelegatingParentCallRector.php @@ -53,8 +53,9 @@ class SomeClass { } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php index aa0c275be44a..5d1884a79f34 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveEmptyClassMethodRector.php @@ -57,8 +57,9 @@ class OrphanClass { } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php index f70679e5b5df..f65d7effa4fb 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedConstructorParamRector.php @@ -57,7 +57,6 @@ public function __construct($hey) } } CODE_SAMPLE - ), ]); } diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php index dc44e0db1384..666a97c3a8a5 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUnusedPrivateMethodParameterRector.php @@ -71,8 +71,9 @@ private function run($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php index 438a1502e232..54de5d5bc8d9 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUselessParamTagRector.php @@ -66,8 +66,9 @@ public function foo(string $a, string $b) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php index b9b855f66527..fa22a5dc51dd 100644 --- a/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php +++ b/rules/DeadCode/Rector/ClassMethod/RemoveUselessReturnTagRector.php @@ -57,8 +57,9 @@ public function foo(): stdClass } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php b/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php index ab041f5baab5..028ae14473cd 100644 --- a/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php +++ b/rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php @@ -42,8 +42,9 @@ public function run($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php b/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php index a1010ad2a3a4..9cbdbc4ed164 100644 --- a/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php +++ b/rules/DeadCode/Rector/For_/RemoveDeadIfForeachForRector.php @@ -59,8 +59,9 @@ public function run($someObject) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php b/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php index 20eb179cdd5c..e1c7f7642901 100644 --- a/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php +++ b/rules/DeadCode/Rector/For_/RemoveDeadLoopRector.php @@ -43,8 +43,9 @@ public function run($values) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php b/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php index 2c081635a36f..1b09f6a734de 100644 --- a/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php +++ b/rules/DeadCode/Rector/FunctionLike/RemoveDeadReturnRector.php @@ -53,8 +53,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/FunctionLike/RemoveDuplicatedIfReturnRector.php b/rules/DeadCode/Rector/FunctionLike/RemoveDuplicatedIfReturnRector.php index f1fcf4cb354b..421cb0dbfd8f 100644 --- a/rules/DeadCode/Rector/FunctionLike/RemoveDuplicatedIfReturnRector.php +++ b/rules/DeadCode/Rector/FunctionLike/RemoveDuplicatedIfReturnRector.php @@ -82,8 +82,9 @@ public function run($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/FunctionLike/RemoveOverriddenValuesRector.php b/rules/DeadCode/Rector/FunctionLike/RemoveOverriddenValuesRector.php index 735395477884..e7caea737d8a 100644 --- a/rules/DeadCode/Rector/FunctionLike/RemoveOverriddenValuesRector.php +++ b/rules/DeadCode/Rector/FunctionLike/RemoveOverriddenValuesRector.php @@ -75,8 +75,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php index 3905293058b4..24d15dfe57af 100644 --- a/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php +++ b/rules/DeadCode/Rector/If_/RemoveUnusedNonEmptyArrayBeforeForeachRector.php @@ -77,8 +77,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfFunctionExistsRector.php b/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfFunctionExistsRector.php index e3af7fafd081..76dace95947e 100644 --- a/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfFunctionExistsRector.php +++ b/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfFunctionExistsRector.php @@ -68,8 +68,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php b/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php index 34dbfa686506..48bc4d8e8485 100644 --- a/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php +++ b/rules/DeadCode/Rector/If_/UnwrapFutureCompatibleIfPhpVersionRector.php @@ -55,8 +55,9 @@ public function getRuleDefinition(): RuleDefinition // current PHP: 7.2 return 'is PHP 7.2+'; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php b/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php index be30f9e425f2..5711bd55b5f3 100644 --- a/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php +++ b/rules/DeadCode/Rector/Node/RemoveNonExistingVarAnnotationRector.php @@ -93,8 +93,9 @@ public function get() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php b/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php index ca1e3ea9716f..c7376f68017e 100644 --- a/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php +++ b/rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php @@ -55,8 +55,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/Property/RemoveSetterOnlyPropertyAndMethodCallRector.php b/rules/DeadCode/Rector/Property/RemoveSetterOnlyPropertyAndMethodCallRector.php index c9e9059c6c80..016397c9d52d 100644 --- a/rules/DeadCode/Rector/Property/RemoveSetterOnlyPropertyAndMethodCallRector.php +++ b/rules/DeadCode/Rector/Property/RemoveSetterOnlyPropertyAndMethodCallRector.php @@ -100,8 +100,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php b/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php index dd786238eb63..cdecf1970bd9 100644 --- a/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php +++ b/rules/DeadCode/Rector/Property/RemoveUselessVarTagRector.php @@ -48,7 +48,6 @@ final class SomeClass public string $name = 'name'; } CODE_SAMPLE - ), ]); } diff --git a/rules/DeadCode/Rector/PropertyProperty/RemoveNullPropertyInitializationRector.php b/rules/DeadCode/Rector/PropertyProperty/RemoveNullPropertyInitializationRector.php index 5af4091b1ab7..28375cf83389 100644 --- a/rules/DeadCode/Rector/PropertyProperty/RemoveNullPropertyInitializationRector.php +++ b/rules/DeadCode/Rector/PropertyProperty/RemoveNullPropertyInitializationRector.php @@ -39,8 +39,9 @@ class SunshineCommand extends ParentClassWithNewConstructor private $myVar; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php b/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php index 641270b19723..69bd2a1d6a0e 100644 --- a/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php +++ b/rules/DeadCode/Rector/StaticCall/RemoveParentCallWithoutParentRector.php @@ -71,8 +71,9 @@ public function __construct() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php b/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php index c46b543915da..4bba06ab13e5 100644 --- a/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php +++ b/rules/DeadCode/Rector/Switch_/RemoveDuplicatedCaseInSwitchRector.php @@ -60,8 +60,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Defluent/Rector/ClassMethod/ReturnThisRemoveRector.php b/rules/Defluent/Rector/ClassMethod/ReturnThisRemoveRector.php index 490f17991034..8837195b75cb 100644 --- a/rules/Defluent/Rector/ClassMethod/ReturnThisRemoveRector.php +++ b/rules/Defluent/Rector/ClassMethod/ReturnThisRemoveRector.php @@ -39,7 +39,7 @@ public function getRuleDefinition(): RuleDefinition 'Removes "return $this;" from *fluent interfaces* for specified classes.', [ new CodeSample( - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class SomeExampleClass { public function someFunction() @@ -66,8 +66,9 @@ public function otherFunction() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Defluent/Rector/MethodCall/FluentChainMethodCallToNormalMethodCallRector.php b/rules/Defluent/Rector/MethodCall/FluentChainMethodCallToNormalMethodCallRector.php index a681f0bee270..360f71d9b901 100644 --- a/rules/Defluent/Rector/MethodCall/FluentChainMethodCallToNormalMethodCallRector.php +++ b/rules/Defluent/Rector/MethodCall/FluentChainMethodCallToNormalMethodCallRector.php @@ -68,8 +68,9 @@ public function getRuleDefinition(): RuleDefinition $someClass->someFunction(); $someClass->otherFunction(); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Defluent/Rector/MethodCall/InArgFluentChainMethodCallToStandaloneMethodCallRector.php b/rules/Defluent/Rector/MethodCall/InArgFluentChainMethodCallToStandaloneMethodCallRector.php index 9f8283b5cf50..a34070f772f2 100644 --- a/rules/Defluent/Rector/MethodCall/InArgFluentChainMethodCallToStandaloneMethodCallRector.php +++ b/rules/Defluent/Rector/MethodCall/InArgFluentChainMethodCallToStandaloneMethodCallRector.php @@ -77,7 +77,8 @@ public function getRuleDefinition(): RuleDefinition return new RuleDefinition( 'Turns fluent interface calls to classic ones.', [ - new CodeSample(<<<'CODE_SAMPLE' + new CodeSample( + <<<'CODE_SAMPLE' class UsedAsParameter { public function someFunction(FluentClass $someClass) @@ -91,7 +92,8 @@ public function processFluentClass(FluentClass $someClass) } CODE_SAMPLE - , <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' class UsedAsParameter { public function someFunction(FluentClass $someClass) @@ -106,9 +108,10 @@ public function processFluentClass(FluentClass $someClass) } } CODE_SAMPLE - ), + ), - ]); + ] + ); } /** @@ -145,7 +148,8 @@ public function refactor(Node $node): ?Node } $assignAndRootExprAndNodesToAdd = $this->assignAndRootExprAndNodesToAddMatcher->match( - $node, FluentCallsKind::IN_ARGS + $node, + FluentCallsKind::IN_ARGS ); if (! $assignAndRootExprAndNodesToAdd instanceof AssignAndRootExprAndNodesToAdd) { diff --git a/rules/Defluent/Rector/MethodCall/MethodCallOnSetterMethodCallToStandaloneAssignRector.php b/rules/Defluent/Rector/MethodCall/MethodCallOnSetterMethodCallToStandaloneAssignRector.php index b6f9331b4a50..76fb71e28bf9 100644 --- a/rules/Defluent/Rector/MethodCall/MethodCallOnSetterMethodCallToStandaloneAssignRector.php +++ b/rules/Defluent/Rector/MethodCall/MethodCallOnSetterMethodCallToStandaloneAssignRector.php @@ -98,8 +98,9 @@ public function anotherMethod(AnotherClass $anotherClass) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Defluent/Rector/MethodCall/NewFluentChainMethodCallToNonFluentRector.php b/rules/Defluent/Rector/MethodCall/NewFluentChainMethodCallToNonFluentRector.php index b37940a879fc..aa7b85590cdd 100644 --- a/rules/Defluent/Rector/MethodCall/NewFluentChainMethodCallToNonFluentRector.php +++ b/rules/Defluent/Rector/MethodCall/NewFluentChainMethodCallToNonFluentRector.php @@ -75,8 +75,9 @@ public function getRuleDefinition(): RuleDefinition $someClass->someFunction(); $someClass->otherFunction(); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Defluent/Rector/Return_/ReturnNewFluentChainMethodCallToNonFluentRector.php b/rules/Defluent/Rector/Return_/ReturnNewFluentChainMethodCallToNonFluentRector.php index a8710acf6f88..3e9b7ba104a4 100644 --- a/rules/Defluent/Rector/Return_/ReturnNewFluentChainMethodCallToNonFluentRector.php +++ b/rules/Defluent/Rector/Return_/ReturnNewFluentChainMethodCallToNonFluentRector.php @@ -67,8 +67,9 @@ public function getRuleDefinition(): RuleDefinition $someClass->otherFunction(); return $someClass; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DependencyInjection/Rector/ClassMethod/AddMethodParentCallRector.php b/rules/DependencyInjection/Rector/ClassMethod/AddMethodParentCallRector.php index 8a9c37d7c792..f07c5ec26bab 100644 --- a/rules/DependencyInjection/Rector/ClassMethod/AddMethodParentCallRector.php +++ b/rules/DependencyInjection/Rector/ClassMethod/AddMethodParentCallRector.php @@ -59,7 +59,8 @@ public function __construct() } } CODE_SAMPLE - , [ + , + [ self::METHODS_BY_PARENT_TYPES => [ 'ParentClassWithNewConstructor' => MethodName::CONSTRUCT, ], diff --git a/rules/DowngradePhp71/Rector/Array_/SymmetricArrayDestructuringToListRector.php b/rules/DowngradePhp71/Rector/Array_/SymmetricArrayDestructuringToListRector.php index a63d9838b96c..368572f322a7 100644 --- a/rules/DowngradePhp71/Rector/Array_/SymmetricArrayDestructuringToListRector.php +++ b/rules/DowngradePhp71/Rector/Array_/SymmetricArrayDestructuringToListRector.php @@ -26,11 +26,11 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Downgrade Symmetric array destructuring to list() function', [ new CodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' [$id1, $name1] = $data; CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' list($id1, $name1) = $data; CODE_SAMPLE ), diff --git a/rules/DowngradePhp71/Rector/TryCatch/DowngradePipeToMultiCatchExceptionRector.php b/rules/DowngradePhp71/Rector/TryCatch/DowngradePipeToMultiCatchExceptionRector.php index 37fd9efc8981..cd6638cece07 100644 --- a/rules/DowngradePhp71/Rector/TryCatch/DowngradePipeToMultiCatchExceptionRector.php +++ b/rules/DowngradePhp71/Rector/TryCatch/DowngradePipeToMultiCatchExceptionRector.php @@ -30,7 +30,7 @@ public function getRuleDefinition(): RuleDefinition } CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' try { // Some code... } catch (ExceptionType1 $exception) { diff --git a/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php b/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php index b91f8219e7b7..631dc9b3f1d7 100644 --- a/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php +++ b/rules/DowngradePhp73/Rector/FuncCall/DowngradeTrailingCommasInFunctionCallsRector.php @@ -32,7 +32,8 @@ public function __construct(FollowedByCommaAnalyzer $followedByCommaAnalyzer) public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( - 'Remove trailing commas in function calls', [ + 'Remove trailing commas in function calls', + [ new CodeSample( <<<'CODE_SAMPLE' class SomeClass @@ -46,7 +47,8 @@ public function __construct(string $value) } } CODE_SAMPLE - , <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' class SomeClass { public function __construct(string $value) diff --git a/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php b/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php index a2cad9181380..899dcd01d1b1 100644 --- a/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php +++ b/rules/DowngradePhp73/Rector/String_/DowngradeFlexibleHeredocSyntaxRector.php @@ -43,8 +43,9 @@ public function getRuleDefinition(): RuleDefinition WHERE `column` = true; SQL; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php b/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php index f6ed11549ac5..c69757ff7daf 100644 --- a/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php +++ b/rules/DowngradePhp74/Rector/Array_/DowngradeArraySpreadRector.php @@ -81,8 +81,9 @@ public function runWithIterable() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php b/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php index 6ed2f7122527..32c3c4985d3e 100644 --- a/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php +++ b/rules/DowngradePhp74/Rector/ArrowFunction/ArrowFunctionToAnonymousFunctionRector.php @@ -44,7 +44,7 @@ public function run() } CODE_SAMPLE , - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class SomeClass { public function run() diff --git a/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php b/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php index ce05cf5fbfeb..ecaa6672adfe 100644 --- a/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php +++ b/rules/DowngradePhp74/Rector/FuncCall/DowngradeArrayMergeCallWithoutArgumentsRector.php @@ -44,8 +44,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php b/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php index 1aaba78e3785..955547515324 100644 --- a/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php +++ b/rules/DowngradePhp74/Rector/FuncCall/DowngradeStripTagsCallWithArrayRector.php @@ -83,8 +83,9 @@ public function run($string) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php b/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php index 86970aeb072f..2d9e42d060cd 100644 --- a/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php +++ b/rules/DowngradePhp74/Rector/Identical/DowngradeFreadFwriteFalsyToNegationRector.php @@ -38,8 +38,9 @@ public function getRuleDefinition(): RuleDefinition !fread($handle, $length); !fwrite($fp, '1'); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php b/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php index 702c39d1f02f..fa3268b1b4ef 100644 --- a/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php +++ b/rules/DowngradePhp74/Rector/LNumber/DowngradeNumericLiteralSeparatorRector.php @@ -37,7 +37,7 @@ public function run() } CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class SomeClass { public function run() @@ -47,8 +47,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php b/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php index b60cde275139..c0cdb1e40736 100644 --- a/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php +++ b/rules/DowngradePhp80/Rector/Catch_/DowngradeNonCapturingCatchesRector.php @@ -50,7 +50,6 @@ public function run() } } CODE_SAMPLE - ), ]); } diff --git a/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php b/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php index 25990a5c27d3..d75d3941493c 100644 --- a/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php +++ b/rules/DowngradePhp80/Rector/ClassConstFetch/DowngradeClassOnObjectToGetClassRector.php @@ -44,7 +44,6 @@ public function run($object) } } CODE_SAMPLE - ), ]); } diff --git a/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php b/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php index 9c27349ff174..364458751ff9 100644 --- a/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php +++ b/rules/DowngradePhp80/Rector/ClassMethod/DowngradeTrailingCommasInParamUseRector.php @@ -39,7 +39,8 @@ public function __construct(FollowedByCommaAnalyzer $followedByCommaAnalyzer) public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( - 'Remove trailing commas in param or use list', [ + 'Remove trailing commas in param or use list', + [ new CodeSample( <<<'CODE_SAMPLE' class SomeClass @@ -58,7 +59,8 @@ function inFunction(string $value1, string $value2,) { } CODE_SAMPLE - , <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' class SomeClass { public function __construct(string $value1, string $value2) diff --git a/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php b/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php index 93db3a514dcd..50886e7ebbf9 100644 --- a/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php +++ b/rules/DowngradePhp80/Rector/Class_/DowngradePropertyPromotionRector.php @@ -58,7 +58,6 @@ public function __construct(float $value = 0.0) } } CODE_SAMPLE - ), ]); } diff --git a/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php b/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php index 8359a06c9df4..1625b6952af5 100644 --- a/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php +++ b/rules/DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector.php @@ -65,7 +65,6 @@ public function run() } } CODE_SAMPLE - ), ]); } diff --git a/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php b/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php index 28bdbd4b497a..f921e407e779 100644 --- a/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php +++ b/rules/EarlyReturn/Rector/If_/RemoveAlwaysElseRector.php @@ -54,8 +54,9 @@ public function run($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Generics/Filter/UnnededMethodTagValueNodeFilter.php b/rules/Generics/Filter/UnnededMethodTagValueNodeFilter.php index ca40fd524ec0..5a0c1e70334a 100644 --- a/rules/Generics/Filter/UnnededMethodTagValueNodeFilter.php +++ b/rules/Generics/Filter/UnnededMethodTagValueNodeFilter.php @@ -72,7 +72,8 @@ private function filterOutExistingMethodTagValuesNodes( * @return MethodTagValueNode[] */ private function filterOutImplementedClassMethods( - array $methodTagValueNodes, ClassReflection $classReflection, + array $methodTagValueNodes, + ClassReflection $classReflection, Scope $scope ): array { $filteredMethodTagValueNodes = []; diff --git a/rules/Generics/Rector/Class_/GenericsPHPStormMethodAnnotationRector.php b/rules/Generics/Rector/Class_/GenericsPHPStormMethodAnnotationRector.php index 27441b678e58..37c4163b29da 100644 --- a/rules/Generics/Rector/Class_/GenericsPHPStormMethodAnnotationRector.php +++ b/rules/Generics/Rector/Class_/GenericsPHPStormMethodAnnotationRector.php @@ -110,7 +110,8 @@ final class AndroidDeviceRepository extends AbstractRepository } CODE_SAMPLE ), - ]); + ] + ); } /** diff --git a/rules/LeagueEvent/Rector/MethodCall/DispatchStringToObjectRector.php b/rules/LeagueEvent/Rector/MethodCall/DispatchStringToObjectRector.php index 12b8fbb9105b..626b075c9417 100644 --- a/rules/LeagueEvent/Rector/MethodCall/DispatchStringToObjectRector.php +++ b/rules/LeagueEvent/Rector/MethodCall/DispatchStringToObjectRector.php @@ -78,7 +78,8 @@ public function eventName(): string CODE_SAMPLE ), - ]); + ] + ); } /** diff --git a/rules/MysqlToMysqli/Rector/FuncCall/MysqlPConnectToMysqliConnectRector.php b/rules/MysqlToMysqli/Rector/FuncCall/MysqlPConnectToMysqliConnectRector.php index a4bced872459..c2963edc4a59 100644 --- a/rules/MysqlToMysqli/Rector/FuncCall/MysqlPConnectToMysqliConnectRector.php +++ b/rules/MysqlToMysqli/Rector/FuncCall/MysqlPConnectToMysqliConnectRector.php @@ -45,8 +45,9 @@ public function run($host, $username, $password) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/MysqlToMysqli/Rector/FuncCall/MysqlQueryMysqlErrorWithLinkRector.php b/rules/MysqlToMysqli/Rector/FuncCall/MysqlQueryMysqlErrorWithLinkRector.php index 4e910dc144b0..104e01cd5f79 100644 --- a/rules/MysqlToMysqli/Rector/FuncCall/MysqlQueryMysqlErrorWithLinkRector.php +++ b/rules/MysqlToMysqli/Rector/FuncCall/MysqlQueryMysqlErrorWithLinkRector.php @@ -108,8 +108,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Naming/Rector/ClassMethod/MakeGetterClassMethodNameStartWithGetRector.php b/rules/Naming/Rector/ClassMethod/MakeGetterClassMethodNameStartWithGetRector.php index 5b67b9139fd5..7a2df74bb8f9 100644 --- a/rules/Naming/Rector/ClassMethod/MakeGetterClassMethodNameStartWithGetRector.php +++ b/rules/Naming/Rector/ClassMethod/MakeGetterClassMethodNameStartWithGetRector.php @@ -79,9 +79,9 @@ public function getName(): string } } CODE_SAMPLE - - ), - ]); + ), + ] + ); } /** diff --git a/rules/Naming/Rector/ClassMethod/MakeIsserClassMethodNameStartWithIsRector.php b/rules/Naming/Rector/ClassMethod/MakeIsserClassMethodNameStartWithIsRector.php index f77ba0043a37..f8670be17652 100644 --- a/rules/Naming/Rector/ClassMethod/MakeIsserClassMethodNameStartWithIsRector.php +++ b/rules/Naming/Rector/ClassMethod/MakeIsserClassMethodNameStartWithIsRector.php @@ -80,9 +80,9 @@ public function isActive() } } CODE_SAMPLE - - ), - ]); + ), + ] + ); } /** diff --git a/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php b/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php index 43c289b7620e..1bde93784134 100644 --- a/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php +++ b/rules/Naming/Rector/Class_/RenamePropertyToMatchTypeRector.php @@ -106,8 +106,9 @@ public function __construct(EntityManager $entityManager) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php index fd83bffec1cc..023063a99c4c 100644 --- a/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php +++ b/rules/Naming/Rector/Foreach_/RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php @@ -92,9 +92,9 @@ public function run() } } CODE_SAMPLE - - ), - ]); + ), + ] + ); } /** diff --git a/rules/Order/Rector/Class_/OrderClassConstantsByIntegerValueRector.php b/rules/Order/Rector/Class_/OrderClassConstantsByIntegerValueRector.php index 99b73c55839d..56ede2ea49ec 100644 --- a/rules/Order/Rector/Class_/OrderClassConstantsByIntegerValueRector.php +++ b/rules/Order/Rector/Class_/OrderClassConstantsByIntegerValueRector.php @@ -62,8 +62,9 @@ class SomeClass const MODE_OFF = 2; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Order/Rector/Class_/OrderConstantsByVisibilityRector.php b/rules/Order/Rector/Class_/OrderConstantsByVisibilityRector.php index 9533c5b76bad..9df29d0b6751 100644 --- a/rules/Order/Rector/Class_/OrderConstantsByVisibilityRector.php +++ b/rules/Order/Rector/Class_/OrderConstantsByVisibilityRector.php @@ -66,7 +66,6 @@ final class SomeClass private const PRIVATE_CONST = 'private'; } CODE_SAMPLE - ), ]); } diff --git a/rules/Order/Rector/Class_/OrderFirstLevelClassStatementsRector.php b/rules/Order/Rector/Class_/OrderFirstLevelClassStatementsRector.php index bc06a09213b7..2dcfb73de88b 100644 --- a/rules/Order/Rector/Class_/OrderFirstLevelClassStatementsRector.php +++ b/rules/Order/Rector/Class_/OrderFirstLevelClassStatementsRector.php @@ -53,7 +53,6 @@ final class SomeClass public function functionName(); } CODE_SAMPLE - ), ]); } diff --git a/rules/Order/Rector/Class_/OrderMethodsByVisibilityRector.php b/rules/Order/Rector/Class_/OrderMethodsByVisibilityRector.php index 885933a033c0..80fecce7dc51 100644 --- a/rules/Order/Rector/Class_/OrderMethodsByVisibilityRector.php +++ b/rules/Order/Rector/Class_/OrderMethodsByVisibilityRector.php @@ -95,7 +95,6 @@ protected function protectedFunctionName(); private function privateFunctionName(); } CODE_SAMPLE - ), ]); } diff --git a/rules/Order/Rector/Class_/OrderPrivateMethodsByUseRector.php b/rules/Order/Rector/Class_/OrderPrivateMethodsByUseRector.php index 4d12e580679c..c5442ab7955e 100644 --- a/rules/Order/Rector/Class_/OrderPrivateMethodsByUseRector.php +++ b/rules/Order/Rector/Class_/OrderPrivateMethodsByUseRector.php @@ -80,8 +80,9 @@ private function call2() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Order/Rector/Class_/OrderPropertiesByVisibilityRector.php b/rules/Order/Rector/Class_/OrderPropertiesByVisibilityRector.php index dfe532ca625b..5ac7c66b2616 100644 --- a/rules/Order/Rector/Class_/OrderPropertiesByVisibilityRector.php +++ b/rules/Order/Rector/Class_/OrderPropertiesByVisibilityRector.php @@ -67,7 +67,6 @@ final class SomeClass private $privateProperty; } CODE_SAMPLE - ), ]); } diff --git a/rules/PHPOffice/Rector/MethodCall/ChangeConditionalGetConditionRector.php b/rules/PHPOffice/Rector/MethodCall/ChangeConditionalGetConditionRector.php index e5ae14ffc2ae..2b1c6e6a14ec 100644 --- a/rules/PHPOffice/Rector/MethodCall/ChangeConditionalGetConditionRector.php +++ b/rules/PHPOffice/Rector/MethodCall/ChangeConditionalGetConditionRector.php @@ -50,8 +50,9 @@ public function run(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/PHPOffice/Rector/MethodCall/ChangeConditionalSetConditionRector.php b/rules/PHPOffice/Rector/MethodCall/ChangeConditionalSetConditionRector.php index 6f1f26a9fe71..aa1e716b1d77 100644 --- a/rules/PHPOffice/Rector/MethodCall/ChangeConditionalSetConditionRector.php +++ b/rules/PHPOffice/Rector/MethodCall/ChangeConditionalSetConditionRector.php @@ -48,8 +48,9 @@ public function run(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/PHPOffice/Rector/MethodCall/ChangeDuplicateStyleArrayToApplyFromArrayRector.php b/rules/PHPOffice/Rector/MethodCall/ChangeDuplicateStyleArrayToApplyFromArrayRector.php index 2b0031d4615d..b3df34ff587d 100644 --- a/rules/PHPOffice/Rector/MethodCall/ChangeDuplicateStyleArrayToApplyFromArrayRector.php +++ b/rules/PHPOffice/Rector/MethodCall/ChangeDuplicateStyleArrayToApplyFromArrayRector.php @@ -46,8 +46,9 @@ public function run(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/PHPOffice/Rector/MethodCall/IncreaseColumnIndexRector.php b/rules/PHPOffice/Rector/MethodCall/IncreaseColumnIndexRector.php index 4e5682e5415f..5ad782f409fd 100644 --- a/rules/PHPOffice/Rector/MethodCall/IncreaseColumnIndexRector.php +++ b/rules/PHPOffice/Rector/MethodCall/IncreaseColumnIndexRector.php @@ -64,7 +64,7 @@ public function run(): void } } CODE_SAMPLE - ), + ), ] ); } diff --git a/rules/PHPOffice/Rector/MethodCall/RemoveSetTempDirOnExcelWriterRector.php b/rules/PHPOffice/Rector/MethodCall/RemoveSetTempDirOnExcelWriterRector.php index 37ba8614bced..e3371a262312 100644 --- a/rules/PHPOffice/Rector/MethodCall/RemoveSetTempDirOnExcelWriterRector.php +++ b/rules/PHPOffice/Rector/MethodCall/RemoveSetTempDirOnExcelWriterRector.php @@ -44,8 +44,9 @@ public function run(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/PHPOffice/Rector/StaticCall/ChangeDataTypeForValueRector.php b/rules/PHPOffice/Rector/StaticCall/ChangeDataTypeForValueRector.php index c9298791518d..9c00901ddc90 100644 --- a/rules/PHPOffice/Rector/StaticCall/ChangeDataTypeForValueRector.php +++ b/rules/PHPOffice/Rector/StaticCall/ChangeDataTypeForValueRector.php @@ -44,8 +44,9 @@ public function run(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/PHPOffice/Rector/StaticCall/ChangeIOFactoryArgumentRector.php b/rules/PHPOffice/Rector/StaticCall/ChangeIOFactoryArgumentRector.php index c3caf20a37e9..13a3fd2e2828 100644 --- a/rules/PHPOffice/Rector/StaticCall/ChangeIOFactoryArgumentRector.php +++ b/rules/PHPOffice/Rector/StaticCall/ChangeIOFactoryArgumentRector.php @@ -60,7 +60,7 @@ public function run(): void } } CODE_SAMPLE - ), + ), ] ); } diff --git a/rules/PHPOffice/Rector/StaticCall/ChangeSearchLocationToRegisterReaderRector.php b/rules/PHPOffice/Rector/StaticCall/ChangeSearchLocationToRegisterReaderRector.php index 1a0d46c61900..9724afce40ed 100644 --- a/rules/PHPOffice/Rector/StaticCall/ChangeSearchLocationToRegisterReaderRector.php +++ b/rules/PHPOffice/Rector/StaticCall/ChangeSearchLocationToRegisterReaderRector.php @@ -45,8 +45,9 @@ public function run(): void } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php53/Rector/AssignRef/ClearReturnNewByReferenceRector.php b/rules/Php53/Rector/AssignRef/ClearReturnNewByReferenceRector.php index bf661e8a24dd..8e204f57f3ad 100644 --- a/rules/Php53/Rector/AssignRef/ClearReturnNewByReferenceRector.php +++ b/rules/Php53/Rector/AssignRef/ClearReturnNewByReferenceRector.php @@ -31,8 +31,9 @@ public function getRuleDefinition(): RuleDefinition <<<'CODE_SAMPLE' $assign = new Value; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php b/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php index 8cbe558ea435..90a4c818e620 100644 --- a/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php +++ b/rules/Php53/Rector/Variable/ReplaceHttpServerVarsByServerRector.php @@ -33,7 +33,8 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( 'Rename old $HTTP_* variable names to new replacements', - [new CodeSample('$serverVars = $HTTP_SERVER_VARS;', '$serverVars = $_SERVER;')]); + [new CodeSample('$serverVars = $HTTP_SERVER_VARS;', '$serverVars = $_SERVER;')] + ); } /** diff --git a/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php b/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php index 9e46a7527fda..32ab890913dc 100644 --- a/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php +++ b/rules/Php55/Rector/FuncCall/PregReplaceEModifierRector.php @@ -65,8 +65,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php56/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php b/rules/Php56/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php index ff28df93ba63..d83c2ecf9ff0 100644 --- a/rules/Php56/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php +++ b/rules/Php56/Rector/FunctionLike/AddDefaultValueForUndefinedVariableRector.php @@ -208,8 +208,11 @@ private function shouldSkipVariable(Variable $variable): bool } if ($parentNode instanceof Node && - ($parentNode instanceof Assign || $parentNode instanceof AssignRef || $this->isStaticVariable($parentNode) - )) { + ( + $parentNode instanceof Assign || $parentNode instanceof AssignRef || $this->isStaticVariable( + $parentNode + ) + )) { return true; } diff --git a/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php b/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php index 76c1be5ab124..7d09b264d470 100644 --- a/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php +++ b/rules/Php70/Rector/Break_/BreakNotInLoopOrSwitchToReturnRector.php @@ -63,8 +63,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php b/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php index ba878cea1908..a800b3dda4b7 100644 --- a/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php +++ b/rules/Php70/Rector/FuncCall/RenameMktimeWithoutArgsToTimeRector.php @@ -44,8 +44,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php70/Rector/If_/IfToSpaceshipRector.php b/rules/Php70/Rector/If_/IfToSpaceshipRector.php index a643bed2c825..be25fa1a0452 100644 --- a/rules/Php70/Rector/If_/IfToSpaceshipRector.php +++ b/rules/Php70/Rector/If_/IfToSpaceshipRector.php @@ -92,8 +92,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php b/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php index 141558e7c0e0..2e7f01c85aad 100644 --- a/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php +++ b/rules/Php70/Rector/MethodCall/ThisCallOnStaticMethodToStaticCallRector.php @@ -72,8 +72,9 @@ public static function eat() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php b/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php index 602d44521700..60fd5279db6c 100644 --- a/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php +++ b/rules/Php70/Rector/StaticCall/StaticCallOnNonStaticToInstanceCallRector.php @@ -99,8 +99,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php70/Rector/Switch_/ReduceMultipleDefaultSwitchRector.php b/rules/Php70/Rector/Switch_/ReduceMultipleDefaultSwitchRector.php index a886cdc578d2..bb0aaee03d39 100644 --- a/rules/Php70/Rector/Switch_/ReduceMultipleDefaultSwitchRector.php +++ b/rules/Php70/Rector/Switch_/ReduceMultipleDefaultSwitchRector.php @@ -45,8 +45,9 @@ public function getRuleDefinition(): RuleDefinition break; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php b/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php index 3d4a8886096a..2122d61edaa7 100644 --- a/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php +++ b/rules/Php70/Rector/Ternary/TernaryToSpaceshipRector.php @@ -38,8 +38,9 @@ function order_func($a, $b) { return $a <=> $b; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php b/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php index 6d6e5ec4bc0c..9594a6cef333 100644 --- a/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php +++ b/rules/Php70/Rector/Variable/WrapVariableVariableNameInCurlyBracesRector.php @@ -36,8 +36,9 @@ function run($foo) global ${$foo->bar}; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php71/Rector/Assign/AssignArrayToStringRector.php b/rules/Php71/Rector/Assign/AssignArrayToStringRector.php index b5395f101ea9..f349d565e50d 100644 --- a/rules/Php71/Rector/Assign/AssignArrayToStringRector.php +++ b/rules/Php71/Rector/Assign/AssignArrayToStringRector.php @@ -52,11 +52,13 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( 'String cannot be turned into array by assignment anymore', - [new CodeSample(<<<'CODE_SAMPLE' + [new CodeSample( + <<<'CODE_SAMPLE' $string = ''; $string[] = 1; CODE_SAMPLE - , <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' $string = []; $string[] = 1; CODE_SAMPLE diff --git a/rules/Php71/Rector/BooleanOr/IsIterableRector.php b/rules/Php71/Rector/BooleanOr/IsIterableRector.php index 7243db6dd9c6..c648328cbfbb 100644 --- a/rules/Php71/Rector/BooleanOr/IsIterableRector.php +++ b/rules/Php71/Rector/BooleanOr/IsIterableRector.php @@ -41,7 +41,8 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( 'Changes is_array + Traversable check to is_iterable', - [new CodeSample('is_array($foo) || $foo instanceof Traversable;', 'is_iterable($foo);')]); + [new CodeSample('is_array($foo) || $foo instanceof Traversable;', 'is_iterable($foo);')] + ); } /** diff --git a/rules/Php71/Rector/FuncCall/CountOnNullRector.php b/rules/Php71/Rector/FuncCall/CountOnNullRector.php index ad4d72540fa7..0cc799d2039f 100644 --- a/rules/Php71/Rector/FuncCall/CountOnNullRector.php +++ b/rules/Php71/Rector/FuncCall/CountOnNullRector.php @@ -60,12 +60,12 @@ public function getRuleDefinition(): RuleDefinition return new RuleDefinition( 'Changes count() on null to safe ternary check', [new CodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $values = null; $count = count($values); CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $values = null; $count = count((array) $values); CODE_SAMPLE diff --git a/rules/Php71/Rector/Name/ReservedObjectRector.php b/rules/Php71/Rector/Name/ReservedObjectRector.php index c4d1646615aa..1e0dea43ccb0 100644 --- a/rules/Php71/Rector/Name/ReservedObjectRector.php +++ b/rules/Php71/Rector/Name/ReservedObjectRector.php @@ -36,24 +36,26 @@ public function getRuleDefinition(): RuleDefinition return new RuleDefinition( 'Changes reserved "Object" name to "Object" where can be configured', [ - new ConfiguredCodeSample(<<<'CODE_SAMPLE' + new ConfiguredCodeSample( + <<<'CODE_SAMPLE' class Object { } CODE_SAMPLE - , <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' class SmartObject { } CODE_SAMPLE , - [ - self::RESERVED_KEYWORDS_TO_REPLACEMENTS => [ - 'ReservedObject' => 'SmartObject', - 'Object' => 'AnotherSmartObject', - ], - ] - ), + [ + self::RESERVED_KEYWORDS_TO_REPLACEMENTS => [ + 'ReservedObject' => 'SmartObject', + 'Object' => 'AnotherSmartObject', + ], + ] + ), ] ); } diff --git a/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php b/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php index 66d54b76ee55..98114248c1a4 100644 --- a/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php +++ b/rules/Php71/Rector/TryCatch/MultiExceptionCatchRector.php @@ -26,7 +26,7 @@ public function getRuleDefinition(): RuleDefinition 'Changes multi catch of same exception to single one | separated.', [ new CodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' try { // Some code... } catch (ExceptionType1 $exception) { @@ -36,7 +36,7 @@ public function getRuleDefinition(): RuleDefinition } CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' try { // Some code... } catch (ExceptionType1 | ExceptionType2 $exception) { diff --git a/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php b/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php index 8dcde131f7b5..af51bbee1e4b 100644 --- a/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php +++ b/rules/Php72/Rector/FuncCall/CreateFunctionToAnonymousFunctionRector.php @@ -84,8 +84,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php b/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php index 3b2f10f5e6e9..a16c24f38276 100644 --- a/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php +++ b/rules/Php72/Rector/FuncCall/IsObjectOnIncompleteClassRector.php @@ -35,8 +35,9 @@ public function getRuleDefinition(): RuleDefinition $incompleteObject = new __PHP_Incomplete_Class; $isObject = ! is_object($incompleteObject); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php b/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php index f8108d0f8212..602ad12fd683 100644 --- a/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php +++ b/rules/Php72/Rector/FuncCall/ParseStrWithResultArgumentRector.php @@ -35,8 +35,9 @@ public function getRuleDefinition(): RuleDefinition parse_str($this->query, $result); $data = $result; CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php b/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php index 018587d49784..b7bc46ebdd90 100644 --- a/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php +++ b/rules/Php72/Rector/FuncCall/StringsAssertNakedRector.php @@ -52,8 +52,9 @@ function nakedAssert() assert(true === true); } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php index dbea3d4b1dca..e1b8d8459db0 100644 --- a/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php +++ b/rules/Php73/Rector/FuncCall/ArrayKeyFirstLastRector.php @@ -69,12 +69,12 @@ public function getRuleDefinition(): RuleDefinition CODE_SAMPLE ), new CodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' end($items); $lastKey = key($items); CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $lastKey = array_key_last($items); CODE_SAMPLE ), diff --git a/rules/Php73/Rector/FuncCall/SensitiveDefineRector.php b/rules/Php73/Rector/FuncCall/SensitiveDefineRector.php index e14b2807d1ad..091bdf5bfaa4 100644 --- a/rules/Php73/Rector/FuncCall/SensitiveDefineRector.php +++ b/rules/Php73/Rector/FuncCall/SensitiveDefineRector.php @@ -21,10 +21,12 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( 'Changes case insensitive constants to sensitive ones.', - [new CodeSample(<<<'CODE_SAMPLE' + [new CodeSample( + <<<'CODE_SAMPLE' define('FOO', 42, true); CODE_SAMPLE - , <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' define('FOO', 42); CODE_SAMPLE )] diff --git a/rules/Php73/Rector/FuncCall/SetCookieRector.php b/rules/Php73/Rector/FuncCall/SetCookieRector.php index f9786ad126eb..c978d93eae3c 100644 --- a/rules/Php73/Rector/FuncCall/SetCookieRector.php +++ b/rules/Php73/Rector/FuncCall/SetCookieRector.php @@ -52,11 +52,11 @@ public function getRuleDefinition(): RuleDefinition CODE_SAMPLE ), new CodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' setcookie('name', $name, 0, '', '', true, true); CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' setcookie('name', $name, ['expires' => 0, 'path' => '', 'domain' => '', 'secure' => true, 'httponly' => true]); CODE_SAMPLE ), diff --git a/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php b/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php index 9953053c7d28..a64cc69ef2c6 100644 --- a/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php +++ b/rules/Php73/Rector/String_/SensitiveHereNowDocRector.php @@ -45,8 +45,9 @@ public function getRuleDefinition(): RuleDefinition A A_WRAP CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php74/Rector/FuncCall/ArrayKeyExistsOnPropertyRector.php b/rules/Php74/Rector/FuncCall/ArrayKeyExistsOnPropertyRector.php index 175db7cd4311..47343014c2bc 100644 --- a/rules/Php74/Rector/FuncCall/ArrayKeyExistsOnPropertyRector.php +++ b/rules/Php74/Rector/FuncCall/ArrayKeyExistsOnPropertyRector.php @@ -44,8 +44,9 @@ class SomeClass property_exists($someClass, 'value'); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php74/Rector/FuncCall/FilterVarToAddSlashesRector.php b/rules/Php74/Rector/FuncCall/FilterVarToAddSlashesRector.php index 1cc4b5936730..f46bb328da90 100644 --- a/rules/Php74/Rector/FuncCall/FilterVarToAddSlashesRector.php +++ b/rules/Php74/Rector/FuncCall/FilterVarToAddSlashesRector.php @@ -33,8 +33,9 @@ public function getRuleDefinition(): RuleDefinition $var= "Satya's here!"; addslashes($var); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php b/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php index 097b1e06f817..a06759c1453b 100644 --- a/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php +++ b/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php @@ -24,7 +24,8 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( 'Change mb_strrpos() encoding argument position', - [new CodeSample('mb_strrpos($text, "abc", "UTF-8");', 'mb_strrpos($text, "abc", 0, "UTF-8");')]); + [new CodeSample('mb_strrpos($text, "abc", "UTF-8");', 'mb_strrpos($text, "abc", 0, "UTF-8");')] + ); } /** diff --git a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php index 6285f43b45fd..4b6c60313a78 100644 --- a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php +++ b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php @@ -81,11 +81,13 @@ public function run() } } CODE_SAMPLE - , [ + , + [ self::LIMIT_VALUE => 1000000, ] - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php b/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php index 7b513f118800..cb2667ac6de9 100644 --- a/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php +++ b/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php @@ -42,8 +42,9 @@ class SomeClass public ?string $name = null; } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php b/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php index 28009e9117bb..0de169c2560c 100644 --- a/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php +++ b/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php @@ -37,8 +37,9 @@ public function getRuleDefinition(): RuleDefinition $reflectionFunction = new ReflectionFunction('foo'); $reflectionFunctionAsString = (string) new ReflectionFunction('foo'); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php80/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php b/rules/Php80/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php index 11f30a72d034..9abdce1986dc 100644 --- a/rules/Php80/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php +++ b/rules/Php80/Rector/ClassMethod/OptionalParametersAfterRequiredRector.php @@ -72,7 +72,6 @@ public function run($required, $optional = 1) } } CODE_SAMPLE - ), ]); } diff --git a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php index ab10e135c423..7e3329eb38cd 100644 --- a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php +++ b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php @@ -87,7 +87,8 @@ public function action() } } CODE_SAMPLE - , [ + , + [ self::ANNOTATION_TO_ATTRIBUTE => [ new AnnotationToAttribute( 'Symfony\Component\Routing\Annotation\Route', diff --git a/rules/Php80/Rector/Class_/StringableForToStringRector.php b/rules/Php80/Rector/Class_/StringableForToStringRector.php index a47ff41f1722..d3206ef3bc8f 100644 --- a/rules/Php80/Rector/Class_/StringableForToStringRector.php +++ b/rules/Php80/Rector/Class_/StringableForToStringRector.php @@ -62,8 +62,9 @@ public function __toString(): string } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php80/Rector/FuncCall/ClassOnObjectRector.php b/rules/Php80/Rector/FuncCall/ClassOnObjectRector.php index d81003287d69..7811f1a9f279 100644 --- a/rules/Php80/Rector/FuncCall/ClassOnObjectRector.php +++ b/rules/Php80/Rector/FuncCall/ClassOnObjectRector.php @@ -45,8 +45,9 @@ public function run($object) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php80/Rector/FuncCall/TokenGetAllToObjectRector.php b/rules/Php80/Rector/FuncCall/TokenGetAllToObjectRector.php index a82b999e32ca..e3a90f33767e 100644 --- a/rules/Php80/Rector/FuncCall/TokenGetAllToObjectRector.php +++ b/rules/Php80/Rector/FuncCall/TokenGetAllToObjectRector.php @@ -75,8 +75,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php80/Rector/FunctionLike/UnionTypesRector.php b/rules/Php80/Rector/FunctionLike/UnionTypesRector.php index 80ef77f9555f..fd1d38630f9f 100644 --- a/rules/Php80/Rector/FunctionLike/UnionTypesRector.php +++ b/rules/Php80/Rector/FunctionLike/UnionTypesRector.php @@ -87,7 +87,7 @@ public function go(array|int $number): bool|float } } CODE_SAMPLE - ), + ), ] ); } diff --git a/rules/Php80/Rector/Identical/StrStartsWithRector.php b/rules/Php80/Rector/Identical/StrStartsWithRector.php index 7cd6174d0d48..a59e9ff78f16 100644 --- a/rules/Php80/Rector/Identical/StrStartsWithRector.php +++ b/rules/Php80/Rector/Identical/StrStartsWithRector.php @@ -65,8 +65,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php80/Rector/If_/NullsafeOperatorRector.php b/rules/Php80/Rector/If_/NullsafeOperatorRector.php index a4ab7d63636d..863526d3d162 100644 --- a/rules/Php80/Rector/If_/NullsafeOperatorRector.php +++ b/rules/Php80/Rector/If_/NullsafeOperatorRector.php @@ -78,8 +78,9 @@ public function run($someObject) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php80/Rector/NotIdentical/StrContainsRector.php b/rules/Php80/Rector/NotIdentical/StrContainsRector.php index 11f4aa8e87c4..782aab5e99e9 100644 --- a/rules/Php80/Rector/NotIdentical/StrContainsRector.php +++ b/rules/Php80/Rector/NotIdentical/StrContainsRector.php @@ -52,8 +52,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Php80/Rector/Ternary/GetDebugTypeRector.php b/rules/Php80/Rector/Ternary/GetDebugTypeRector.php index 0f78bd2a26e7..15f02122183b 100644 --- a/rules/Php80/Rector/Ternary/GetDebugTypeRector.php +++ b/rules/Php80/Rector/Ternary/GetDebugTypeRector.php @@ -43,8 +43,9 @@ public function run($value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/PhpSpecToPHPUnit/NodeFactory/BeConstructedWithAssignFactory.php b/rules/PhpSpecToPHPUnit/NodeFactory/BeConstructedWithAssignFactory.php index 2ba72576f153..bdfaec90aae7 100644 --- a/rules/PhpSpecToPHPUnit/NodeFactory/BeConstructedWithAssignFactory.php +++ b/rules/PhpSpecToPHPUnit/NodeFactory/BeConstructedWithAssignFactory.php @@ -34,10 +34,11 @@ final class BeConstructedWithAssignFactory */ private $nodeFactory; - public function __construct(NodeNameResolver $nodeNameResolver, - ValueResolver $valueResolver, - NodeFactory $nodeFactory) - { + public function __construct( + NodeNameResolver $nodeNameResolver, + ValueResolver $valueResolver, + NodeFactory $nodeFactory + ) { $this->nodeNameResolver = $nodeNameResolver; $this->valueResolver = $valueResolver; $this->nodeFactory = $nodeFactory; diff --git a/rules/PhpSpecToPHPUnit/Rector/Class_/RenameSpecFileToTestFileRector.php b/rules/PhpSpecToPHPUnit/Rector/Class_/RenameSpecFileToTestFileRector.php index 7ee36b8317e6..d117d24daa5e 100644 --- a/rules/PhpSpecToPHPUnit/Rector/Class_/RenameSpecFileToTestFileRector.php +++ b/rules/PhpSpecToPHPUnit/Rector/Class_/RenameSpecFileToTestFileRector.php @@ -44,8 +44,9 @@ public function getRuleDefinition(): RuleDefinition <<<'CODE_SAMPLE' // tests/SomeTest.php CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php b/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php index 54f2a4682692..62d066491a90 100644 --- a/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php +++ b/rules/Privatization/NodeAnalyzer/PropertyFetchByMethodAnalyzer.php @@ -96,11 +96,11 @@ private function isPropertyChangingInMultipleMethodCalls(ClassMethod $classMetho $this->simpleCallableNodeTraverser->traverseNodesWithCallable( (array) $classMethod->getStmts(), function (Node $node) use ( - &$isPropertyChanging, - $propertyName, - &$isPropertyReadInIf, - &$isIfFollowedByAssign - ): ?int { + &$isPropertyChanging, + $propertyName, + &$isPropertyReadInIf, + &$isIfFollowedByAssign + ): ?int { if ($isPropertyReadInIf) { if (! $this->propertyFetchAnalyzer->isLocalPropertyOfNames($node, [$propertyName])) { return null; diff --git a/rules/Privatization/Rector/ClassMethod/ChangeGlobalVariablesToPropertiesRector.php b/rules/Privatization/Rector/ClassMethod/ChangeGlobalVariablesToPropertiesRector.php index d577707b1b27..0f7349261338 100644 --- a/rules/Privatization/Rector/ClassMethod/ChangeGlobalVariablesToPropertiesRector.php +++ b/rules/Privatization/Rector/ClassMethod/ChangeGlobalVariablesToPropertiesRector.php @@ -77,8 +77,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php b/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php index 14ae73962550..bffd6b2ab5be 100644 --- a/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php +++ b/rules/Privatization/Rector/ClassMethod/PrivatizeFinalClassMethodRector.php @@ -52,8 +52,9 @@ private function someMethod() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php b/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php index 7d42dae2d6b0..053341266570 100644 --- a/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php +++ b/rules/Privatization/Rector/Class_/ChangeLocalPropertyToVariableRector.php @@ -79,8 +79,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Privatization/Rector/Class_/ChangeReadOnlyVariableWithDefaultValueToConstantRector.php b/rules/Privatization/Rector/Class_/ChangeReadOnlyVariableWithDefaultValueToConstantRector.php index f0dd47fdbda7..eea37ebf30fb 100644 --- a/rules/Privatization/Rector/Class_/ChangeReadOnlyVariableWithDefaultValueToConstantRector.php +++ b/rules/Privatization/Rector/Class_/ChangeReadOnlyVariableWithDefaultValueToConstantRector.php @@ -95,8 +95,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Privatization/Rector/Class_/RepeatedLiteralToClassConstantRector.php b/rules/Privatization/Rector/Class_/RepeatedLiteralToClassConstantRector.php index 0b48a8f9b835..f33b64abf3aa 100644 --- a/rules/Privatization/Rector/Class_/RepeatedLiteralToClassConstantRector.php +++ b/rules/Privatization/Rector/Class_/RepeatedLiteralToClassConstantRector.php @@ -262,7 +262,6 @@ private function createConstName(string $value): string function (string $value): string { return StaticRectorStrings::camelCaseToUnderscore($value); }, - $parts ); diff --git a/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php b/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php index 835389961883..c0a1d0c82fd8 100644 --- a/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php +++ b/rules/Privatization/Rector/MethodCall/PrivatizeLocalGetterToPropertyRector.php @@ -60,8 +60,9 @@ private function getSome() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Privatization/Rector/Property/ChangeReadOnlyPropertyWithDefaultValueToConstantRector.php b/rules/Privatization/Rector/Property/ChangeReadOnlyPropertyWithDefaultValueToConstantRector.php index 30f3cf9d229c..fab23b5e01c9 100644 --- a/rules/Privatization/Rector/Property/ChangeReadOnlyPropertyWithDefaultValueToConstantRector.php +++ b/rules/Privatization/Rector/Property/ChangeReadOnlyPropertyWithDefaultValueToConstantRector.php @@ -92,8 +92,9 @@ public function run() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Removing/Rector/Class_/RemoveParentRector.php b/rules/Removing/Rector/Class_/RemoveParentRector.php index 717b5c312c05..df4d381d514b 100644 --- a/rules/Removing/Rector/Class_/RemoveParentRector.php +++ b/rules/Removing/Rector/Class_/RemoveParentRector.php @@ -53,7 +53,8 @@ final class SomeClass { } CODE_SAMPLE - , [ + , + [ self::PARENT_TYPES_TO_REMOVE => ['SomeParentClass'], ] ), diff --git a/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php b/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php index 81c595093a39..91cd4cb73fb3 100644 --- a/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php +++ b/rules/Removing/Rector/FuncCall/RemoveFuncCallArgRector.php @@ -33,16 +33,18 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Remove argument by position by function name', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' remove_last_arg(1, 2); CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' remove_last_arg(1); CODE_SAMPLE - , [ + , + [ self::REMOVED_FUNCTION_ARGUMENTS => [new RemoveFuncCallArg('remove_last_arg', 1)], - ]), + ] + ), ]); } diff --git a/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php b/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php index 2be35da8ed56..07fbec99eb97 100644 --- a/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php +++ b/rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php @@ -49,19 +49,21 @@ public function getRuleDefinition(): RuleDefinition ]), ], ]; - return new RuleDefinition('Remove ini_get by configuration', [ - new ConfiguredCodeSample( - <<<'CODE_SAMPLE' + return new RuleDefinition( + 'Remove ini_get by configuration', + [ + new ConfiguredCodeSample( + <<<'CODE_SAMPLE' ini_get('y2k_compliance'); ini_get('keep_me'); CODE_SAMPLE - , - <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' ini_get('keep_me'); CODE_SAMPLE - , - $configuration - ), ] + , + $configuration + ), ] ); } diff --git a/rules/RemovingStatic/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php b/rules/RemovingStatic/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php index 6c5125fd9dd6..b57773443739 100644 --- a/rules/RemovingStatic/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php +++ b/rules/RemovingStatic/Rector/ClassMethod/LocallyCalledStaticMethodToNonStaticRector.php @@ -65,9 +65,9 @@ private function someStatic() } } CODE_SAMPLE - - ), - ]); + ), + ] + ); } /** diff --git a/rules/RemovingStatic/Rector/Class_/PassFactoryToUniqueObjectRector.php b/rules/RemovingStatic/Rector/Class_/PassFactoryToUniqueObjectRector.php index a97cd4e6b220..502cc26605a7 100644 --- a/rules/RemovingStatic/Rector/Class_/PassFactoryToUniqueObjectRector.php +++ b/rules/RemovingStatic/Rector/Class_/PassFactoryToUniqueObjectRector.php @@ -78,9 +78,11 @@ public function __construct( public function getRuleDefinition(): RuleDefinition { - return new RuleDefinition('Convert new X/Static::call() to factories in entities, pass them via constructor to each other', [ - new ConfiguredCodeSample( - <<<'CODE_SAMPLE' + return new RuleDefinition( + 'Convert new X/Static::call() to factories in entities, pass them via constructor to each other', + [ + new ConfiguredCodeSample( + <<<'CODE_SAMPLE' ['StaticClass'], - ] - ), ] + , + [ + self::TYPES_TO_SERVICES => ['StaticClass'], + ] + ), ] ); } diff --git a/rules/RemovingStatic/Rector/Class_/StaticTypeToSetterInjectionRector.php b/rules/RemovingStatic/Rector/Class_/StaticTypeToSetterInjectionRector.php index 2b98ae669444..35b36f2be38f 100644 --- a/rules/RemovingStatic/Rector/Class_/StaticTypeToSetterInjectionRector.php +++ b/rules/RemovingStatic/Rector/Class_/StaticTypeToSetterInjectionRector.php @@ -57,7 +57,7 @@ public function getRuleDefinition(): RuleDefinition // custom made only for Elasticr return new RuleDefinition('Changes types to setter injection', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' nodeNameResolver->getName($node); if ($name === null) { diff --git a/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php b/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php index f5501e961e06..a1a1ec48b6b9 100644 --- a/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php +++ b/rules/Renaming/Rector/ClassConstFetch/RenameClassConstFetchRector.php @@ -56,8 +56,9 @@ public function getRuleDefinition(): RuleDefinition CODE_SAMPLE , $configuration - ), - ]); + ), + ] + ); } /** diff --git a/rules/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php b/rules/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php index 737a6c7ee742..cccaa1d56b4b 100644 --- a/rules/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php +++ b/rules/Renaming/Rector/FileWithoutNamespace/PseudoNamespaceToNamespaceRector.php @@ -64,13 +64,13 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Replaces defined Pseudo_Namespaces by Namespace\Ones.', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' /** @var Some_Chicken $someService */ $someService = new Some_Chicken; $someClassToKeep = new Some_Class_To_Keep; CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' /** @var Some\Chicken $someService */ $someService = new Some\Chicken; $someClassToKeep = new Some_Class_To_Keep; diff --git a/rules/Restoration/Rector/New_/CompleteMissingDependencyInNewRector.php b/rules/Restoration/Rector/New_/CompleteMissingDependencyInNewRector.php index 422d166beed8..5b0addd30957 100644 --- a/rules/Restoration/Rector/New_/CompleteMissingDependencyInNewRector.php +++ b/rules/Restoration/Rector/New_/CompleteMissingDependencyInNewRector.php @@ -80,7 +80,8 @@ public function __construct(RandomDependency $randomDependency) } } CODE_SAMPLE - , [ + , + [ self::CLASS_TO_INSTANTIATE_BY_TYPE => [ 'RandomDependency' => 'RandomDependency', ], diff --git a/rules/Transform/Rector/Assign/DimFetchAssignToMethodCallRector.php b/rules/Transform/Rector/Assign/DimFetchAssignToMethodCallRector.php index c71777db865d..29bb8e400778 100644 --- a/rules/Transform/Rector/Assign/DimFetchAssignToMethodCallRector.php +++ b/rules/Transform/Rector/Assign/DimFetchAssignToMethodCallRector.php @@ -75,7 +75,8 @@ public static function createRouter() ], ] ), - ]); + ] + ); } /** diff --git a/rules/Transform/Rector/Assign/GetAndSetToMethodCallRector.php b/rules/Transform/Rector/Assign/GetAndSetToMethodCallRector.php index 00bf96c4cd8b..cda0def6b3c7 100644 --- a/rules/Transform/Rector/Assign/GetAndSetToMethodCallRector.php +++ b/rules/Transform/Rector/Assign/GetAndSetToMethodCallRector.php @@ -58,12 +58,12 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Turns defined `__get`/`__set` to specific method calls.', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $container = new SomeContainer; $container->someService = $someService; CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $container = new SomeContainer; $container->setService("someService", $someService); CODE_SAMPLE diff --git a/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php b/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php index 42ef5f17ecbe..e3a50e3d87c2 100644 --- a/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php +++ b/rules/Transform/Rector/Assign/PropertyAssignToMethodCallRector.php @@ -34,12 +34,12 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Turns property assign of specific type and property name to method call', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $someObject = new SomeClass; $someObject->oldProperty = false; CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $someObject = new SomeClass; $someObject->newMethodCall(false); CODE_SAMPLE diff --git a/rules/Transform/Rector/ClassMethod/SingleToManyMethodRector.php b/rules/Transform/Rector/ClassMethod/SingleToManyMethodRector.php index dd75051f01ed..1c3285837efb 100644 --- a/rules/Transform/Rector/ClassMethod/SingleToManyMethodRector.php +++ b/rules/Transform/Rector/ClassMethod/SingleToManyMethodRector.php @@ -72,9 +72,11 @@ public function getNodes(): array } } CODE_SAMPLE - , [ - self::SINGLES_TO_MANY_METHODS => [new SingleToManyMethod('SomeClass', 'getNode', 'getNodes')], - ]), + , + [ + self::SINGLES_TO_MANY_METHODS => [new SingleToManyMethod('SomeClass', 'getNode', 'getNodes')], + ] + ), ]); } diff --git a/rules/Transform/Rector/Class_/AddInterfaceByParentRector.php b/rules/Transform/Rector/Class_/AddInterfaceByParentRector.php index 6d0beb73dbee..786cbea8f9ed 100644 --- a/rules/Transform/Rector/Class_/AddInterfaceByParentRector.php +++ b/rules/Transform/Rector/Class_/AddInterfaceByParentRector.php @@ -47,11 +47,13 @@ class SomeClass extends SomeParent implements SomeInterface } CODE_SAMPLE - , [ - self::INTERFACE_BY_PARENT => [ - 'SomeParent' => 'SomeInterface', - ], - ]), + , + [ + self::INTERFACE_BY_PARENT => [ + 'SomeParent' => 'SomeInterface', + ], + ] + ), ]); } diff --git a/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php b/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php index 13d878a5a314..39877ff1c3ae 100644 --- a/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php +++ b/rules/Transform/Rector/Class_/AddInterfaceByTraitRector.php @@ -47,11 +47,13 @@ class SomeClass implements SomeInterface use SomeTrait; } CODE_SAMPLE - , [ - self::INTERFACE_BY_TRAIT => [ - 'SomeTrait' => 'SomeInterface', - ], - ]), + , + [ + self::INTERFACE_BY_TRAIT => [ + 'SomeTrait' => 'SomeInterface', + ], + ] + ), ]); } diff --git a/rules/Transform/Rector/Class_/ChangeSingletonToServiceRector.php b/rules/Transform/Rector/Class_/ChangeSingletonToServiceRector.php index c9ea59615a12..1fdb48f339a2 100644 --- a/rules/Transform/Rector/Class_/ChangeSingletonToServiceRector.php +++ b/rules/Transform/Rector/Class_/ChangeSingletonToServiceRector.php @@ -75,8 +75,9 @@ public function __construct() } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Transform/Rector/Expression/MethodCallToReturnRector.php b/rules/Transform/Rector/Expression/MethodCallToReturnRector.php index 3ab84fe7bfda..df5d334bb2ff 100644 --- a/rules/Transform/Rector/Expression/MethodCallToReturnRector.php +++ b/rules/Transform/Rector/Expression/MethodCallToReturnRector.php @@ -65,11 +65,13 @@ public function deny() } CODE_SAMPLE - , [ - self::METHOD_CALL_WRAPS => [ - 'SomeClass' => ['deny'], - ], - ]), + , + [ + self::METHOD_CALL_WRAPS => [ + 'SomeClass' => ['deny'], + ], + ] + ), ]); } diff --git a/rules/Transform/Rector/FileWithoutNamespace/FunctionToStaticMethodRector.php b/rules/Transform/Rector/FileWithoutNamespace/FunctionToStaticMethodRector.php index cc7664c795ca..10cb1d43a298 100644 --- a/rules/Transform/Rector/FileWithoutNamespace/FunctionToStaticMethodRector.php +++ b/rules/Transform/Rector/FileWithoutNamespace/FunctionToStaticMethodRector.php @@ -76,8 +76,9 @@ public static function someFunction() SomeUtilsClass::someFunction('lol'); CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php b/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php index 62b20aa98b3d..f27d31bc0f93 100644 --- a/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php +++ b/rules/Transform/Rector/Isset_/UnsetAndIssetToMethodCallRector.php @@ -36,7 +36,7 @@ public function getRuleDefinition(): RuleDefinition return new RuleDefinition('Turns defined `__isset`/`__unset` calls to specific method calls.', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $container = new SomeContainer; isset($container["someKey"]); unset($container["someKey"]); diff --git a/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php b/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php index 8636b3a2dec5..573add67485a 100644 --- a/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php +++ b/rules/Transform/Rector/MethodCall/MethodCallToPropertyFetchRector.php @@ -31,7 +31,7 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Turns method call "$this->something()" to property fetch "$this->something"', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class SomeClass { public function run() @@ -41,7 +41,7 @@ public function run() } CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class SomeClass { public function run() diff --git a/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php b/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php index 81c3bf0ac71d..50c0a9b17225 100644 --- a/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php +++ b/rules/Transform/Rector/MethodCall/ReplaceParentCallByPropertyCallRector.php @@ -30,7 +30,8 @@ final class ReplaceParentCallByPropertyCallRector extends AbstractRector impleme public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( - 'Changes method calls in child of specific types to defined property method call', [ + 'Changes method calls in child of specific types to defined property method call', + [ new ConfiguredCodeSample( <<<'CODE_SAMPLE' final class SomeClass diff --git a/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php b/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php index 63cfb9f025da..5f8419d30125 100644 --- a/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php +++ b/rules/Transform/Rector/StaticCall/StaticCallToMethodCallRector.php @@ -84,16 +84,18 @@ public function run() } } CODE_SAMPLE - , [ - self::STATIC_CALLS_TO_METHOD_CALLS => [ - new StaticCallToMethodCall( - 'Nette\Utils\FileSystem', - 'write', - 'Symplify\SmartFileSystem\SmartFileSystem', - 'dumpFile' - ), - ], - ]), + , + [ + self::STATIC_CALLS_TO_METHOD_CALLS => [ + new StaticCallToMethodCall( + 'Nette\Utils\FileSystem', + 'write', + 'Symplify\SmartFileSystem\SmartFileSystem', + 'dumpFile' + ), + ], + ] + ), ]); } diff --git a/rules/Transform/Rector/String_/ToStringToMethodCallRector.php b/rules/Transform/Rector/String_/ToStringToMethodCallRector.php index b5b51217be28..28869a50e707 100644 --- a/rules/Transform/Rector/String_/ToStringToMethodCallRector.php +++ b/rules/Transform/Rector/String_/ToStringToMethodCallRector.php @@ -34,13 +34,13 @@ public function getRuleDefinition(): RuleDefinition { return new RuleDefinition('Turns defined code uses of "__toString()" method to specific method calls.', [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $someValue = new SomeObject; $result = (string) $someValue; $result = $someValue->__toString(); CODE_SAMPLE , -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' $someValue = new SomeObject; $result = $someValue->getPath(); $result = $someValue->getPath(); diff --git a/rules/Transform/ValueObject/ArgumentFuncCallToMethodCall.php b/rules/Transform/ValueObject/ArgumentFuncCallToMethodCall.php index ded839c74d6c..64479a534322 100644 --- a/rules/Transform/ValueObject/ArgumentFuncCallToMethodCall.php +++ b/rules/Transform/ValueObject/ArgumentFuncCallToMethodCall.php @@ -27,7 +27,10 @@ final class ArgumentFuncCallToMethodCall private $methodIfArgs; public function __construct( - string $function, string $class, ?string $methodIfArgs = null, ?string $methodIfNoArgs = null + string $function, + string $class, + ?string $methodIfArgs = null, + ?string $methodIfNoArgs = null ) { $this->function = $function; $this->class = $class; diff --git a/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php b/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php index 74528f8befda..ba2815d93462 100644 --- a/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php +++ b/rules/TypeDeclaration/AlreadyAssignDetector/NullTypeAssignDetector.php @@ -64,7 +64,8 @@ public function detect(ClassLike $classLike, string $propertyName): ?bool $needsNullType = null; $this->simpleCallableNodeTraverser->traverseNodesWithCallable($classLike->stmts, function (Node $node) use ( - $propertyName, &$needsNullType + $propertyName, + &$needsNullType ): ?int { $expr = $this->matchAssignExprToPropertyName($node, $propertyName); if (! $expr instanceof Expr) { diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php index 81d033f79569..d48d3abc8a72 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddArrayParamDocTypeRector.php @@ -87,8 +87,9 @@ public function __construct(array $values) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector.php index 32cea6771cac..7f802c33af5b 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector.php @@ -126,8 +126,9 @@ public function getValues(): array } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php b/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php index 4ed77cb94b2e..4aa1f11a3ecf 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php @@ -56,7 +56,6 @@ public function getValues(): void } } CODE_SAMPLE - ), ]); } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php index 530d4f34e4d5..a94d0b633fd7 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnNeverTypeRector.php @@ -62,7 +62,6 @@ public function run(): never } } CODE_SAMPLE - ), ]); } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php index 8f38d7014d10..188393a7e654 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromReturnNewRector.php @@ -54,7 +54,6 @@ public function action(): Respose } } CODE_SAMPLE - ), ]); } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php index 4e678d9c0b0a..9251ac1c20dd 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector.php @@ -83,7 +83,6 @@ private function getNumber(): int } } CODE_SAMPLE - ), ]); } diff --git a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php index 8b46b5510a31..09e767eb3a29 100644 --- a/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php +++ b/rules/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedPropertyRector.php @@ -63,7 +63,6 @@ public function getAge(): int } } CODE_SAMPLE - ), ]); } diff --git a/rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php b/rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php index 388db7bf6186..807a606aa4a4 100644 --- a/rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php +++ b/rules/TypeDeclaration/Rector/FunctionLike/ParamTypeDeclarationRector.php @@ -141,8 +141,9 @@ public function change(int $number) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/TypeDeclaration/Rector/MethodCall/FormerNullableArgumentToScalarTypedRector.php b/rules/TypeDeclaration/Rector/MethodCall/FormerNullableArgumentToScalarTypedRector.php index 686f0f420374..13a033a04c4d 100644 --- a/rules/TypeDeclaration/Rector/MethodCall/FormerNullableArgumentToScalarTypedRector.php +++ b/rules/TypeDeclaration/Rector/MethodCall/FormerNullableArgumentToScalarTypedRector.php @@ -69,8 +69,9 @@ public function setValue(string $value) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php b/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php index 755b8920698b..cecb86004016 100644 --- a/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php +++ b/rules/TypeDeclaration/Rector/Param/ParamTypeFromStrictTypedPropertyRector.php @@ -65,7 +65,6 @@ public function setAge(int $age) } } CODE_SAMPLE - ), ]); } diff --git a/rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php b/rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php index c23e28908187..d1c6bae5105b 100644 --- a/rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php +++ b/rules/TypeDeclaration/Rector/Property/CompleteVarDocTypePropertyRector.php @@ -67,8 +67,9 @@ public function __construct(EventDispatcher $eventDispatcher) } } CODE_SAMPLE - ), - ]); + ), + ] + ); } /** diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php index 955120a9b6b6..f263236112c3 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php @@ -66,7 +66,6 @@ public function __construct(string $name) } } CODE_SAMPLE - ), ]); } diff --git a/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php b/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php index 6807068f6600..debecae2debf 100644 --- a/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php +++ b/rules/Visibility/Rector/ClassConst/ChangeConstantVisibilityRector.php @@ -35,7 +35,7 @@ public function getRuleDefinition(): RuleDefinition 'Change visibility of constant from parent class.', [ new ConfiguredCodeSample( - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class FrameworkClass { protected const SOME_CONSTANT = 1; @@ -47,7 +47,7 @@ class MyClass extends FrameworkClass } CODE_SAMPLE , - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class FrameworkClass { protected const SOME_CONSTANT = 1; @@ -59,16 +59,12 @@ class MyClass extends FrameworkClass } CODE_SAMPLE , - [ - self::CLASS_CONSTANT_VISIBILITY_CHANGES => [ - new ChangeConstantVisibility( - 'ParentObject', - 'SOME_CONSTANT', - Visibility::PROTECTED - ), - ], - ] - ), + [ + self::CLASS_CONSTANT_VISIBILITY_CHANGES => [ + new ChangeConstantVisibility('ParentObject', 'SOME_CONSTANT', Visibility::PROTECTED), + ], + ] + ), ] ); } diff --git a/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php b/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php index f36c0e6af317..a516d4eeeabb 100644 --- a/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php +++ b/rules/Visibility/Rector/ClassMethod/ChangeMethodVisibilityRector.php @@ -46,7 +46,7 @@ public function getRuleDefinition(): RuleDefinition 'Change visibility of method from parent class.', [ new ConfiguredCodeSample( - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class FrameworkClass { protected someMethod() @@ -62,7 +62,7 @@ class MyClass extends FrameworkClass } CODE_SAMPLE , - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class FrameworkClass { protected someMethod() diff --git a/rules/Visibility/Rector/Property/ChangePropertyVisibilityRector.php b/rules/Visibility/Rector/Property/ChangePropertyVisibilityRector.php index 1d96752c8103..57d60cff72c6 100644 --- a/rules/Visibility/Rector/Property/ChangePropertyVisibilityRector.php +++ b/rules/Visibility/Rector/Property/ChangePropertyVisibilityRector.php @@ -36,7 +36,7 @@ public function getRuleDefinition(): RuleDefinition 'Change visibility of property from parent class.', [ new ConfiguredCodeSample( - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class FrameworkClass { protected $someProperty; @@ -48,7 +48,7 @@ class MyClass extends FrameworkClass } CODE_SAMPLE , - <<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' class FrameworkClass { protected $someProperty; @@ -60,14 +60,14 @@ class MyClass extends FrameworkClass } CODE_SAMPLE , - [ - self::PROPERTY_TO_VISIBILITY_BY_CLASS => [ - 'FrameworkClass' => [ - 'someProperty' => Visibility::PROTECTED, - ], - ], - ] - ), + [ + self::PROPERTY_TO_VISIBILITY_BY_CLASS => [ + 'FrameworkClass' => [ + 'someProperty' => Visibility::PROTECTED, + ], + ], + ] + ), ] ); } diff --git a/src/Configuration/Option.php b/src/Configuration/Option.php index 2692771a6433..fc4cb078cdd5 100644 --- a/src/Configuration/Option.php +++ b/src/Configuration/Option.php @@ -99,6 +99,7 @@ final class Option public const AUTOLOAD_PATHS = 'autoload_paths'; /** + * @deprecated Use $containerConfigurator->import() as it does the same job, just better and more explicit * @var string */ public const SETS = 'sets'; diff --git a/src/Console/Command/ShowCommand.php b/src/Console/Command/ShowCommand.php index 34a1062d88b3..b0bbb4e545c1 100644 --- a/src/Console/Command/ShowCommand.php +++ b/src/Console/Command/ShowCommand.php @@ -6,7 +6,6 @@ use Rector\Core\Configuration\Option; use Rector\Core\Contract\Rector\RectorInterface; -use Rector\PostRector\Application\PostFileProcessor; use Rector\PostRector\Contract\Rector\PostRectorInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/NonPhpFile/Rector/RenameClassNonPhpRector.php b/src/NonPhpFile/Rector/RenameClassNonPhpRector.php index 3c52cee500d1..4e4c7c74df43 100644 --- a/src/NonPhpFile/Rector/RenameClassNonPhpRector.php +++ b/src/NonPhpFile/Rector/RenameClassNonPhpRector.php @@ -60,24 +60,27 @@ public function __construct( public function getRuleDefinition(): RuleDefinition { return new RuleDefinition( - 'Change class names and just renamed classes in non-PHP files, NEON, YAML, TWIG, LATTE, blade etc. mostly with regular expressions', [ + 'Change class names and just renamed classes in non-PHP files, NEON, YAML, TWIG, LATTE, blade etc. mostly with regular expressions', + [ new ConfiguredCodeSample( -<<<'CODE_SAMPLE' + <<<'CODE_SAMPLE' services: - SomeOldClass CODE_SAMPLE - , <<<'CODE_SAMPLE' + , + <<<'CODE_SAMPLE' services: - SomeNewClass CODE_SAMPLE , - [ - self::RENAME_CLASSES => [ - 'SomeOldClass' => 'SomeNewClass', - ], - ] - ), - ]); + [ + self::RENAME_CLASSES => [ + 'SomeOldClass' => 'SomeNewClass', + ], + ] + ), + ] + ); } public function refactorFileContent(string $fileContent): string diff --git a/src/PhpParser/Node/Value/ValueResolver.php b/src/PhpParser/Node/Value/ValueResolver.php index 609e0569c0c7..8c816d239f60 100644 --- a/src/PhpParser/Node/Value/ValueResolver.php +++ b/src/PhpParser/Node/Value/ValueResolver.php @@ -185,9 +185,9 @@ public function areValues(array $nodes, array $expectedValues): bool private function processConcat(Concat $concat, bool $resolvedClassReference): string { return $this->getValue($concat->left, $resolvedClassReference) . $this->getValue( - $concat->right, - $resolvedClassReference - ); + $concat->right, + $resolvedClassReference + ); } private function getConstExprEvaluator(): ConstExprEvaluator diff --git a/src/Reporting/MissingRectorRulesReporter.php b/src/Reporting/MissingRectorRulesReporter.php index 59499fa7bc89..6ba1311fbe94 100644 --- a/src/Reporting/MissingRectorRulesReporter.php +++ b/src/Reporting/MissingRectorRulesReporter.php @@ -55,8 +55,7 @@ public function report(): void $this->symfonyStyle->newLine(1); $this->symfonyStyle->title('2. Add set of rules to "rector.php"'); - $this->symfonyStyle->writeln(' $parameters = $containerConfigurator->parameters();'); - $this->symfonyStyle->writeln(' $parameters->set(Option::SETS, [...]);'); + $this->symfonyStyle->writeln(' $containerConfigurator->import(SetList::...);'); $this->symfonyStyle->newLine(1); $this->symfonyStyle->title('Missing "rector.php" in your project? Let Rector create it for you'); diff --git a/templates/rector.php.dist b/templates/rector.php.dist index bf6149a10fd2..ab1c6f1a1cbe 100644 --- a/templates/rector.php.dist +++ b/templates/rector.php.dist @@ -12,9 +12,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { $parameters = $containerConfigurator->parameters(); // Define what rule sets will be applied - $parameters->set(Option::SETS, [ - SetList::DEAD_CODE, - ]); + $containerConfigurator->import(SetList::DEAD_CODE); // get services (needed for register a single rule) // $services = $containerConfigurator->services(); diff --git a/tests/DependencyInjection/ConfigurableRectorImportConfigCallsMergeTest.php b/tests/DependencyInjection/ConfigurableRectorImportConfigCallsMergeTest.php index 0551041fd667..b2f803190dff 100644 --- a/tests/DependencyInjection/ConfigurableRectorImportConfigCallsMergeTest.php +++ b/tests/DependencyInjection/ConfigurableRectorImportConfigCallsMergeTest.php @@ -79,13 +79,13 @@ public function provideData(): Iterator yield [ __DIR__ . '/config/one_set_with_own_rename.php', [ + 'Old' => 'New', 'PHPUnit_Framework_MockObject_Stub' => 'PHPUnit\Framework\MockObject\Stub', 'PHPUnit_Framework_MockObject_Stub_Return' => 'PHPUnit\Framework\MockObject\Stub\ReturnStub', 'PHPUnit_Framework_MockObject_Matcher_Parameters' => 'PHPUnit\Framework\MockObject\Matcher\Parameters', 'PHPUnit_Framework_MockObject_Matcher_Invocation' => 'PHPUnit\Framework\MockObject\Matcher\Invocation', 'PHPUnit_Framework_MockObject_MockObject' => 'PHPUnit\Framework\MockObject\MockObject', 'PHPUnit_Framework_MockObject_Invocation_Object' => 'PHPUnit\Framework\MockObject\Invocation\ObjectInvocation', - 'Old' => 'New', ], ]; @@ -105,6 +105,7 @@ public function provideData(): Iterator yield [ __DIR__ . '/config/two_sets_with_own_rename.php', [ + 'Old' => 'New', 'Twig_SimpleFilter' => 'Twig_Filter', 'Twig_SimpleFunction' => 'Twig_Function', 'Twig_SimpleTest' => 'Twig_Test', @@ -114,7 +115,6 @@ public function provideData(): Iterator 'PHPUnit_Framework_MockObject_Matcher_Invocation' => 'PHPUnit\Framework\MockObject\Matcher\Invocation', 'PHPUnit_Framework_MockObject_MockObject' => 'PHPUnit\Framework\MockObject\MockObject', 'PHPUnit_Framework_MockObject_Invocation_Object' => 'PHPUnit\Framework\MockObject\Invocation\ObjectInvocation', - 'Old' => 'New', ], ]; } diff --git a/tests/DependencyInjection/config/one_set.php b/tests/DependencyInjection/config/one_set.php index f052a5f2b61a..04e7e11ff7db 100644 --- a/tests/DependencyInjection/config/one_set.php +++ b/tests/DependencyInjection/config/one_set.php @@ -2,12 +2,9 @@ declare(strict_types=1); -use Rector\Core\Configuration\Option; use Rector\Set\ValueObject\SetList; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $parameters = $containerConfigurator->parameters(); - - $parameters->set(Option::SETS, [SetList::PHPUNIT_60]); + $containerConfigurator->import(SetList::PHPUNIT_60); }; diff --git a/tests/DependencyInjection/config/one_set_with_own_rename.php b/tests/DependencyInjection/config/one_set_with_own_rename.php index 5696e9a11a19..21cd7a75e7cb 100644 --- a/tests/DependencyInjection/config/one_set_with_own_rename.php +++ b/tests/DependencyInjection/config/one_set_with_own_rename.php @@ -2,15 +2,12 @@ declare(strict_types=1); -use Rector\Core\Configuration\Option; use Rector\Renaming\Rector\Name\RenameClassRector; use Rector\Set\ValueObject\SetList; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $parameters = $containerConfigurator->parameters(); - - $parameters->set(Option::SETS, [SetList::PHPUNIT_60]); + $containerConfigurator->import(SetList::PHPUNIT_60); $services = $containerConfigurator->services(); $services->set(RenameClassRector::class) diff --git a/tests/DependencyInjection/config/two_sets.php b/tests/DependencyInjection/config/two_sets.php index 217530017155..38c09ae554d8 100644 --- a/tests/DependencyInjection/config/two_sets.php +++ b/tests/DependencyInjection/config/two_sets.php @@ -2,12 +2,10 @@ declare(strict_types=1); -use Rector\Core\Configuration\Option; use Rector\Set\ValueObject\SetList; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $parameters = $containerConfigurator->parameters(); - - $parameters->set(Option::SETS, [SetList::PHPUNIT_60, SetList::TWIG_20]); + $containerConfigurator->import(SetList::PHPUNIT_60); + $containerConfigurator->import(SetList::TWIG_20); }; diff --git a/tests/DependencyInjection/config/two_sets_with_own_rename.php b/tests/DependencyInjection/config/two_sets_with_own_rename.php index 022e2ae4b6d1..00256684f664 100644 --- a/tests/DependencyInjection/config/two_sets_with_own_rename.php +++ b/tests/DependencyInjection/config/two_sets_with_own_rename.php @@ -2,15 +2,14 @@ declare(strict_types=1); -use Rector\Core\Configuration\Option; +use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Renaming\Rector\Name\RenameClassRector; -use Rector\Set\ValueObject\SetList; +use Rector\Symfony\Set\TwigSetList; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $parameters = $containerConfigurator->parameters(); - - $parameters->set(Option::SETS, [SetList::PHPUNIT_60, SetList::TWIG_20]); + $containerConfigurator->import(PHPUnitSetList::PHPUNIT_60); + $containerConfigurator->import(TwigSetList::TWIG_20); $services = $containerConfigurator->services(); $services->set(RenameClassRector::class)