├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── dependabot.yaml └── workflows │ ├── build_scoped_rector.yaml │ ├── code_analysis.yaml │ ├── code_analysis_no_dev.yaml │ ├── e2e.yaml │ ├── e2e_with_cache.yaml │ ├── packages_tests.yaml │ ├── php_linter.yaml │ ├── rector.yaml │ ├── tests.yaml │ └── weekly_pull_requests.yaml ├── .gitignore ├── .phpstorm.meta.php ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── UPGRADING.md ├── bin ├── add-phpstan-self-replace.php ├── rector ├── rector.php ├── test-fixture-stats.php └── validate-phpstan-version.php ├── build ├── build-preload.php ├── build-rector-scoped.sh ├── config │ ├── config-downgrade.php │ └── phpstan-for-downgrade.neon └── target-repository │ ├── README.md │ ├── bootstrap.php │ ├── composer.json │ └── stubs-rector │ ├── Internal │ ├── Constants.php │ ├── EnumInterfaces.php │ └── NativeClasses.php │ └── PHPUnit │ └── Framework │ └── TestCase.php ├── composer-dependency-analyser.php ├── composer.json ├── config ├── config.php ├── phpstan │ ├── better-infer.neon │ ├── parser.neon │ └── static-reflection.neon └── set │ ├── behat-annotations-to-attributes.php │ ├── code-quality.php │ ├── coding-style.php │ ├── datetime-to-carbon.php │ ├── dead-code.php │ ├── early-return.php │ ├── gmagick-to-imagick.php │ ├── instanceof.php │ ├── level │ ├── up-to-php53.php │ ├── up-to-php54.php │ ├── up-to-php55.php │ ├── up-to-php56.php │ ├── up-to-php70.php │ ├── up-to-php71.php │ ├── up-to-php72.php │ ├── up-to-php73.php │ ├── up-to-php74.php │ ├── up-to-php80.php │ ├── up-to-php81.php │ ├── up-to-php82.php │ ├── up-to-php83.php │ ├── up-to-php84.php │ └── up-to-php85.php │ ├── naming.php │ ├── nette-utils │ └── nette-utils4.php │ ├── php-polyfills.php │ ├── php52.php │ ├── php53.php │ ├── php54.php │ ├── php55.php │ ├── php56.php │ ├── php70.php │ ├── php71.php │ ├── php72.php │ ├── php73.php │ ├── php74.php │ ├── php80.php │ ├── php81.php │ ├── php82.php │ ├── php83.php │ ├── php84.php │ ├── php85.php │ ├── privatization.php │ ├── rector-preset.php │ ├── strict-booleans.php │ └── type-declaration.php ├── docker-compose.yml ├── e2e ├── applied-polyfill-php80 │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ └── SomeStartWith.php ├── applied-rule-change-docblock │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── AlreadyChangedDocblock.php │ │ ├── RenameDocblock.php │ │ └── UselessVarTag.php ├── applied-rule-removed-node-with-cache │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── AlwaysTrue.php │ │ └── DeadConstructor.php ├── applied-rule-removed-node │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── AlwaysTrue.php │ │ └── DeadConstructor.php ├── applied-rule-return-array-nodes │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── MultiRules.php │ │ └── RemoveAlwaysElse.php ├── different-path-over-skip-config │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── controllers │ │ └── DeadConstructor.php │ │ └── models │ │ └── DeadConstructor.php ├── e2eTestRunner.php ├── e2eTestRunnerWithCache.php ├── invalid-paths │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ └── NamespacedSomeClassFound.php ├── no-parallel-reflection-resolver │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── NamespacedSomeClassFound.php │ │ └── SomeClassNotFound.php ├── only-option-quote-double-equalnone │ ├── cli-options.txt │ ├── composer.json │ ├── expected-output.diff │ └── rector.php ├── only-option-quote-single-bsdouble │ ├── cli-options.txt │ ├── composer.json │ ├── expected-output.diff │ └── rector.php ├── only-option-quote-single-equalnone │ ├── cli-options.txt │ ├── composer.json │ ├── expected-output.diff │ └── rector.php ├── only-option-quote-single │ ├── cli-options.txt │ ├── composer.json │ ├── expected-output.diff │ └── rector.php ├── only-option │ ├── cli-options.txt │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── MultiRules.php │ │ └── RemoveAlwaysElse.php ├── parallel with space │ ├── composer.json │ ├── rector.php │ └── src │ │ └── Test.php ├── parallel-custom-config │ ├── .gitignore │ ├── composer.json │ ├── custom │ │ └── config │ │ │ └── rector.php │ ├── expected-output.diff │ └── src │ │ └── SomeClass.php ├── parallel-reflection-resolver │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── NamespacedSomeClassFound.php │ │ └── SomeClassNotFound.php ├── print-new-node │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ │ ├── ExtendingTestClass.php │ │ └── TestClass.php └── timeout-file-not-cached │ ├── .gitignore │ ├── composer.json │ ├── expected-output.diff │ ├── rector.php │ └── src │ └── SomeFixturePrinter.php ├── ecs.php ├── full_build.sh ├── phpstan.neon ├── phpunit.xml ├── preload-split-package.php ├── preload.php ├── rector.php ├── rules ├── Arguments │ ├── ArgumentDefaultValueReplacer.php │ ├── Contract │ │ └── ReplaceArgumentDefaultValueInterface.php │ ├── NodeAnalyzer │ │ ├── ArgumentAddingScope.php │ │ └── ChangedArgumentsDetector.php │ ├── Rector │ │ ├── ClassMethod │ │ │ ├── ArgumentAdderRector.php │ │ │ └── ReplaceArgumentDefaultValueRector.php │ │ ├── FuncCall │ │ │ └── FunctionArgumentDefaultValueReplacerRector.php │ │ └── MethodCall │ │ │ └── RemoveMethodCallParamRector.php │ └── ValueObject │ │ ├── ArgumentAdder.php │ │ ├── ArgumentAdderWithoutDefaultValue.php │ │ ├── RemoveMethodCallParam.php │ │ ├── ReplaceArgumentDefaultValue.php │ │ └── ReplaceFuncCallArgumentDefaultValue.php ├── Carbon │ ├── NodeFactory │ │ └── CarbonCallFactory.php │ └── Rector │ │ ├── FuncCall │ │ ├── DateFuncCallToCarbonRector.php │ │ └── TimeFuncCallToCarbonRector.php │ │ ├── MethodCall │ │ └── DateTimeMethodCallToCarbonRector.php │ │ └── New_ │ │ └── DateTimeInstanceToCarbonRector.php ├── CodeQuality │ ├── CompactConverter.php │ ├── NodeAnalyzer │ │ ├── ClassLikeAnalyzer.php │ │ ├── ForeachAnalyzer.php │ │ ├── LocalPropertyAnalyzer.php │ │ └── VariableDimFetchAssignResolver.php │ ├── NodeFactory │ │ ├── MissingPropertiesFactory.php │ │ ├── PropertyTypeDecorator.php │ │ └── TypedPropertyFactory.php │ ├── NodeManipulator │ │ └── ExprBoolCaster.php │ ├── Rector │ │ ├── Assign │ │ │ └── CombinedAssignRector.php │ │ ├── BooleanAnd │ │ │ ├── RemoveUselessIsObjectCheckRector.php │ │ │ └── SimplifyEmptyArrayCheckRector.php │ │ ├── BooleanNot │ │ │ ├── ReplaceMultipleBooleanNotRector.php │ │ │ └── SimplifyDeMorganBinaryRector.php │ │ ├── Catch_ │ │ │ └── ThrowWithPreviousExceptionRector.php │ │ ├── ClassConstFetch │ │ │ └── ConvertStaticPrivateConstantToSelfRector.php │ │ ├── ClassMethod │ │ │ ├── ExplicitReturnNullRector.php │ │ │ ├── InlineArrayReturnAssignRector.php │ │ │ ├── LocallyCalledStaticMethodToNonStaticRector.php │ │ │ └── OptionalParametersAfterRequiredRector.php │ │ ├── Class_ │ │ │ ├── CompleteDynamicPropertiesRector.php │ │ │ ├── DynamicDocBlockPropertyToNativePropertyRector.php │ │ │ ├── InlineConstructorDefaultToPropertyRector.php │ │ │ └── StaticToSelfStaticMethodCallOnFinalClassRector.php │ │ ├── Concat │ │ │ └── JoinStringConcatRector.php │ │ ├── Empty_ │ │ │ └── SimplifyEmptyCheckOnEmptyArrayRector.php │ │ ├── Equal │ │ │ └── UseIdenticalOverEqualWithSameTypeRector.php │ │ ├── Expression │ │ │ ├── InlineIfToExplicitIfRector.php │ │ │ └── TernaryFalseExpressionToIfRector.php │ │ ├── For_ │ │ │ └── ForRepeatedCountToOwnVariableRector.php │ │ ├── Foreach_ │ │ │ ├── ForeachItemsAssignToEmptyArrayToAssignRector.php │ │ │ ├── ForeachToInArrayRector.php │ │ │ ├── SimplifyForeachToCoalescingRector.php │ │ │ └── UnusedForeachValueToArrayKeysRector.php │ │ ├── FuncCall │ │ │ ├── ArrayMergeOfNonArraysToSimpleArrayRector.php │ │ │ ├── CallUserFuncWithArrowFunctionToInlineRector.php │ │ │ ├── ChangeArrayPushToArrayAssignRector.php │ │ │ ├── CompactToVariablesRector.php │ │ │ ├── InlineIsAInstanceOfRector.php │ │ │ ├── IsAWithStringWithThirdArgumentRector.php │ │ │ ├── RemoveSoleValueSprintfRector.php │ │ │ ├── SetTypeToCastRector.php │ │ │ ├── SimplifyFuncGetArgsCountRector.php │ │ │ ├── SimplifyInArrayValuesRector.php │ │ │ ├── SimplifyRegexPatternRector.php │ │ │ ├── SimplifyStrposLowerRector.php │ │ │ ├── SingleInArrayToCompareRector.php │ │ │ └── UnwrapSprintfOneArgumentRector.php │ │ ├── FunctionLike │ │ │ └── SimplifyUselessVariableRector.php │ │ ├── Identical │ │ │ ├── BooleanNotIdenticalToNotIdenticalRector.php │ │ │ ├── FlipTypeControlToUseExclusiveTypeRector.php │ │ │ ├── SimplifyArraySearchRector.php │ │ │ ├── SimplifyBoolIdenticalTrueRector.php │ │ │ ├── SimplifyConditionsRector.php │ │ │ └── StrlenZeroToIdenticalEmptyStringRector.php │ │ ├── If_ │ │ │ ├── CombineIfRector.php │ │ │ ├── CompleteMissingIfElseBracketRector.php │ │ │ ├── ConsecutiveNullCompareReturnsToNullCoalesceQueueRector.php │ │ │ ├── ExplicitBoolCompareRector.php │ │ │ ├── ShortenElseIfRector.php │ │ │ ├── SimplifyIfElseToTernaryRector.php │ │ │ ├── SimplifyIfNotNullReturnRector.php │ │ │ ├── SimplifyIfNullableReturnRector.php │ │ │ └── SimplifyIfReturnBoolRector.php │ │ ├── Include_ │ │ │ └── AbsolutizeRequireAndIncludePathRector.php │ │ ├── Isset_ │ │ │ └── IssetOnPropertyObjectToPropertyExistsRector.php │ │ ├── LogicalAnd │ │ │ ├── AndAssignsToSeparateLinesRector.php │ │ │ └── LogicalToBooleanRector.php │ │ ├── New_ │ │ │ └── NewStaticToNewSelfRector.php │ │ ├── NotEqual │ │ │ └── CommonNotEqualRector.php │ │ ├── NullsafeMethodCall │ │ │ └── CleanupUnneededNullsafeOperatorRector.php │ │ ├── Switch_ │ │ │ ├── SingularSwitchToIfRector.php │ │ │ └── SwitchTrueToIfRector.php │ │ └── Ternary │ │ │ ├── ArrayKeyExistsTernaryThenValueToCoalescingRector.php │ │ │ ├── NumberCompareToMaxFuncCallRector.php │ │ │ ├── SimplifyTautologyTernaryRector.php │ │ │ ├── SwitchNegatedTernaryRector.php │ │ │ ├── TernaryEmptyArrayArrayDimFetchToCoalesceRector.php │ │ │ └── UnnecessaryTernaryExpressionRector.php │ ├── TypeResolver │ │ ├── ArrayDimFetchTypeResolver.php │ │ └── AssignVariableTypeResolver.php │ └── ValueObject │ │ └── KeyAndExpr.php ├── CodingStyle │ ├── Application │ │ ├── UseImportsAdder.php │ │ └── UseImportsRemover.php │ ├── ClassNameImport │ │ ├── AliasUsesResolver.php │ │ ├── ClassNameImportSkipVoter │ │ │ ├── AliasClassNameImportSkipVoter.php │ │ │ ├── ClassLikeNameClassNameImportSkipVoter.php │ │ │ ├── FullyQualifiedNameClassNameImportSkipVoter.php │ │ │ ├── ReservedClassNameImportSkipVoter.php │ │ │ └── UsesClassNameImportSkipVoter.php │ │ ├── ClassNameImportSkipper.php │ │ ├── ShortNameResolver.php │ │ ├── UseImportsTraverser.php │ │ ├── UsedImportsResolver.php │ │ └── ValueObject │ │ │ └── UsedImports.php │ ├── Contract │ │ └── ClassNameImport │ │ │ └── ClassNameImportSkipVoterInterface.php │ ├── Guard │ │ └── StaticGuard.php │ ├── Naming │ │ └── ClassNaming.php │ ├── Node │ │ └── NameImporter.php │ ├── NodeAnalyzer │ │ └── UseImportNameMatcher.php │ ├── NodeFactory │ │ └── ArrayCallableToMethodCallFactory.php │ ├── Rector │ │ ├── ArrowFunction │ │ │ └── StaticArrowFunctionRector.php │ │ ├── Assign │ │ │ └── SplitDoubleAssignRector.php │ │ ├── Catch_ │ │ │ └── CatchExceptionNameMatchingTypeRector.php │ │ ├── ClassConst │ │ │ ├── RemoveFinalFromConstRector.php │ │ │ └── SplitGroupedClassConstantsRector.php │ │ ├── ClassMethod │ │ │ ├── FuncGetArgsToVariadicParamRector.php │ │ │ ├── MakeInheritedMethodVisibilitySameAsParentRector.php │ │ │ └── NewlineBeforeNewAssignSetRector.php │ │ ├── Closure │ │ │ └── StaticClosureRector.php │ │ ├── Encapsed │ │ │ ├── EncapsedStringsToSprintfRector.php │ │ │ └── WrapEncapsedVariableInCurlyBracesRector.php │ │ ├── Enum_ │ │ │ └── EnumCaseToPascalCaseRector.php │ │ ├── Foreach_ │ │ │ └── MultiDimensionalArrayToArrayDestructRector.php │ │ ├── FuncCall │ │ │ ├── ArraySpreadInsteadOfArrayMergeRector.php │ │ │ ├── CallUserFuncArrayToVariadicRector.php │ │ │ ├── CallUserFuncToMethodCallRector.php │ │ │ ├── ConsistentImplodeRector.php │ │ │ ├── CountArrayToEmptyArrayComparisonRector.php │ │ │ ├── FunctionFirstClassCallableRector.php │ │ │ ├── StrictArraySearchRector.php │ │ │ └── VersionCompareFuncCallToConstantRector.php │ │ ├── FunctionLike │ │ │ └── FunctionLikeToFirstClassCallableRector.php │ │ ├── If_ │ │ │ └── NullableCompareToNullRector.php │ │ ├── PostInc │ │ │ └── PostIncDecToPreIncDecRector.php │ │ ├── Property │ │ │ └── SplitGroupedPropertiesRector.php │ │ ├── Stmt │ │ │ ├── NewlineAfterStatementRector.php │ │ │ └── RemoveUselessAliasInUseStatementRector.php │ │ ├── String_ │ │ │ ├── SymplifyQuoteEscapeRector.php │ │ │ └── UseClassKeywordForClassNameResolutionRector.php │ │ ├── Ternary │ │ │ └── TernaryConditionVariableAssignmentRector.php │ │ └── Use_ │ │ │ └── SeparateMultiUseImportsRector.php │ ├── Reflection │ │ └── VendorLocationDetector.php │ └── ValueObject │ │ └── ObjectMagicMethods.php ├── DeadCode │ ├── ConditionEvaluator.php │ ├── ConditionResolver.php │ ├── Contract │ │ └── ConditionInterface.php │ ├── NodeAnalyzer │ │ ├── CallCollectionAnalyzer.php │ │ ├── ExprUsedInNodeAnalyzer.php │ │ ├── IsClassMethodUsedAnalyzer.php │ │ ├── PropertyWriteonlyAnalyzer.php │ │ ├── SafeLeftTypeBooleanAndOrAnalyzer.php │ │ └── UsedVariableNameAnalyzer.php │ ├── NodeCollector │ │ └── UnusedParameterResolver.php │ ├── NodeManipulator │ │ ├── ClassMethodParamRemover.php │ │ ├── ControllerClassMethodManipulator.php │ │ ├── CountManipulator.php │ │ ├── LivingCodeManipulator.php │ │ └── VariadicFunctionLikeDetector.php │ ├── PhpDoc │ │ ├── DeadParamTagValueNodeAnalyzer.php │ │ ├── DeadReturnTagValueNodeAnalyzer.php │ │ ├── DeadVarTagValueNodeAnalyzer.php │ │ ├── Guard │ │ │ ├── StandaloneTypeRemovalGuard.php │ │ │ └── TemplateTypeRemovalGuard.php │ │ └── TagRemover │ │ │ ├── ParamTagRemover.php │ │ │ ├── ReturnTagRemover.php │ │ │ └── VarTagRemover.php │ ├── Rector │ │ ├── Array_ │ │ │ └── RemoveDuplicatedArrayKeyRector.php │ │ ├── Assign │ │ │ ├── RemoveDoubleAssignRector.php │ │ │ └── RemoveUnusedVariableAssignRector.php │ │ ├── Block │ │ │ └── ReplaceBlockToItsStmtsRector.php │ │ ├── BooleanAnd │ │ │ └── RemoveAndTrueRector.php │ │ ├── Cast │ │ │ └── RecastingRemovalRector.php │ │ ├── ClassConst │ │ │ └── RemoveUnusedPrivateClassConstantRector.php │ │ ├── ClassLike │ │ │ ├── RemoveAnnotationRector.php │ │ │ └── RemoveTypedPropertyNonMockDocblockRector.php │ │ ├── ClassMethod │ │ │ ├── RemoveArgumentFromDefaultParentCallRector.php │ │ │ ├── RemoveEmptyClassMethodRector.php │ │ │ ├── RemoveNullTagValueNodeRector.php │ │ │ ├── RemoveUnusedConstructorParamRector.php │ │ │ ├── RemoveUnusedPrivateMethodParameterRector.php │ │ │ ├── RemoveUnusedPrivateMethodRector.php │ │ │ ├── RemoveUnusedPromotedPropertyRector.php │ │ │ ├── RemoveUnusedPublicMethodParameterRector.php │ │ │ ├── RemoveUselessAssignFromPropertyPromotionRector.php │ │ │ ├── RemoveUselessParamTagRector.php │ │ │ ├── RemoveUselessReturnExprInConstructRector.php │ │ │ └── RemoveUselessReturnTagRector.php │ │ ├── Concat │ │ │ └── RemoveConcatAutocastRector.php │ │ ├── ConstFetch │ │ │ └── RemovePhpVersionIdCheckRector.php │ │ ├── Expression │ │ │ ├── RemoveDeadStmtRector.php │ │ │ └── SimplifyMirrorAssignRector.php │ │ ├── For_ │ │ │ ├── RemoveDeadContinueRector.php │ │ │ ├── RemoveDeadIfForeachForRector.php │ │ │ └── RemoveDeadLoopRector.php │ │ ├── Foreach_ │ │ │ └── RemoveUnusedForeachKeyRector.php │ │ ├── FuncCall │ │ │ └── RemoveFilterVarOnExactTypeRector.php │ │ ├── FunctionLike │ │ │ └── RemoveDeadReturnRector.php │ │ ├── If_ │ │ │ ├── ReduceAlwaysFalseIfOrRector.php │ │ │ ├── RemoveAlwaysTrueIfConditionRector.php │ │ │ ├── RemoveDeadInstanceOfRector.php │ │ │ ├── RemoveTypedPropertyDeadInstanceOfRector.php │ │ │ ├── RemoveUnusedNonEmptyArrayBeforeForeachRector.php │ │ │ ├── SimplifyIfElseWithSameContentRector.php │ │ │ └── UnwrapFutureCompatibleIfPhpVersionRector.php │ │ ├── Node │ │ │ └── RemoveNonExistingVarAnnotationRector.php │ │ ├── Plus │ │ │ └── RemoveDeadZeroAndOneOperationRector.php │ │ ├── Property │ │ │ ├── RemoveUnusedPrivatePropertyRector.php │ │ │ ├── RemoveUselessReadOnlyTagRector.php │ │ │ └── RemoveUselessVarTagRector.php │ │ ├── PropertyProperty │ │ │ └── RemoveNullPropertyInitializationRector.php │ │ ├── Return_ │ │ │ └── RemoveDeadConditionAboveReturnRector.php │ │ ├── StaticCall │ │ │ └── RemoveParentCallWithoutParentRector.php │ │ ├── Stmt │ │ │ └── RemoveUnreachableStatementRector.php │ │ ├── Switch_ │ │ │ └── RemoveDuplicatedCaseInSwitchRector.php │ │ ├── Ternary │ │ │ └── TernaryToBooleanOrFalseToBooleanAndRector.php │ │ └── TryCatch │ │ │ ├── RemoveDeadCatchRector.php │ │ │ └── RemoveDeadTryCatchRector.php │ ├── SideEffect │ │ ├── PureFunctionDetector.php │ │ └── SideEffectNodeDetector.php │ ├── TypeNodeAnalyzer │ │ ├── GenericTypeNodeAnalyzer.php │ │ └── MixedArrayTypeNodeAnalyzer.php │ ├── UselessIfCondBeforeForeachDetector.php │ └── ValueObject │ │ ├── BinaryToVersionCompareCondition.php │ │ └── VersionCompareCondition.php ├── EarlyReturn │ ├── NodeTransformer │ │ └── ConditionInverter.php │ ├── Rector │ │ ├── Foreach_ │ │ │ └── ChangeNestedForeachIfsToEarlyContinueRector.php │ │ ├── If_ │ │ │ ├── ChangeIfElseValueAssignToEarlyReturnRector.php │ │ │ ├── ChangeNestedIfsToEarlyReturnRector.php │ │ │ ├── ChangeOrIfContinueToMultiContinueRector.php │ │ │ └── RemoveAlwaysElseRector.php │ │ ├── Return_ │ │ │ ├── PreparedValueToEarlyReturnRector.php │ │ │ └── ReturnBinaryOrToEarlyReturnRector.php │ │ └── StmtsAwareInterface │ │ │ └── ReturnEarlyIfVariableRector.php │ └── ValueObject │ │ └── BareSingleAssignIf.php ├── Instanceof_ │ └── Rector │ │ └── Ternary │ │ └── FlipNegatedTernaryInstanceofRector.php ├── Naming │ ├── ExpectedNameResolver │ │ ├── InflectorSingularResolver.php │ │ ├── MatchParamTypeExpectedNameResolver.php │ │ └── MatchPropertyTypeExpectedNameResolver.php │ ├── Guard │ │ ├── BreakingVariableRenameGuard.php │ │ ├── DateTimeAtNamingConventionGuard.php │ │ ├── HasMagicGetSetGuard.php │ │ └── PropertyConflictingNameGuard │ │ │ └── MatchPropertyTypeConflictingNameGuard.php │ ├── Matcher │ │ ├── CallMatcher.php │ │ ├── ForeachMatcher.php │ │ └── VariableAndCallAssignMatcher.php │ ├── Naming │ │ ├── AliasNameResolver.php │ │ ├── ConflictingNameResolver.php │ │ ├── ExpectedNameResolver.php │ │ ├── OverriddenExistingNamesResolver.php │ │ ├── PropertyNaming.php │ │ ├── UseImportsResolver.php │ │ └── VariableNaming.php │ ├── NamingConvention │ │ └── NamingConventionAnalyzer.php │ ├── ParamRenamer │ │ └── ParamRenamer.php │ ├── PhpArray │ │ └── ArrayFilter.php │ ├── PhpDoc │ │ └── VarTagValueNodeRenamer.php │ ├── PropertyRenamer │ │ ├── MatchTypePropertyRenamer.php │ │ ├── PropertyFetchRenamer.php │ │ └── PropertyPromotionRenamer.php │ ├── Rector │ │ ├── Assign │ │ │ └── RenameVariableToMatchMethodCallReturnTypeRector.php │ │ ├── ClassMethod │ │ │ ├── RenameParamToMatchTypeRector.php │ │ │ └── RenameVariableToMatchNewTypeRector.php │ │ ├── Class_ │ │ │ └── RenamePropertyToMatchTypeRector.php │ │ └── Foreach_ │ │ │ ├── RenameForeachValueVariableToMatchExprVariableRector.php │ │ │ └── RenameForeachValueVariableToMatchMethodCallReturnTypeRector.php │ ├── RectorNamingInflector.php │ ├── RenameGuard │ │ └── PropertyRenameGuard.php │ ├── ValueObject │ │ ├── ExpectedName.php │ │ ├── ParamRename.php │ │ ├── PropertyRename.php │ │ ├── VariableAndCallAssign.php │ │ └── VariableAndCallForeach.php │ ├── ValueObjectFactory │ │ ├── ParamRenameFactory.php │ │ └── PropertyRenameFactory.php │ └── VariableRenamer.php ├── NetteUtils │ └── Rector │ │ └── StaticCall │ │ └── UtilsJsonStaticCallNamedArgRector.php ├── Php52 │ └── Rector │ │ ├── Property │ │ └── VarToPublicPropertyRector.php │ │ └── Switch_ │ │ └── ContinueToBreakInSwitchRector.php ├── Php53 │ └── Rector │ │ ├── FuncCall │ │ └── DirNameFileConstantToDirConstantRector.php │ │ ├── Ternary │ │ └── TernaryToElvisRector.php │ │ └── Variable │ │ └── ReplaceHttpServerVarsByServerRector.php ├── Php54 │ └── Rector │ │ ├── Array_ │ │ └── LongArrayToShortArrayRector.php │ │ ├── Break_ │ │ └── RemoveZeroBreakContinueRector.php │ │ └── FuncCall │ │ └── RemoveReferenceFromCallRector.php ├── Php55 │ ├── Rector │ │ ├── ClassConstFetch │ │ │ └── StaticToSelfOnFinalClassRector.php │ │ ├── Class_ │ │ │ └── ClassConstantToSelfClassRector.php │ │ ├── FuncCall │ │ │ ├── GetCalledClassToSelfClassRector.php │ │ │ ├── GetCalledClassToStaticClassRector.php │ │ │ └── PregReplaceEModifierRector.php │ │ └── String_ │ │ │ └── StringClassNameToClassConstantRector.php │ └── RegexMatcher.php ├── Php56 │ └── Rector │ │ └── FuncCall │ │ └── PowToExpRector.php ├── Php70 │ ├── Enum │ │ └── BattleshipCompareOrder.php │ ├── EregToPcreTransformer.php │ ├── Exception │ │ └── InvalidEregException.php │ ├── NodeAnalyzer │ │ ├── BattleshipTernaryAnalyzer.php │ │ └── Php4ConstructorClassMethodAnalyzer.php │ ├── Rector │ │ ├── Assign │ │ │ ├── ListSplitStringRector.php │ │ │ └── ListSwapArrayOrderRector.php │ │ ├── Break_ │ │ │ └── BreakNotInLoopOrSwitchToReturnRector.php │ │ ├── ClassMethod │ │ │ └── Php4ConstructorRector.php │ │ ├── FuncCall │ │ │ ├── CallUserMethodRector.php │ │ │ ├── EregToPregMatchRector.php │ │ │ ├── MultiDirnameRector.php │ │ │ ├── RandomFunctionRector.php │ │ │ └── RenameMktimeWithoutArgsToTimeRector.php │ │ ├── FunctionLike │ │ │ └── ExceptionHandlerTypehintRector.php │ │ ├── If_ │ │ │ └── IfToSpaceshipRector.php │ │ ├── List_ │ │ │ └── EmptyListRector.php │ │ ├── MethodCall │ │ │ └── ThisCallOnStaticMethodToStaticCallRector.php │ │ ├── StaticCall │ │ │ └── StaticCallOnNonStaticToInstanceCallRector.php │ │ ├── StmtsAwareInterface │ │ │ └── IfIssetToCoalescingRector.php │ │ ├── Switch_ │ │ │ └── ReduceMultipleDefaultSwitchRector.php │ │ ├── Ternary │ │ │ ├── TernaryToNullCoalescingRector.php │ │ │ └── TernaryToSpaceshipRector.php │ │ └── Variable │ │ │ └── WrapVariableVariableNameInCurlyBracesRector.php │ └── ValueObject │ │ └── ComparedExprs.php ├── Php71 │ ├── IsArrayAndDualCheckToAble.php │ ├── Rector │ │ ├── Assign │ │ │ └── AssignArrayToStringRector.php │ │ ├── BinaryOp │ │ │ └── BinaryOpBetweenNumberAndStringRector.php │ │ ├── BooleanOr │ │ │ └── IsIterableRector.php │ │ ├── FuncCall │ │ │ └── RemoveExtraParametersRector.php │ │ ├── List_ │ │ │ └── ListToArrayDestructRector.php │ │ └── TryCatch │ │ │ └── MultiExceptionCatchRector.php │ └── ValueObject │ │ └── TwoNodeMatch.php ├── Php72 │ ├── NodeFactory │ │ └── AnonymousFunctionFactory.php │ ├── Rector │ │ ├── Assign │ │ │ ├── ListEachRector.php │ │ │ └── ReplaceEachAssignmentWithKeyCurrentRector.php │ │ ├── FuncCall │ │ │ ├── CreateFunctionToAnonymousFunctionRector.php │ │ │ ├── GetClassOnNullRector.php │ │ │ ├── ParseStrWithResultArgumentRector.php │ │ │ ├── StringifyDefineRector.php │ │ │ └── StringsAssertNakedRector.php │ │ ├── Unset_ │ │ │ └── UnsetCastRector.php │ │ └── While_ │ │ │ └── WhileEachToForeachRector.php │ └── ValueObject │ │ └── ListAndEach.php ├── Php73 │ └── Rector │ │ ├── BooleanOr │ │ └── IsCountableRector.php │ │ ├── ConstFetch │ │ └── SensitiveConstantNameRector.php │ │ ├── FuncCall │ │ ├── ArrayKeyFirstLastRector.php │ │ ├── JsonThrowOnErrorRector.php │ │ ├── RegexDashEscapeRector.php │ │ ├── SensitiveDefineRector.php │ │ ├── SetCookieRector.php │ │ └── StringifyStrNeedlesRector.php │ │ └── String_ │ │ └── SensitiveHereNowDocRector.php ├── Php74 │ ├── Guard │ │ ├── MakePropertyTypedGuard.php │ │ └── PropertyTypeChangeGuard.php │ ├── NodeAnalyzer │ │ └── ClosureArrowFunctionAnalyzer.php │ ├── Rector │ │ ├── ArrayDimFetch │ │ │ └── CurlyToSquareBracketArrayStringRector.php │ │ ├── Assign │ │ │ └── NullCoalescingOperatorRector.php │ │ ├── Closure │ │ │ └── ClosureToArrowFunctionRector.php │ │ ├── Double │ │ │ └── RealToFloatTypeCastRector.php │ │ ├── FuncCall │ │ │ ├── ArrayKeyExistsOnPropertyRector.php │ │ │ ├── FilterVarToAddSlashesRector.php │ │ │ ├── HebrevcToNl2brHebrevRector.php │ │ │ ├── MbStrrposEncodingArgumentPositionRector.php │ │ │ ├── MoneyFormatToNumberFormatRector.php │ │ │ └── RestoreIncludePathToIniRestoreRector.php │ │ ├── LNumber │ │ │ └── AddLiteralSeparatorToNumberRector.php │ │ ├── Property │ │ │ └── RestoreDefaultNullToNullableTypePropertyRector.php │ │ ├── StaticCall │ │ │ └── ExportToReflectionFunctionRector.php │ │ └── Ternary │ │ │ └── ParenthesizeNestedTernaryRector.php │ └── Tokenizer │ │ └── ParenthesizedNestedTernaryAnalyzer.php ├── Php80 │ ├── AttributeDecorator │ │ ├── DoctrineConverterAttributeDecorator.php │ │ └── SensioParamConverterAttributeDecorator.php │ ├── Contract │ │ ├── ConverterAttributeDecoratorInterface.php │ │ ├── StrStartWithMatchAndRefactorInterface.php │ │ └── ValueObject │ │ │ └── AnnotationToAttributeInterface.php │ ├── DocBlock │ │ └── PropertyPromotionDocBlockMerger.php │ ├── Enum │ │ └── MatchKind.php │ ├── Guard │ │ └── MakePropertyPromotionGuard.php │ ├── MatchAndRefactor │ │ └── StrStartsWithMatchAndRefactor │ │ │ ├── StrncmpMatchAndRefactor.php │ │ │ ├── StrposMatchAndRefactor.php │ │ │ └── SubstrMatchAndRefactor.php │ ├── NodeAnalyzer │ │ ├── MatchSwitchAnalyzer.php │ │ ├── PhpAttributeAnalyzer.php │ │ ├── PromotedPropertyCandidateResolver.php │ │ ├── PromotedPropertyResolver.php │ │ └── SwitchAnalyzer.php │ ├── NodeFactory │ │ ├── AttrGroupsFactory.php │ │ ├── MatchArmsFactory.php │ │ ├── MatchFactory.php │ │ ├── NestedAttrGroupsFactory.php │ │ └── StrStartsWithFuncCallFactory.php │ ├── NodeManipulator │ │ └── AttributeGroupNamedArgumentManipulator.php │ ├── NodeResolver │ │ ├── ArgumentSorter.php │ │ ├── RequireOptionalParamResolver.php │ │ └── SwitchExprsResolver.php │ ├── Rector │ │ ├── Catch_ │ │ │ └── RemoveUnusedVariableInCatchRector.php │ │ ├── ClassConstFetch │ │ │ └── ClassOnThisVariableObjectRector.php │ │ ├── ClassMethod │ │ │ ├── AddParamBasedOnParentClassMethodRector.php │ │ │ ├── FinalPrivateToPrivateVisibilityRector.php │ │ │ └── SetStateToStaticRector.php │ │ ├── Class_ │ │ │ ├── AnnotationToAttributeRector.php │ │ │ ├── AttributeValueResolver.php │ │ │ ├── ClassPropertyAssignToConstructorPromotionRector.php │ │ │ └── StringableForToStringRector.php │ │ ├── FuncCall │ │ │ └── ClassOnObjectRector.php │ │ ├── FunctionLike │ │ │ └── MixedTypeRector.php │ │ ├── Identical │ │ │ ├── StrEndsWithRector.php │ │ │ └── StrStartsWithRector.php │ │ ├── NotIdentical │ │ │ └── StrContainsRector.php │ │ ├── Property │ │ │ └── NestedAnnotationToAttributeRector.php │ │ ├── Switch_ │ │ │ └── ChangeSwitchToMatchRector.php │ │ └── Ternary │ │ │ └── GetDebugTypeRector.php │ ├── ValueObject │ │ ├── AnnotationPropertyToAttributeClass.php │ │ ├── AnnotationToAttribute.php │ │ ├── AttributeValueAndDocComment.php │ │ ├── CondAndExpr.php │ │ ├── DoctrineTagAndAnnotationToAttribute.php │ │ ├── MatchResult.php │ │ ├── NestedAnnotationToAttribute.php │ │ ├── NestedDoctrineTagAndAnnotationToAttribute.php │ │ ├── PropertyPromotionCandidate.php │ │ └── StrStartsWith.php │ └── ValueObjectFactory │ │ └── StrStartsWithFactory.php ├── Php81 │ ├── Enum │ │ ├── AttributeName.php │ │ └── NameNullToStrictNullFunctionMap.php │ ├── NodeAnalyzer │ │ ├── CoalescePropertyAssignMatcher.php │ │ └── ComplexNewAnalyzer.php │ ├── NodeFactory │ │ └── EnumFactory.php │ ├── NodeManipulator │ │ └── AttributeGroupNewLiner.php │ └── Rector │ │ ├── Array_ │ │ └── FirstClassCallableRector.php │ │ ├── ClassMethod │ │ └── NewInInitializerRector.php │ │ ├── Class_ │ │ ├── MyCLabsClassToEnumRector.php │ │ └── SpatieEnumClassToEnumRector.php │ │ ├── FuncCall │ │ └── NullToStrictStringFuncCallArgRector.php │ │ ├── MethodCall │ │ ├── MyCLabsMethodCallToEnumConstRector.php │ │ └── SpatieEnumMethodCallToEnumConstRector.php │ │ ├── New_ │ │ └── MyCLabsConstructorCallToEnumFromRector.php │ │ └── Property │ │ └── ReadOnlyPropertyRector.php ├── Php82 │ ├── NodeManipulator │ │ └── ReadonlyClassManipulator.php │ └── Rector │ │ ├── Class_ │ │ └── ReadOnlyClassRector.php │ │ ├── Encapsed │ │ └── VariableInStringInterpolationFixerRector.php │ │ ├── FuncCall │ │ └── Utf8DecodeEncodeToMbConvertEncodingRector.php │ │ ├── New_ │ │ └── FilesystemIteratorSkipDotsRector.php │ │ └── Param │ │ └── AddSensitiveParameterAttributeRector.php ├── Php83 │ └── Rector │ │ ├── ClassConst │ │ └── AddTypeToConstRector.php │ │ ├── ClassMethod │ │ └── AddOverrideAttributeToOverriddenMethodsRector.php │ │ ├── Class_ │ │ └── ReadOnlyAnonymousClassRector.php │ │ └── FuncCall │ │ ├── CombineHostPortLdapUriRector.php │ │ ├── DynamicClassConstFetchRector.php │ │ └── RemoveGetClassGetParentClassNoArgsRector.php ├── Php84 │ └── Rector │ │ ├── Class_ │ │ └── DeprecatedAnnotationToDeprecatedAttributeRector.php │ │ ├── FuncCall │ │ ├── AddEscapeArgumentRector.php │ │ └── RoundingModeEnumRector.php │ │ ├── MethodCall │ │ └── NewMethodCallWithoutParenthesesRector.php │ │ └── Param │ │ └── ExplicitNullableParamTypeRector.php ├── Php85 │ └── Rector │ │ └── ArrayDimFetch │ │ └── ArrayFirstLastRector.php ├── Privatization │ ├── Guard │ │ ├── OverrideByParentClassGuard.php │ │ └── ParentPropertyLookupGuard.php │ ├── NodeManipulator │ │ └── VisibilityManipulator.php │ ├── Rector │ │ ├── ClassMethod │ │ │ └── PrivatizeFinalClassMethodRector.php │ │ ├── Class_ │ │ │ └── FinalizeTestCaseClassRector.php │ │ ├── MethodCall │ │ │ └── PrivatizeLocalGetterToPropertyRector.php │ │ └── Property │ │ │ └── PrivatizeFinalClassPropertyRector.php │ ├── TypeManipulator │ │ └── TypeNormalizer.php │ └── VisibilityGuard │ │ └── ClassMethodVisibilityGuard.php ├── Removing │ ├── NodeManipulator │ │ └── ComplexNodeRemover.php │ ├── Rector │ │ ├── ClassMethod │ │ │ └── ArgumentRemoverRector.php │ │ ├── Class_ │ │ │ ├── RemoveInterfacesRector.php │ │ │ └── RemoveTraitUseRector.php │ │ └── FuncCall │ │ │ ├── RemoveFuncCallArgRector.php │ │ │ └── RemoveFuncCallRector.php │ └── ValueObject │ │ ├── ArgumentRemover.php │ │ └── RemoveFuncCallArg.php ├── Renaming │ ├── Collector │ │ └── RenamedNameCollector.php │ ├── Contract │ │ ├── MethodCallRenameInterface.php │ │ ├── RenameAnnotationInterface.php │ │ └── RenameClassConstFetchInterface.php │ ├── NodeManipulator │ │ ├── ClassRenamer.php │ │ └── SwitchManipulator.php │ ├── Rector │ │ ├── ClassConstFetch │ │ │ └── RenameClassConstFetchRector.php │ │ ├── ClassMethod │ │ │ └── RenameAnnotationRector.php │ │ ├── Class_ │ │ │ └── RenameAttributeRector.php │ │ ├── ConstFetch │ │ │ └── RenameConstantRector.php │ │ ├── FuncCall │ │ │ └── RenameFunctionRector.php │ │ ├── FunctionLike │ │ │ └── RenameFunctionLikeParamWithinCallLikeArgRector.php │ │ ├── MethodCall │ │ │ └── RenameMethodRector.php │ │ ├── Name │ │ │ └── RenameClassRector.php │ │ ├── PropertyFetch │ │ │ └── RenamePropertyRector.php │ │ ├── StaticCall │ │ │ └── RenameStaticMethodRector.php │ │ └── String_ │ │ │ └── RenameStringRector.php │ └── ValueObject │ │ ├── MethodCallRename.php │ │ ├── MethodCallRenameWithArrayKey.php │ │ ├── RenameAnnotation.php │ │ ├── RenameAnnotationByType.php │ │ ├── RenameAttribute.php │ │ ├── RenameClassAndConstFetch.php │ │ ├── RenameClassConstFetch.php │ │ ├── RenameFunctionLikeParamWithinCallLikeArg.php │ │ ├── RenameProperty.php │ │ └── RenameStaticMethod.php ├── Strict │ ├── NodeAnalyzer │ │ └── UninitializedPropertyAnalyzer.php │ ├── NodeFactory │ │ └── ExactCompareFactory.php │ └── Rector │ │ ├── AbstractFalsyScalarRuleFixerRector.php │ │ ├── BooleanNot │ │ └── BooleanInBooleanNotRuleFixerRector.php │ │ ├── Empty_ │ │ └── DisallowedEmptyRuleFixerRector.php │ │ ├── If_ │ │ └── BooleanInIfConditionRuleFixerRector.php │ │ └── Ternary │ │ ├── BooleanInTernaryOperatorRuleFixerRector.php │ │ └── DisallowedShortTernaryRuleFixerRector.php ├── Transform │ ├── NodeAnalyzer │ │ └── FuncCallStaticCallToMethodCallAnalyzer.php │ ├── NodeFactory │ │ └── PropertyFetchFactory.php │ ├── NodeTypeAnalyzer │ │ └── TypeProvidingExprFromClassResolver.php │ ├── Rector │ │ ├── ArrayDimFetch │ │ │ └── ArrayDimFetchToMethodCallRector.php │ │ ├── Assign │ │ │ ├── PropertyAssignToMethodCallRector.php │ │ │ └── PropertyFetchToMethodCallRector.php │ │ ├── Attribute │ │ │ └── AttributeKeyToClassConstFetchRector.php │ │ ├── ClassMethod │ │ │ ├── ReturnTypeWillChangeRector.php │ │ │ └── WrapReturnRector.php │ │ ├── Class_ │ │ │ ├── AddAllowDynamicPropertiesAttributeRector.php │ │ │ ├── AddInterfaceByTraitRector.php │ │ │ ├── MergeInterfacesRector.php │ │ │ └── ParentClassToTraitsRector.php │ │ ├── ConstFetch │ │ │ └── ConstFetchToClassConstFetchRector.php │ │ ├── FileWithoutNamespace │ │ │ └── RectorConfigBuilderRector.php │ │ ├── FuncCall │ │ │ ├── FuncCallToConstFetchRector.php │ │ │ ├── FuncCallToMethodCallRector.php │ │ │ ├── FuncCallToNewRector.php │ │ │ └── FuncCallToStaticCallRector.php │ │ ├── MethodCall │ │ │ ├── MethodCallToFuncCallRector.php │ │ │ ├── MethodCallToNewRector.php │ │ │ ├── MethodCallToPropertyFetchRector.php │ │ │ ├── MethodCallToStaticCallRector.php │ │ │ └── ReplaceParentCallByPropertyCallRector.php │ │ ├── New_ │ │ │ └── NewToStaticCallRector.php │ │ ├── Scalar │ │ │ └── ScalarValueToConstFetchRector.php │ │ ├── StaticCall │ │ │ ├── StaticCallToFuncCallRector.php │ │ │ ├── StaticCallToMethodCallRector.php │ │ │ └── StaticCallToNewRector.php │ │ └── String_ │ │ │ └── StringToClassConstantRector.php │ └── ValueObject │ │ ├── ArrayDimFetchToMethodCall.php │ │ ├── AttributeKeyToClassConstFetch.php │ │ ├── ClassMethodReference.php │ │ ├── ConstFetchToClassConstFetch.php │ │ ├── FuncCallToMethodCall.php │ │ ├── FuncCallToStaticCall.php │ │ ├── MethodCallToFuncCall.php │ │ ├── MethodCallToNew.php │ │ ├── MethodCallToPropertyFetch.php │ │ ├── MethodCallToStaticCall.php │ │ ├── NewToStaticCall.php │ │ ├── ParentClassToTraits.php │ │ ├── PropertyAssignToMethodCall.php │ │ ├── PropertyFetchToMethodCall.php │ │ ├── ReplaceParentCallByPropertyCall.php │ │ ├── ScalarValueToConstFetch.php │ │ ├── StaticCallToFuncCall.php │ │ ├── StaticCallToMethodCall.php │ │ ├── StaticCallToNew.php │ │ ├── StringToClassConstant.php │ │ └── WrapReturn.php ├── TypeDeclaration │ ├── AlreadyAssignDetector │ │ ├── ConstructorAssignDetector.php │ │ ├── NullTypeAssignDetector.php │ │ └── PropertyDefaultAssignDetector.php │ ├── FunctionLikeReturnTypeResolver.php │ ├── Guard │ │ ├── ParamTypeAddGuard.php │ │ └── PropertyTypeOverrideGuard.php │ ├── Matcher │ │ └── PropertyAssignMatcher.php │ ├── NodeAnalyzer │ │ ├── AutowiredClassMethodOrPropertyAnalyzer.php │ │ ├── CallTypesResolver.php │ │ ├── CallerParamMatcher.php │ │ ├── ClassMethodAndPropertyAnalyzer.php │ │ ├── ClassMethodParamTypeCompleter.php │ │ ├── DeclareStrictTypeFinder.php │ │ ├── NeverFuncCallAnalyzer.php │ │ ├── ParamAnalyzer.php │ │ ├── ReturnAnalyzer.php │ │ ├── ReturnFilter │ │ │ └── ExclusiveNativeCallLikeReturnMatcher.php │ │ ├── ReturnTypeAnalyzer │ │ │ ├── StrictNativeFunctionReturnTypeAnalyzer.php │ │ │ └── StrictReturnNewAnalyzer.php │ │ └── TypeNodeUnwrapper.php │ ├── NodeManipulator │ │ ├── AddNeverReturnType.php │ │ ├── AddReturnTypeFromCast.php │ │ ├── AddReturnTypeFromParam.php │ │ ├── AddReturnTypeFromStrictNativeCall.php │ │ └── AddUnionReturnType.php │ ├── NodeTypeAnalyzer │ │ ├── DetailedTypeAnalyzer.php │ │ └── PropertyTypeDecorator.php │ ├── PHPStan │ │ └── ObjectTypeSpecifier.php │ ├── PhpDocParser │ │ ├── ParamPhpDocNodeFactory.php │ │ └── TypeExpressionFromVarTagResolver.php │ ├── Rector │ │ ├── ArrowFunction │ │ │ └── AddArrowFunctionReturnTypeRector.php │ │ ├── BooleanAnd │ │ │ └── BinaryOpNullableToInstanceofRector.php │ │ ├── ClassMethod │ │ │ ├── AddMethodCallBasedStrictParamTypeRector.php │ │ │ ├── AddParamArrayDocblockBasedOnCallableNativeFuncCallRector.php │ │ │ ├── AddParamTypeBasedOnPHPUnitDataProviderRector.php │ │ │ ├── AddParamTypeDeclarationRector.php │ │ │ ├── AddParamTypeFromPropertyTypeRector.php │ │ │ ├── AddReturnArrayDocblockBasedOnArrayMapRector.php │ │ │ ├── AddReturnTypeDeclarationBasedOnParentClassMethodRector.php │ │ │ ├── AddReturnTypeDeclarationRector.php │ │ │ ├── AddTypeFromResourceDocblockRector.php │ │ │ ├── AddVoidReturnTypeWhereNoReturnRector.php │ │ │ ├── BoolReturnTypeFromBooleanConstReturnsRector.php │ │ │ ├── BoolReturnTypeFromBooleanStrictReturnsRector.php │ │ │ ├── NumericReturnTypeFromStrictReturnsRector.php │ │ │ ├── NumericReturnTypeFromStrictScalarReturnsRector.php │ │ │ ├── ParamTypeByMethodCallTypeRector.php │ │ │ ├── ParamTypeByParentCallTypeRector.php │ │ │ ├── ReturnNeverTypeRector.php │ │ │ ├── ReturnNullableTypeRector.php │ │ │ ├── ReturnTypeFromMockObjectRector.php │ │ │ ├── ReturnTypeFromReturnCastRector.php │ │ │ ├── ReturnTypeFromReturnDirectArrayRector.php │ │ │ ├── ReturnTypeFromReturnNewRector.php │ │ │ ├── ReturnTypeFromStrictConstantReturnRector.php │ │ │ ├── ReturnTypeFromStrictFluentReturnRector.php │ │ │ ├── ReturnTypeFromStrictNativeCallRector.php │ │ │ ├── ReturnTypeFromStrictNewArrayRector.php │ │ │ ├── ReturnTypeFromStrictParamRector.php │ │ │ ├── ReturnTypeFromStrictTypedCallRector.php │ │ │ ├── ReturnTypeFromStrictTypedPropertyRector.php │ │ │ ├── ReturnTypeFromSymfonySerializerRector.php │ │ │ ├── ReturnUnionTypeRector.php │ │ │ ├── StrictArrayParamDimFetchRector.php │ │ │ ├── StrictStringParamConcatRector.php │ │ │ ├── StringReturnTypeFromStrictScalarReturnsRector.php │ │ │ └── StringReturnTypeFromStrictStringReturnsRector.php │ │ ├── Class_ │ │ │ ├── AddTestsVoidReturnTypeWhereNoReturnRector.php │ │ │ ├── ChildDoctrineRepositoryClassTypeRector.php │ │ │ ├── MergeDateTimePropertyTypeDeclarationRector.php │ │ │ ├── PropertyTypeFromStrictSetterGetterRector.php │ │ │ ├── ReturnTypeFromStrictTernaryRector.php │ │ │ ├── TypedPropertyFromCreateMockAssignRector.php │ │ │ └── TypedPropertyFromJMSSerializerAttributeTypeRector.php │ │ ├── Closure │ │ │ ├── AddClosureNeverReturnTypeRector.php │ │ │ ├── AddClosureVoidReturnTypeWhereNoReturnRector.php │ │ │ └── ClosureReturnTypeRector.php │ │ ├── Empty_ │ │ │ └── EmptyOnNullableObjectToInstanceOfRector.php │ │ ├── Expression │ │ │ └── InlineVarDocTagToAssertRector.php │ │ ├── FuncCall │ │ │ └── AddArrowFunctionParamArrayWhereDimFetchRector.php │ │ ├── FunctionLike │ │ │ ├── AddClosureParamTypeForArrayMapRector.php │ │ │ ├── AddClosureParamTypeForArrayReduceRector.php │ │ │ ├── AddClosureParamTypeFromArgRector.php │ │ │ ├── AddClosureParamTypeFromIterableMethodCallRector.php │ │ │ ├── AddClosureParamTypeFromObjectRector.php │ │ │ ├── AddParamTypeForFunctionLikeWithinCallLikeArgDeclarationRector.php │ │ │ ├── AddParamTypeSplFixedArrayRector.php │ │ │ └── AddReturnTypeDeclarationFromYieldsRector.php │ │ ├── Function_ │ │ │ └── AddFunctionVoidReturnTypeWhereNoReturnRector.php │ │ ├── Property │ │ │ ├── AddPropertyTypeDeclarationRector.php │ │ │ ├── TypedPropertyFromAssignsRector.php │ │ │ ├── TypedPropertyFromStrictConstructorRector.php │ │ │ └── TypedPropertyFromStrictSetUpRector.php │ │ ├── StmtsAwareInterface │ │ │ ├── DeclareStrictTypesRector.php │ │ │ └── IncreaseDeclareStrictTypesRector.php │ │ └── While_ │ │ │ └── WhileNullableToInstanceofRector.php │ ├── TypeAnalyzer │ │ ├── GenericClassStringTypeNormalizer.php │ │ ├── NullableTypeAnalyzer.php │ │ ├── PropertyTypeDefaultValueAnalyzer.php │ │ └── ReturnStrictTypeAnalyzer.php │ ├── TypeInferer │ │ ├── AssignToPropertyTypeInferer.php │ │ ├── PropertyTypeInferer │ │ │ ├── AllAssignNodePropertyTypeInferer.php │ │ │ ├── GetterTypeDeclarationPropertyTypeInferer.php │ │ │ ├── SetterTypeDeclarationPropertyTypeInferer.php │ │ │ └── TrustedClassMethodPropertyTypeInferer.php │ │ ├── ReturnTypeInferer.php │ │ ├── ReturnTypeInferer │ │ │ └── ReturnedNodesReturnTypeInfererTypeInferer.php │ │ ├── SilentVoidResolver.php │ │ └── SplArrayFixedTypeNarrower.php │ └── ValueObject │ │ ├── AddClosureParamTypeFromArg.php │ │ ├── AddClosureParamTypeFromObject.php │ │ ├── AddParamTypeDeclaration.php │ │ ├── AddParamTypeForFunctionLikeWithinCallLikeArgDeclaration.php │ │ ├── AddPropertyTypeDeclaration.php │ │ ├── AddReturnTypeDeclaration.php │ │ ├── AssignToVariable.php │ │ └── DataProviderNodes.php └── Visibility │ ├── Rector │ ├── ClassConst │ │ └── ChangeConstantVisibilityRector.php │ └── ClassMethod │ │ ├── ChangeMethodVisibilityRector.php │ │ └── ExplicitPublicClassMethodRector.php │ └── ValueObject │ ├── ChangeConstantVisibility.php │ └── ChangeMethodVisibility.php ├── scoper.php ├── src ├── Application │ ├── ApplicationFileProcessor.php │ ├── ChangedNodeScopeRefresher.php │ ├── FileProcessor.php │ ├── NodeAttributeReIndexer.php │ ├── Provider │ │ └── CurrentFileProvider.php │ └── VersionResolver.php ├── Autoloading │ ├── AdditionalAutoloader.php │ └── BootstrapFilesIncluder.php ├── BetterPhpDocParser │ ├── Annotation │ │ └── AnnotationNaming.php │ ├── Attributes │ │ └── AttributeMirrorer.php │ ├── Comment │ │ └── CommentsMerger.php │ ├── Contract │ │ ├── BasePhpDocNodeVisitorInterface.php │ │ └── PhpDocParser │ │ │ └── PhpDocNodeDecoratorInterface.php │ ├── DataProvider │ │ └── CurrentTokenIteratorProvider.php │ ├── Guard │ │ └── NewPhpDocFromPHPStanTypeGuard.php │ ├── PhpDoc │ │ ├── ArrayItemNode.php │ │ ├── DoctrineAnnotationTagValueNode.php │ │ ├── SpacelessPhpDocTagNode.php │ │ └── StringNode.php │ ├── PhpDocInfo │ │ ├── PhpDocInfo.php │ │ ├── PhpDocInfoFactory.php │ │ └── TokenIteratorFactory.php │ ├── PhpDocManipulator │ │ ├── PhpDocClassRenamer.php │ │ ├── PhpDocTagRemover.php │ │ └── PhpDocTypeChanger.php │ ├── PhpDocNodeFinder │ │ └── PhpDocNodeByTypeFinder.php │ ├── PhpDocNodeMapper.php │ ├── PhpDocNodeVisitor │ │ ├── ArrayTypePhpDocNodeVisitor.php │ │ ├── CallableTypePhpDocNodeVisitor.php │ │ ├── ChangedPhpDocNodeVisitor.php │ │ ├── IntersectionTypeNodePhpDocNodeVisitor.php │ │ ├── TemplatePhpDocNodeVisitor.php │ │ └── UnionTypeNodePhpDocNodeVisitor.php │ ├── PhpDocParser │ │ ├── ArrayItemClassNameDecorator.php │ │ ├── BetterPhpDocParser.php │ │ ├── ClassAnnotationMatcher.php │ │ ├── ConstExprClassNameDecorator.php │ │ ├── DoctrineAnnotationDecorator.php │ │ ├── StaticDoctrineAnnotationParser.php │ │ └── StaticDoctrineAnnotationParser │ │ │ ├── ArrayParser.php │ │ │ └── PlainValueParser.php │ ├── Printer │ │ ├── DocBlockInliner.php │ │ ├── EmptyPhpDocDetector.php │ │ ├── PhpDocInfoPrinter.php │ │ └── RemoveNodesStartAndEndResolver.php │ └── ValueObject │ │ ├── DoctrineAnnotation │ │ └── SilentKeyMap.php │ │ ├── NodeTypes.php │ │ ├── Parser │ │ └── BetterTokenIterator.php │ │ ├── PhpDoc │ │ ├── DoctrineAnnotation │ │ │ ├── AbstractValuesAwareNode.php │ │ │ └── CurlyListNode.php │ │ └── SpacingAwareTemplateTagValueNode.php │ │ ├── PhpDocAttributeKey.php │ │ ├── StartAndEnd.php │ │ └── Type │ │ ├── BracketsAwareIntersectionTypeNode.php │ │ ├── BracketsAwareUnionTypeNode.php │ │ ├── FullyQualifiedIdentifierTypeNode.php │ │ ├── ShortenedIdentifierTypeNode.php │ │ ├── SpacingAwareArrayTypeNode.php │ │ └── SpacingAwareCallableTypeNode.php ├── Bootstrap │ ├── ExtensionConfigResolver.php │ └── RectorConfigsResolver.php ├── Bridge │ ├── SetProviderCollector.php │ └── SetRectorsResolver.php ├── Caching │ ├── Cache.php │ ├── CacheFactory.php │ ├── Config │ │ └── FileHashComputer.php │ ├── Contract │ │ └── ValueObject │ │ │ └── Storage │ │ │ └── CacheStorageInterface.php │ ├── Detector │ │ └── ChangedFilesDetector.php │ ├── Enum │ │ └── CacheKey.php │ ├── UnchangedFilesFilter.php │ └── ValueObject │ │ ├── CacheFilePaths.php │ │ ├── CacheItem.php │ │ └── Storage │ │ ├── FileCacheStorage.php │ │ └── MemoryCacheStorage.php ├── ChangesReporting │ ├── Contract │ │ └── Output │ │ │ └── OutputFormatterInterface.php │ ├── Output │ │ ├── ConsoleOutputFormatter.php │ │ ├── GitHubOutputFormatter.php │ │ ├── GitlabOutputFormatter.php │ │ ├── JUnitOutputFormatter.php │ │ └── JsonOutputFormatter.php │ ├── ValueObject │ │ └── RectorWithLineChange.php │ └── ValueObjectFactory │ │ ├── ErrorFactory.php │ │ └── FileDiffFactory.php ├── Comments │ ├── CommentRemover.php │ ├── NodeDocBlock │ │ └── DocBlockUpdater.php │ ├── NodeTraverser │ │ └── CommentRemovingNodeTraverser.php │ └── NodeVisitor │ │ └── CommentRemovingNodeVisitor.php ├── Composer │ ├── InstalledPackageResolver.php │ └── ValueObject │ │ └── InstalledPackage.php ├── Config │ ├── Level │ │ ├── CodeQualityLevel.php │ │ ├── CodingStyleLevel.php │ │ ├── DeadCodeLevel.php │ │ └── TypeDeclarationLevel.php │ ├── RectorConfig.php │ └── RegisteredService.php ├── Configuration │ ├── ConfigInitializer.php │ ├── ConfigurationFactory.php │ ├── ConfigurationRuleFilter.php │ ├── Deprecation │ │ └── Contract │ │ │ └── DeprecatedInterface.php │ ├── Levels │ │ └── LevelRulesResolver.php │ ├── OnlyRuleResolver.php │ ├── Option.php │ ├── Parameter │ │ └── SimpleParameterProvider.php │ ├── PhpLevelSetResolver.php │ ├── RectorConfigBuilder.php │ ├── RenamedClassesDataCollector.php │ └── VendorMissAnalyseGuard.php ├── Console │ ├── Command │ │ ├── CustomRuleCommand.php │ │ ├── ListRulesCommand.php │ │ ├── ProcessCommand.php │ │ ├── SetupCICommand.php │ │ └── WorkerCommand.php │ ├── ConsoleApplication.php │ ├── ExitCode.php │ ├── Formatter │ │ ├── ColorConsoleDiffFormatter.php │ │ └── ConsoleDiffer.php │ ├── Notifier.php │ ├── Output │ │ └── OutputFormatterCollector.php │ ├── ProcessConfigureDecorator.php │ └── Style │ │ ├── RectorStyle.php │ │ └── SymfonyStyleFactory.php ├── Contract │ ├── DependencyInjection │ │ ├── RelatedConfigInterface.php │ │ └── ResetableInterface.php │ ├── PhpParser │ │ └── Node │ │ │ └── StmtsAwareInterface.php │ └── Rector │ │ ├── ConfigurableRectorInterface.php │ │ ├── HTMLAverseRectorInterface.php │ │ └── RectorInterface.php ├── CustomRules │ └── SimpleNodeDumper.php ├── DependencyInjection │ ├── Laravel │ │ └── ContainerMemento.php │ ├── LazyContainerFactory.php │ └── RectorContainerFactory.php ├── Differ │ └── DefaultDiffer.php ├── Enum │ ├── ClassName.php │ ├── Config │ │ └── Defaults.php │ └── ObjectReference.php ├── Exception │ ├── Cache │ │ └── CachingException.php │ ├── Configuration │ │ ├── InvalidConfigurationException.php │ │ ├── RectorRuleNameAmbiguousException.php │ │ └── RectorRuleNotFoundException.php │ ├── NotImplementedYetException.php │ ├── Reflection │ │ └── MissingPrivatePropertyException.php │ ├── ShouldNotHappenException.php │ └── VersionException.php ├── FamilyTree │ ├── NodeAnalyzer │ │ └── ClassChildAnalyzer.php │ └── Reflection │ │ └── FamilyRelationsAnalyzer.php ├── FileSystem │ ├── FileAndDirectoryFilter.php │ ├── FilePathHelper.php │ ├── FilesFinder.php │ ├── FilesystemTweaker.php │ ├── InitFilePathsResolver.php │ └── JsonFileSystem.php ├── Git │ └── RepositoryHelper.php ├── NodeAnalyzer │ ├── ArgsAnalyzer.php │ ├── BinaryOpAnalyzer.php │ ├── CallAnalyzer.php │ ├── ClassAnalyzer.php │ ├── CompactFuncCallAnalyzer.php │ ├── ConstFetchAnalyzer.php │ ├── DoctrineEntityAnalyzer.php │ ├── ExprAnalyzer.php │ ├── MagicClassMethodAnalyzer.php │ ├── ParamAnalyzer.php │ ├── PropertyAnalyzer.php │ ├── PropertyFetchAnalyzer.php │ ├── PropertyPresenceChecker.php │ ├── ScopeAnalyzer.php │ ├── TerminatedNodeAnalyzer.php │ ├── VariableAnalyzer.php │ └── VariadicAnalyzer.php ├── NodeCollector │ ├── BinaryOpConditionsCollector.php │ ├── NodeAnalyzer │ │ └── ArrayCallableMethodMatcher.php │ ├── ScopeResolver │ │ └── ParentClassScopeResolver.php │ ├── StaticAnalyzer.php │ └── ValueObject │ │ ├── ArrayCallable.php │ │ └── ArrayCallableDynamicMethod.php ├── NodeDecorator │ ├── CreatedByRuleDecorator.php │ ├── PropertyTypeDecorator.php │ └── StatementDepthAttributeDecorator.php ├── NodeManipulator │ ├── AssignManipulator.php │ ├── BinaryOpManipulator.php │ ├── ClassConstManipulator.php │ ├── ClassDependencyManipulator.php │ ├── ClassInsertManipulator.php │ ├── ClassManipulator.php │ ├── ClassMethodAssignManipulator.php │ ├── ClassMethodManipulator.php │ ├── ClassMethodPropertyFetchManipulator.php │ ├── FuncCallManipulator.php │ ├── FunctionLikeManipulator.php │ ├── IfManipulator.php │ ├── PropertyFetchAssignManipulator.php │ ├── PropertyManipulator.php │ └── StmtsManipulator.php ├── NodeNameResolver │ ├── Contract │ │ └── NodeNameResolverInterface.php │ ├── NodeNameResolver.php │ ├── NodeNameResolver │ │ ├── ClassConstFetchNameResolver.php │ │ ├── ClassConstNameResolver.php │ │ ├── ClassNameResolver.php │ │ ├── FuncCallNameResolver.php │ │ ├── FunctionNameResolver.php │ │ ├── NameNameResolver.php │ │ ├── ParamNameResolver.php │ │ ├── PropertyNameResolver.php │ │ ├── UseNameResolver.php │ │ └── VariableNameResolver.php │ └── Regex │ │ └── RegexPatternDetector.php ├── NodeNestingScope │ ├── ContextAnalyzer.php │ └── ValueObject │ │ └── ControlStructure.php ├── NodeTypeResolver │ ├── Contract │ │ ├── NodeTypeResolverAwareInterface.php │ │ └── NodeTypeResolverInterface.php │ ├── DependencyInjection │ │ └── PHPStanServicesFactory.php │ ├── Node │ │ └── AttributeKey.php │ ├── NodeScopeAndMetadataDecorator.php │ ├── NodeTypeCorrector │ │ ├── AccessoryNonEmptyStringTypeCorrector.php │ │ └── GenericClassStringTypeCorrector.php │ ├── NodeTypeResolver.php │ ├── NodeTypeResolver │ │ ├── CastTypeResolver.php │ │ ├── ClassAndInterfaceTypeResolver.php │ │ ├── ClassConstFetchTypeResolver.php │ │ ├── IdentifierTypeResolver.php │ │ ├── NameTypeResolver.php │ │ ├── NewTypeResolver.php │ │ ├── ParamTypeResolver.php │ │ ├── PropertyFetchTypeResolver.php │ │ ├── PropertyTypeResolver.php │ │ ├── ScalarTypeResolver.php │ │ ├── StaticCallMethodCallTypeResolver.php │ │ └── TraitTypeResolver.php │ ├── PHPStan │ │ ├── ObjectWithoutClassTypeWithParentTypes.php │ │ ├── ParametersAcceptorSelectorVariantsWrapper.php │ │ ├── Scope │ │ │ ├── Contract │ │ │ │ └── NodeVisitor │ │ │ │ │ └── ScopeResolverNodeVisitorInterface.php │ │ │ ├── NodeVisitor │ │ │ │ ├── ArgNodeVisitor.php │ │ │ │ ├── AssignedToNodeVisitor.php │ │ │ │ ├── ByRefReturnNodeVisitor.php │ │ │ │ ├── ByRefVariableNodeVisitor.php │ │ │ │ ├── ContextNodeVisitor.php │ │ │ │ ├── GlobalVariableNodeVisitor.php │ │ │ │ ├── NameNodeVisitor.php │ │ │ │ ├── StaticVariableNodeVisitor.php │ │ │ │ └── StmtKeyNodeVisitor.php │ │ │ ├── PHPStanNodeScopeResolver.php │ │ │ ├── RectorNodeScopeResolver.php │ │ │ └── ScopeFactory.php │ │ ├── Type │ │ │ ├── StaticTypeAnalyzer.php │ │ │ └── TypeFactory.php │ │ └── TypeHasher.php │ ├── PhpDoc │ │ └── NodeAnalyzer │ │ │ ├── DocBlockClassRenamer.php │ │ │ ├── DocBlockNameImporter.php │ │ │ └── DocBlockTagReplacer.php │ ├── PhpDocNodeVisitor │ │ ├── ClassRenamePhpDocNodeVisitor.php │ │ └── NameImportingPhpDocNodeVisitor.php │ ├── Reflection │ │ └── BetterReflection │ │ │ ├── RectorBetterReflectionSourceLocatorFactory.php │ │ │ ├── SourceLocator │ │ │ └── IntermediateSourceLocator.php │ │ │ └── SourceLocatorProvider │ │ │ └── DynamicSourceLocatorProvider.php │ ├── TypeAnalyzer │ │ ├── ArrayTypeAnalyzer.php │ │ └── StringTypeAnalyzer.php │ ├── TypeComparator │ │ ├── ArrayTypeComparator.php │ │ ├── ScalarTypeComparator.php │ │ └── TypeComparator.php │ └── ValueObject │ │ └── OldToNewType.php ├── PHPStan │ └── ScopeFetcher.php ├── PHPStanStaticTypeMapper │ ├── Contract │ │ └── TypeMapperInterface.php │ ├── DoctrineTypeAnalyzer.php │ ├── Enum │ │ └── TypeKind.php │ ├── PHPStanStaticTypeMapper.php │ ├── TypeAnalyzer │ │ └── UnionTypeAnalyzer.php │ ├── TypeMapper │ │ ├── AccessoryLiteralStringTypeMapper.php │ │ ├── AccessoryNonEmptyStringTypeMapper.php │ │ ├── AccessoryNonFalsyStringTypeMapper.php │ │ ├── AccessoryNumericStringTypeMapper.php │ │ ├── ArrayTypeMapper.php │ │ ├── BooleanTypeMapper.php │ │ ├── CallableTypeMapper.php │ │ ├── ClassStringTypeMapper.php │ │ ├── ClosureTypeMapper.php │ │ ├── ConditionalTypeForParameterMapper.php │ │ ├── ConditionalTypeMapper.php │ │ ├── ConstantArrayTypeMapper.php │ │ ├── FloatTypeMapper.php │ │ ├── GenericClassStringTypeMapper.php │ │ ├── HasMethodTypeMapper.php │ │ ├── HasOffsetTypeMapper.php │ │ ├── HasOffsetValueTypeTypeMapper.php │ │ ├── HasPropertyTypeMapper.php │ │ ├── IntegerTypeMapper.php │ │ ├── IntersectionTypeMapper.php │ │ ├── IterableTypeMapper.php │ │ ├── MixedTypeMapper.php │ │ ├── NeverTypeMapper.php │ │ ├── NonEmptyArrayTypeMapper.php │ │ ├── NullTypeMapper.php │ │ ├── ObjectTypeMapper.php │ │ ├── ObjectWithoutClassTypeMapper.php │ │ ├── OversizedArrayTypeMapper.php │ │ ├── ParentStaticTypeMapper.php │ │ ├── ResourceTypeMapper.php │ │ ├── SelfObjectTypeMapper.php │ │ ├── StaticTypeMapper.php │ │ ├── StrictMixedTypeMapper.php │ │ ├── StringTypeMapper.php │ │ ├── ThisTypeMapper.php │ │ ├── TypeWithClassNameTypeMapper.php │ │ ├── UnionTypeMapper.php │ │ └── VoidTypeMapper.php │ └── Utils │ │ └── TypeUnwrapper.php ├── Parallel │ ├── Application │ │ └── ParallelFileProcessor.php │ ├── Command │ │ └── WorkerCommandLineFactory.php │ └── ValueObject │ │ ├── Bridge.php │ │ └── BridgeItem.php ├── Php │ ├── PhpVersionProvider.php │ ├── PhpVersionResolver │ │ └── ComposerJsonPhpVersionResolver.php │ ├── PolyfillPackagesProvider.php │ └── ReservedKeywordAnalyzer.php ├── PhpAttribute │ ├── AnnotationToAttributeMapper.php │ ├── AnnotationToAttributeMapper │ │ ├── ArrayAnnotationToAttributeMapper.php │ │ ├── ArrayItemNodeAnnotationToAttributeMapper.php │ │ ├── ClassConstFetchAnnotationToAttributeMapper.php │ │ ├── ConstExprNodeAnnotationToAttributeMapper.php │ │ ├── CurlyListNodeAnnotationToAttributeMapper.php │ │ ├── DoctrineAnnotationAnnotationToAttributeMapper.php │ │ ├── StringAnnotationToAttributeMapper.php │ │ └── StringNodeAnnotationToAttributeMapper.php │ ├── AttributeArrayNameInliner.php │ ├── Contract │ │ └── AnnotationToAttributeMapperInterface.php │ ├── Enum │ │ └── DocTagNodeState.php │ ├── NodeFactory │ │ ├── AnnotationToAttributeIntegerValueCaster.php │ │ ├── AttributeNameFactory.php │ │ ├── NamedArgsFactory.php │ │ ├── PhpAttributeGroupFactory.php │ │ └── PhpNestedAttributeGroupFactory.php │ ├── UseAliasNameMatcher.php │ └── ValueObject │ │ └── UseAliasMetadata.php ├── PhpDocParser │ ├── NodeTraverser │ │ └── SimpleCallableNodeTraverser.php │ ├── NodeVisitor │ │ └── CallableNodeVisitor.php │ ├── PhpDocParser │ │ ├── Contract │ │ │ └── PhpDocNodeVisitorInterface.php │ │ ├── Exception │ │ │ └── InvalidTraverseException.php │ │ ├── PhpDocNodeTraverser.php │ │ ├── PhpDocNodeVisitor │ │ │ ├── AbstractPhpDocNodeVisitor.php │ │ │ ├── CallablePhpDocNodeVisitor.php │ │ │ ├── CloningPhpDocNodeVisitor.php │ │ │ └── ParentConnectingPhpDocNodeVisitor.php │ │ └── ValueObject │ │ │ └── PhpDocAttributeKey.php │ └── ValueObject │ │ └── AttributeKey.php ├── PhpParser │ ├── AstResolver.php │ ├── Comparing │ │ └── NodeComparator.php │ ├── Node │ │ ├── AssignAndBinaryMap.php │ │ ├── BetterNodeFinder.php │ │ ├── CustomNode │ │ │ └── FileWithoutNamespace.php │ │ ├── NodeFactory.php │ │ └── Value │ │ │ └── ValueResolver.php │ ├── NodeFinder │ │ ├── LocalMethodCallFinder.php │ │ └── PropertyFetchFinder.php │ ├── NodeTransformer.php │ ├── NodeTraverser │ │ ├── FileWithoutNamespaceNodeTraverser.php │ │ └── RectorNodeTraverser.php │ ├── Parser │ │ ├── InlineCodeParser.php │ │ ├── ParserErrors.php │ │ ├── RectorParser.php │ │ └── SimplePhpParser.php │ ├── Printer │ │ └── BetterStandardPrinter.php │ └── ValueObject │ │ └── StmtsAndTokens.php ├── PostRector │ ├── Application │ │ └── PostFileProcessor.php │ ├── Collector │ │ └── UseNodesToAddCollector.php │ ├── Contract │ │ └── Rector │ │ │ └── PostRectorInterface.php │ ├── Guard │ │ └── AddUseStatementGuard.php │ ├── Rector │ │ ├── AbstractPostRector.php │ │ ├── ClassRenamingPostRector.php │ │ ├── DocblockNameImportingPostRector.php │ │ ├── NameImportingPostRector.php │ │ ├── UnusedImportRemovingPostRector.php │ │ └── UseAddingPostRector.php │ └── ValueObject │ │ └── PropertyMetadata.php ├── ProcessAnalyzer │ └── RectifiedAnalyzer.php ├── Rector │ └── AbstractRector.php ├── Reflection │ ├── ClassModifierChecker.php │ ├── ClassReflectionAnalyzer.php │ ├── MethodReflectionResolver.php │ └── ReflectionResolver.php ├── Reporting │ ├── DeprecatedRulesReporter.php │ └── MissConfigurationReporter.php ├── Set │ ├── Contract │ │ ├── SetInterface.php │ │ └── SetProviderInterface.php │ ├── Enum │ │ └── SetGroup.php │ ├── SetManager.php │ ├── SetProvider │ │ ├── CoreSetProvider.php │ │ └── PHPSetProvider.php │ └── ValueObject │ │ ├── ComposerTriggeredSet.php │ │ ├── LevelSetList.php │ │ ├── Set.php │ │ └── SetList.php ├── Skipper │ ├── FileSystem │ │ ├── FnMatchPathNormalizer.php │ │ └── PathNormalizer.php │ ├── Fnmatcher.php │ ├── Matcher │ │ └── FileInfoMatcher.php │ ├── RealpathMatcher.php │ ├── SkipCriteriaResolver │ │ ├── SkippedClassResolver.php │ │ └── SkippedPathsResolver.php │ ├── SkipVoter │ │ └── ClassSkipVoter.php │ └── Skipper │ │ ├── PathSkipper.php │ │ ├── SkipSkipper.php │ │ └── Skipper.php ├── StaticReflection │ └── DynamicSourceLocatorDecorator.php ├── StaticTypeMapper │ ├── Contract │ │ ├── PhpDocParser │ │ │ └── PhpDocTypeMapperInterface.php │ │ └── PhpParser │ │ │ └── PhpParserNodeMapperInterface.php │ ├── Mapper │ │ ├── PhpParserNodeMapper.php │ │ └── ScalarStringToTypeMapper.php │ ├── Naming │ │ └── NameScopeFactory.php │ ├── PhpDoc │ │ └── PhpDocTypeMapper.php │ ├── PhpDocParser │ │ ├── IdentifierPhpDocTypeMapper.php │ │ ├── IntersectionPhpDocTypeMapper.php │ │ ├── NullablePhpDocTypeMapper.php │ │ └── UnionPhpDocTypeMapper.php │ ├── PhpParser │ │ ├── ExprNodeMapper.php │ │ ├── FullyQualifiedNodeMapper.php │ │ ├── IdentifierNodeMapper.php │ │ ├── IntersectionTypeNodeMapper.php │ │ ├── NameNodeMapper.php │ │ ├── NullableTypeNodeMapper.php │ │ ├── StringNodeMapper.php │ │ └── UnionTypeNodeMapper.php │ ├── Resolver │ │ └── ClassNameFromObjectTypeResolver.php │ ├── StaticTypeMapper.php │ └── ValueObject │ │ └── Type │ │ ├── AliasedObjectType.php │ │ ├── FullyQualifiedGenericObjectType.php │ │ ├── FullyQualifiedObjectType.php │ │ ├── NonExistingObjectType.php │ │ ├── ParentObjectWithoutClassType.php │ │ ├── ParentStaticType.php │ │ ├── SelfObjectType.php │ │ ├── SelfStaticType.php │ │ ├── ShortenedGenericObjectType.php │ │ ├── ShortenedObjectType.php │ │ └── SimpleStaticType.php ├── Testing │ ├── Contract │ │ └── RectorTestInterface.php │ ├── Fixture │ │ ├── FixtureFileFinder.php │ │ ├── FixtureFileUpdater.php │ │ ├── FixtureSplitter.php │ │ └── FixtureTempFileDumper.php │ ├── PHPUnit │ │ ├── AbstractLazyTestCase.php │ │ ├── AbstractRectorTestCase.php │ │ ├── StaticPHPUnitEnvironment.php │ │ └── ValueObject │ │ │ └── RectorTestResult.php │ └── TestingParser │ │ └── TestingParser.php ├── Util │ ├── ArrayChecker.php │ ├── ArrayParametersMerger.php │ ├── FileHasher.php │ ├── MemoryLimiter.php │ ├── NewLineSplitter.php │ ├── NodePrinter.php │ ├── PhpVersionFactory.php │ ├── Reflection │ │ └── PrivatesAccessor.php │ └── StringUtils.php ├── Validation │ ├── RectorAssert.php │ └── RectorConfigValidator.php ├── ValueObject │ ├── Application │ │ └── File.php │ ├── Bootstrap │ │ └── BootstrapConfigs.php │ ├── Configuration.php │ ├── Configuration │ │ └── LevelOverflow.php │ ├── Error │ │ └── SystemError.php │ ├── FileProcessResult.php │ ├── FuncCallAndExpr.php │ ├── MethodName.php │ ├── PhpVersion.php │ ├── PhpVersionFeature.php │ ├── PolyfillPackage.php │ ├── ProcessResult.php │ ├── Reporting │ │ └── FileDiff.php │ ├── SprintfStringAndArgs.php │ └── Visibility.php ├── VendorLocker │ ├── Exception │ │ └── UnresolvableClassException.php │ ├── NodeVendorLocker │ │ ├── ClassMethodParamVendorLockResolver.php │ │ ├── ClassMethodReturnTypeOverrideGuard.php │ │ └── ClassMethodReturnVendorLockResolver.php │ └── ParentClassMethodTypeOverrideGuard.php ├── VersionBonding │ ├── Contract │ │ ├── MinPhpVersionInterface.php │ │ └── RelatedPolyfillInterface.php │ └── PhpVersionedFilter.php └── functions │ └── node_helper.php ├── stubs ├── Behat │ └── Step │ │ ├── Then.php │ │ └── When.php ├── Doctrine │ ├── Common │ │ └── Collections │ │ │ ├── ArrayCollection.php │ │ │ └── Collection.php │ ├── Nette │ │ └── Security │ │ │ └── User.php │ ├── ORM │ │ ├── EntityManager.php │ │ ├── EntityManagerInterface.php │ │ ├── EntityRepository.php │ │ ├── Mapping │ │ │ ├── Column.php │ │ │ ├── CustomIdGenerator.php │ │ │ ├── DiscriminatorMap.php │ │ │ ├── Embeddable.php │ │ │ ├── Entity.php │ │ │ ├── GeneratedValue.php │ │ │ ├── Id.php │ │ │ ├── Index.php │ │ │ ├── InverseJoinColumn.php │ │ │ ├── JoinColumn.php │ │ │ ├── JoinColumns.php │ │ │ ├── JoinTable.php │ │ │ ├── ManyToMany.php │ │ │ ├── ManyToOne.php │ │ │ ├── OrderBy.php │ │ │ ├── Table.php │ │ │ └── UniqueConstraint.php │ │ └── QueryBuilder.php │ └── Persistence │ │ ├── ManagerRegistry.php │ │ └── ObjectManager.php ├── Illuminate │ └── Support │ │ └── Collection.php ├── MyClabs │ └── Enum │ │ └── Enum.php ├── Php │ ├── BackedEnum.php │ └── UnitEnum.php ├── Ramsey │ └── Uuid │ │ ├── Uuid.php │ │ └── UuidInterface.php ├── Sensio │ └── Bundle │ │ └── FrameworkExtraBundle │ │ └── Configuration │ │ ├── IsGranted.php │ │ ├── ParamConverter.php │ │ └── Security.php ├── Spatie │ └── Enum │ │ └── Enum.php ├── Symfony │ ├── Bridge │ │ └── Doctrine │ │ │ └── Validator │ │ │ └── Constraints │ │ │ └── UniqueEntity.php │ ├── Bundle │ │ └── FrameworkBundle │ │ │ └── Controller │ │ │ └── Controller.php │ └── Component │ │ ├── DependencyInjection │ │ └── Argument │ │ │ └── RewindableGenerator.php │ │ ├── HttpFoundation │ │ ├── JsonResponse.php │ │ └── Response.php │ │ ├── Routing │ │ └── Annotation │ │ │ └── Route.php │ │ ├── Security │ │ └── Http │ │ │ └── Attribute │ │ │ └── IsGranted.php │ │ ├── Serializer │ │ └── Attribute │ │ │ └── Groups.php │ │ └── Validator │ │ └── Constraints │ │ ├── Choice.php │ │ ├── File.php │ │ └── Length.php └── Twig │ └── Extension │ ├── AbstractExtension.php │ └── ExtensionInterface.php ├── templates ├── custom-rule │ └── utils │ │ └── rector │ │ └── src │ │ └── Rector │ │ └── __Name__.php ├── rector-github-action-check.yaml ├── rector-gitlab-check.yaml └── rector.php.dist ├── tests-paths └── path │ ├── NoExtensionFile │ ├── wildcard-nested │ └── some_directory │ │ └── AnotherFile.php │ ├── wildcard-next │ └── some_directory │ │ └── YetAnotherFile.php │ └── with space │ └── SomeFile.php └── utils ├── Compiler └── Unprefixer.php ├── PHPStan └── Rule │ └── PreferDirectIsNameRule.php └── Rector └── MoveAbstractRectorToChildrenRector.php /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | indent_style = space 9 | indent_size = 4 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # make sure windows uses LF for files, which we expect to always use LF, no matter the platform 2 | *.yaml text eol=lf 3 | *.json text eol=lf 4 | *.xml text eol=lf 5 | *.md text eol=lf 6 | 7 | # testing Windows spaces - https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings 8 | tests/FileFormatter/ValueObject/Fixture/composer_carriage_return_line_feed.json json eol=crlf 9 | 10 | 11 | # for 3rd party packages working with rector/rector-src as dependency 12 | rules-tests export-ignore 13 | tests export-ignore 14 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: tomasvotruba 2 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - 5 | package-ecosystem: github-actions 6 | directory: "/" 7 | open-pull-requests-limit: 5 8 | schedule: 9 | interval: monthly 10 | -------------------------------------------------------------------------------- /.github/workflows/code_analysis_no_dev.yaml: -------------------------------------------------------------------------------- 1 | name: Code Analysis [no dev] 2 | 3 | on: 4 | pull_request: null 5 | 6 | env: 7 | # see https://github.com/composer/composer/issues/9368#issuecomment-718112361 8 | COMPOSER_ROOT_VERSION: "dev-main" 9 | 10 | jobs: 11 | code_analysis_no_dev: 12 | runs-on: ubuntu-latest 13 | timeout-minutes: 10 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | # see https://github.com/shivammathur/setup-php 18 | - uses: shivammathur/setup-php@v2 19 | with: 20 | php-version: 8.2 21 | coverage: none 22 | 23 | - run: | 24 | composer install --ansi 25 | composer install --no-progress --ansi --no-dev 26 | - run: bin/rector list --ansi 27 | -------------------------------------------------------------------------------- /.github/workflows/php_linter.yaml: -------------------------------------------------------------------------------- 1 | name: PHP Linter 2 | 3 | on: 4 | pull_request: null 5 | 6 | env: 7 | # see https://github.com/composer/composer/issues/9368#issuecomment-718112361 8 | COMPOSER_ROOT_VERSION: "dev-main" 9 | 10 | jobs: 11 | php_linter: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v4 16 | 17 | - 18 | uses: shivammathur/setup-php@v2 19 | with: 20 | php-version: 8.2 21 | coverage: none 22 | 23 | - run: composer require php-parallel-lint/php-parallel-lint --ansi 24 | - run: vendor/bin/parallel-lint src bin/rector config tests rules --colors 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | composer.lock 3 | 4 | # PHPStorm meta files 5 | .idea/ 6 | 7 | .phpunit.result.cache 8 | # since PHPUnit 10 9 | .phpunit.cache 10 | 11 | # scoped & downgraded version 12 | php-scoper.phar 13 | box.phar 14 | php-parallel-lint 15 | 16 | tmp 17 | 18 | # Allow overrides for Docker configuration (custom volumes, env variables etc) 19 | docker-compose.override.yml 20 | 21 | /temp_* 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:8.2-cli-alpine 2 | 3 | WORKDIR /etc/rector 4 | 5 | # required for composer patches 6 | RUN apk add --no-cache patch git 7 | 8 | COPY --from=composer:2 /usr/bin/composer /usr/bin/composer 9 | 10 | RUN mkdir -p /etc/rector 11 | RUN git config --global --add safe.directory /etc/rector 12 | -------------------------------------------------------------------------------- /bin/add-phpstan-self-replace.php: -------------------------------------------------------------------------------- 1 | $originalClassName 17 | * 18 | * @psalm-return MockObject&RealInstanceType 19 | */ 20 | protected function createMock(string $originalClassName): MockObject 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /config/phpstan/better-infer.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | inferPrivatePropertyTypeFromConstructor: true 3 | -------------------------------------------------------------------------------- /config/phpstan/static-reflection.neon: -------------------------------------------------------------------------------- 1 | services: 2 | - Rector\NodeTypeResolver\Reflection\BetterReflection\RectorBetterReflectionSourceLocatorFactory 3 | - Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocator\IntermediateSourceLocator 4 | - Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider 5 | 6 | # basically decorates native PHPStan source locator with a dynamic source locator that is also available in Rector DI 7 | betterReflectionSourceLocator: 8 | class: PHPStan\BetterReflection\SourceLocator\Type\SourceLocator 9 | factory: ['@Rector\NodeTypeResolver\Reflection\BetterReflection\RectorBetterReflectionSourceLocatorFactory', 'create'] 10 | autowired: false 11 | -------------------------------------------------------------------------------- /config/set/code-quality.php: -------------------------------------------------------------------------------- 1 | $configuration) { 10 | $rectorConfig->ruleWithConfiguration($rectorClass, $configuration); 11 | } 12 | 13 | // the rule order matters, as its used in withCodeQualityLevel() method 14 | // place the safest rules first, follow by more complex ones 15 | $rectorConfig->rules(CodeQualityLevel::RULES); 16 | }; 17 | -------------------------------------------------------------------------------- /config/set/coding-style.php: -------------------------------------------------------------------------------- 1 | $configuration) { 10 | $rectorConfig->ruleWithConfiguration($rectorClass, $configuration); 11 | } 12 | 13 | // the rule order matters, as its used in withCodingStyleLevel() method 14 | // place the safest rules first, follow by more complex ones 15 | $rectorConfig->rules(CodingStyleLevel::RULES); 16 | }; 17 | -------------------------------------------------------------------------------- /config/set/datetime-to-carbon.php: -------------------------------------------------------------------------------- 1 | rules([ 13 | DateFuncCallToCarbonRector::class, 14 | DateTimeInstanceToCarbonRector::class, 15 | DateTimeMethodCallToCarbonRector::class, 16 | TimeFuncCallToCarbonRector::class, 17 | ]); 18 | }; 19 | -------------------------------------------------------------------------------- /config/set/dead-code.php: -------------------------------------------------------------------------------- 1 | rules(DeadCodeLevel::RULES); 10 | }; 11 | -------------------------------------------------------------------------------- /config/set/level/up-to-php53.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_53, SetList::PHP_52]); 10 | }; 11 | -------------------------------------------------------------------------------- /config/set/level/up-to-php54.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_54, LevelSetList::UP_TO_PHP_53]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php55.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_55, LevelSetList::UP_TO_PHP_54]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php56.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_56, LevelSetList::UP_TO_PHP_55]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php70.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_70, LevelSetList::UP_TO_PHP_56]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php71.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_71, LevelSetList::UP_TO_PHP_70]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php72.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_72, LevelSetList::UP_TO_PHP_71]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php73.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_73, LevelSetList::UP_TO_PHP_72]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php74.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_74, LevelSetList::UP_TO_PHP_73]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php80.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_80, LevelSetList::UP_TO_PHP_74]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php81.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_81, LevelSetList::UP_TO_PHP_80]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php82.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_82, LevelSetList::UP_TO_PHP_81]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php83.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_83, LevelSetList::UP_TO_PHP_82]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php84.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_84, LevelSetList::UP_TO_PHP_83]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/level/up-to-php85.php: -------------------------------------------------------------------------------- 1 | sets([SetList::PHP_85, LevelSetList::UP_TO_PHP_84]); 11 | }; 12 | -------------------------------------------------------------------------------- /config/set/nette-utils/nette-utils4.php: -------------------------------------------------------------------------------- 1 | rules([UtilsJsonStaticCallNamedArgRector::class]); 10 | }; 11 | -------------------------------------------------------------------------------- /config/set/php52.php: -------------------------------------------------------------------------------- 1 | rules([VarToPublicPropertyRector::class, ContinueToBreakInSwitchRector::class]); 13 | 14 | $rectorConfig->ruleWithConfiguration(RemoveFuncCallArgRector::class, [ 15 | // see https://www.php.net/manual/en/function.ldap-first-attribute.php 16 | new RemoveFuncCallArg('ldap_first_attribute', 2), 17 | ]); 18 | }; 19 | -------------------------------------------------------------------------------- /config/set/php53.php: -------------------------------------------------------------------------------- 1 | rules([ 12 | TernaryToElvisRector::class, 13 | DirNameFileConstantToDirConstantRector::class, 14 | ReplaceHttpServerVarsByServerRector::class, 15 | ]); 16 | }; 17 | -------------------------------------------------------------------------------- /config/set/php54.php: -------------------------------------------------------------------------------- 1 | rules([ 13 | LongArrayToShortArrayRector::class, 14 | RemoveReferenceFromCallRector::class, 15 | RemoveZeroBreakContinueRector::class, 16 | ]); 17 | 18 | $rectorConfig 19 | ->ruleWithConfiguration(RenameFunctionRector::class, [ 20 | 'mysqli_param_count' => 'mysqli_stmt_param_count', 21 | ]); 22 | }; 23 | -------------------------------------------------------------------------------- /config/set/php71.php: -------------------------------------------------------------------------------- 1 | rules([ 15 | IsIterableRector::class, 16 | MultiExceptionCatchRector::class, 17 | AssignArrayToStringRector::class, 18 | RemoveExtraParametersRector::class, 19 | BinaryOpBetweenNumberAndStringRector::class, 20 | ListToArrayDestructRector::class, 21 | ]); 22 | }; 23 | -------------------------------------------------------------------------------- /config/set/php82.php: -------------------------------------------------------------------------------- 1 | rules([ 13 | ReadOnlyClassRector::class, 14 | Utf8DecodeEncodeToMbConvertEncodingRector::class, 15 | FilesystemIteratorSkipDotsRector::class, 16 | VariableInStringInterpolationFixerRector::class, 17 | ]); 18 | }; 19 | -------------------------------------------------------------------------------- /config/set/php84.php: -------------------------------------------------------------------------------- 1 | rules( 14 | [ 15 | ExplicitNullableParamTypeRector::class, 16 | RoundingModeEnumRector::class, 17 | AddEscapeArgumentRector::class, 18 | NewMethodCallWithoutParenthesesRector::class, 19 | DeprecatedAnnotationToDeprecatedAttributeRector::class, 20 | ] 21 | ); 22 | }; 23 | -------------------------------------------------------------------------------- /config/set/php85.php: -------------------------------------------------------------------------------- 1 | rules([ArrayFirstLastRector::class]); 10 | }; 11 | -------------------------------------------------------------------------------- /config/set/privatization.php: -------------------------------------------------------------------------------- 1 | rules([ 12 | PrivatizeLocalGetterToPropertyRector::class, 13 | PrivatizeFinalClassPropertyRector::class, 14 | PrivatizeFinalClassMethodRector::class, 15 | ]); 16 | }; 17 | -------------------------------------------------------------------------------- /config/set/rector-preset.php: -------------------------------------------------------------------------------- 1 | rules([ 12 | DeclareStrictTypesRector::class, 13 | PostIncDecToPreIncDecRector::class, 14 | FinalizeTestCaseClassRector::class, 15 | ]); 16 | }; 17 | -------------------------------------------------------------------------------- /config/set/strict-booleans.php: -------------------------------------------------------------------------------- 1 | rules([ 14 | BooleanInBooleanNotRuleFixerRector::class, 15 | DisallowedEmptyRuleFixerRector::class, 16 | BooleanInIfConditionRuleFixerRector::class, 17 | BooleanInTernaryOperatorRuleFixerRector::class, 18 | DisallowedShortTernaryRuleFixerRector::class, 19 | ]); 20 | }; 21 | -------------------------------------------------------------------------------- /config/set/type-declaration.php: -------------------------------------------------------------------------------- 1 | rules(TypeDeclarationLevel::RULES); 12 | }; 13 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | php: 3 | build: . 4 | environment: 5 | - COMPOSER_ROOT_VERSION=dev-main 6 | volumes: 7 | - .:/etc/rector 8 | -------------------------------------------------------------------------------- /e2e/applied-polyfill-php80/.gitignore: -------------------------------------------------------------------------------- 1 | /vendor 2 | -------------------------------------------------------------------------------- /e2e/applied-polyfill-php80/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": "^8.1", 4 | "symfony/polyfill-php80": "*" 5 | }, 6 | "minimum-stability": "dev", 7 | "prefer-stable": true 8 | } 9 | -------------------------------------------------------------------------------- /e2e/applied-polyfill-php80/expected-output.diff: -------------------------------------------------------------------------------- 1 | 1 file with changes 2 | =================== 3 | 4 | 1) src/SomeStartWith.php:4 5 | 6 | ---------- begin diff ---------- 7 | @@ @@ 8 | { 9 | public function run($a) 10 | { 11 | - return strpos($a, 'a') === 0; 12 | + return str_starts_with($a, 'a'); 13 | } 14 | } 15 | ----------- end diff ----------- 16 | 17 | Applied rules: 18 | * StrStartsWithRector 19 | 20 | 21 | [OK] 1 file would have been changed (dry-run) by Rector 22 | -------------------------------------------------------------------------------- /e2e/applied-polyfill-php80/rector.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/src', 12 | ]); 13 | 14 | $rectorConfig->phpVersion(PhpVersion::PHP_74); 15 | $rectorConfig->rule(StrStartsWithRector::class); 16 | }; 17 | -------------------------------------------------------------------------------- /e2e/applied-polyfill-php80/src/SomeStartWith.php: -------------------------------------------------------------------------------- 1 | cacheClass(FileCacheStorage::class); 12 | 13 | $rectorConfig->paths([ 14 | __DIR__ . '/src', 15 | ]); 16 | 17 | $rectorConfig->rule(RemoveEmptyClassMethodRector::class); 18 | $rectorConfig->rule(RemoveAlwaysTrueIfConditionRector::class); 19 | }; 20 | -------------------------------------------------------------------------------- /e2e/applied-rule-removed-node-with-cache/src/AlwaysTrue.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/src', 12 | ]); 13 | 14 | $rectorConfig->rule(RemoveEmptyClassMethodRector::class); 15 | $rectorConfig->rule(RemoveAlwaysTrueIfConditionRector::class); 16 | }; 17 | -------------------------------------------------------------------------------- /e2e/applied-rule-removed-node/src/AlwaysTrue.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/src', 12 | ]); 13 | 14 | $rectorConfig->rules([ 15 | RemoveAlwaysElseRector::class, 16 | RemoveUnusedPrivateMethodRector::class, 17 | ]); 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /e2e/applied-rule-return-array-nodes/src/MultiRules.php: -------------------------------------------------------------------------------- 1 | paths([ 10 | __DIR__ . '/src', 11 | ]); 12 | 13 | $rectorConfig->skip([ 14 | RemoveEmptyClassMethodRector::class => [ 15 | __DIR__ . '/src/controllers', 16 | ], 17 | ]); 18 | 19 | $rectorConfig->rule(RemoveEmptyClassMethodRector::class); 20 | }; 21 | -------------------------------------------------------------------------------- /e2e/different-path-over-skip-config/src/controllers/DeadConstructor.php: -------------------------------------------------------------------------------- 1 | disableParallel(); 9 | 10 | $rectorConfig->paths([ 11 | __DIR__ . '/src/', // correct path 12 | __DIR__ . '/does-not-exist/' 13 | ]); 14 | }; 15 | -------------------------------------------------------------------------------- /e2e/invalid-paths/src/NamespacedSomeClassFound.php: -------------------------------------------------------------------------------- 1 | disableParallel(); 10 | 11 | $rectorConfig->paths([ 12 | __DIR__ . '/src/', 13 | ]); 14 | 15 | $rectorConfig->rule(RemoveUnusedPrivatePropertyRector::class); 16 | }; 17 | -------------------------------------------------------------------------------- /e2e/no-parallel-reflection-resolver/src/NamespacedSomeClassFound.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/../only-option/src', 12 | ]); 13 | 14 | $rectorConfig->rules([ 15 | RemoveAlwaysElseRector::class, 16 | RemoveUnusedPrivateMethodRector::class, 17 | ]); 18 | }; 19 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-bsdouble/cli-options.txt: -------------------------------------------------------------------------------- 1 | --only='Rector\\DeadCode\\Rector\\ClassMethod\\RemoveUnusedPrivateMethodRector' 2 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-bsdouble/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": "^8.1" 4 | }, 5 | "minimum-stability": "dev", 6 | "prefer-stable": true 7 | } 8 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-bsdouble/expected-output.diff: -------------------------------------------------------------------------------- 1 | 1 file with changes 2 | =================== 3 | 4 | 1) ../only-option/src/MultiRules.php:10 5 | 6 | ---------- begin diff ---------- 7 | @@ @@ 8 | echo 'a statement'; 9 | } 10 | } 11 | - 12 | - private function notUsed() 13 | - { 14 | - } 15 | } 16 | ----------- end diff ----------- 17 | 18 | Applied rules: 19 | * RemoveUnusedPrivateMethodRector 20 | 21 | 22 | [OK] 1 file would have been changed (dry-run) by Rector 23 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-bsdouble/rector.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/../only-option/src', 12 | ]); 13 | 14 | $rectorConfig->rules([ 15 | RemoveAlwaysElseRector::class, 16 | RemoveUnusedPrivateMethodRector::class, 17 | ]); 18 | }; 19 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-equalnone/cli-options.txt: -------------------------------------------------------------------------------- 1 | --only 'Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector' 2 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-equalnone/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": "^8.1" 4 | }, 5 | "minimum-stability": "dev", 6 | "prefer-stable": true 7 | } 8 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-equalnone/expected-output.diff: -------------------------------------------------------------------------------- 1 | 1 file with changes 2 | =================== 3 | 4 | 1) ../only-option/src/MultiRules.php:10 5 | 6 | ---------- begin diff ---------- 7 | @@ @@ 8 | echo 'a statement'; 9 | } 10 | } 11 | - 12 | - private function notUsed() 13 | - { 14 | - } 15 | } 16 | ----------- end diff ----------- 17 | 18 | Applied rules: 19 | * RemoveUnusedPrivateMethodRector 20 | 21 | 22 | [OK] 1 file would have been changed (dry-run) by Rector 23 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single-equalnone/rector.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/../only-option/src', 12 | ]); 13 | 14 | $rectorConfig->rules([ 15 | RemoveAlwaysElseRector::class, 16 | RemoveUnusedPrivateMethodRector::class, 17 | ]); 18 | }; 19 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single/cli-options.txt: -------------------------------------------------------------------------------- 1 | --only='Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector' 2 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": "^8.1" 4 | }, 5 | "minimum-stability": "dev", 6 | "prefer-stable": true 7 | } 8 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single/expected-output.diff: -------------------------------------------------------------------------------- 1 | 1 file with changes 2 | =================== 3 | 4 | 1) ../only-option/src/MultiRules.php:10 5 | 6 | ---------- begin diff ---------- 7 | @@ @@ 8 | echo 'a statement'; 9 | } 10 | } 11 | - 12 | - private function notUsed() 13 | - { 14 | - } 15 | } 16 | ----------- end diff ----------- 17 | 18 | Applied rules: 19 | * RemoveUnusedPrivateMethodRector 20 | 21 | 22 | [OK] 1 file would have been changed (dry-run) by Rector 23 | -------------------------------------------------------------------------------- /e2e/only-option-quote-single/rector.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/../only-option/src', 12 | ]); 13 | 14 | $rectorConfig->rules([ 15 | RemoveAlwaysElseRector::class, 16 | RemoveUnusedPrivateMethodRector::class, 17 | ]); 18 | }; 19 | -------------------------------------------------------------------------------- /e2e/only-option/cli-options.txt: -------------------------------------------------------------------------------- 1 | --only="Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector" 2 | -------------------------------------------------------------------------------- /e2e/only-option/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "php": "^8.1" 4 | }, 5 | "minimum-stability": "dev", 6 | "prefer-stable": true 7 | } 8 | -------------------------------------------------------------------------------- /e2e/only-option/expected-output.diff: -------------------------------------------------------------------------------- 1 | 1 file with changes 2 | =================== 3 | 4 | 1) src/MultiRules.php:10 5 | 6 | ---------- begin diff ---------- 7 | @@ @@ 8 | echo 'a statement'; 9 | } 10 | } 11 | - 12 | - private function notUsed() 13 | - { 14 | - } 15 | } 16 | ----------- end diff ----------- 17 | 18 | Applied rules: 19 | * RemoveUnusedPrivateMethodRector 20 | 21 | 22 | [OK] 1 file would have been changed (dry-run) by Rector 23 | -------------------------------------------------------------------------------- /e2e/only-option/rector.php: -------------------------------------------------------------------------------- 1 | paths([ 11 | __DIR__ . '/src', 12 | ]); 13 | 14 | $rectorConfig->rules([ 15 | RemoveAlwaysElseRector::class, 16 | RemoveUnusedPrivateMethodRector::class, 17 | ]); 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /e2e/only-option/src/MultiRules.php: -------------------------------------------------------------------------------- 1 | paths([ 9 | __DIR__ . '/src', 10 | ]); 11 | $rectorConfig->parallel(); 12 | 13 | $rectorConfig->sets([\Rector\Set\ValueObject\SetList::CODE_QUALITY]); 14 | }; 15 | -------------------------------------------------------------------------------- /e2e/parallel with space/src/Test.php: -------------------------------------------------------------------------------- 1 | parallel(); 10 | 11 | $rectorConfig->paths([ 12 | __DIR__.'/../../src/', 13 | ]); 14 | 15 | $rectorConfig->rule(DowngradeReadonlyPropertyRector::class); 16 | }; 17 | -------------------------------------------------------------------------------- /e2e/parallel-custom-config/expected-output.diff: -------------------------------------------------------------------------------- 1 | 1 file with changes 2 | =================== 3 | 4 | 1) src/SomeClass.php:7 5 | 6 | ---------- begin diff ---------- 7 | @@ @@ 8 | class SomeClass 9 | { 10 | public function __construct( 11 | - private readonly \stdClass $stdClass 12 | + private \stdClass $stdClass 13 | ) 14 | { 15 | } 16 | ----------- end diff ----------- 17 | 18 | Applied rules: 19 | * DowngradeReadonlyPropertyRector 20 | 21 | 22 | [OK] 1 file would have been changed (dry-run) by Rector 23 | -------------------------------------------------------------------------------- /e2e/parallel-custom-config/src/SomeClass.php: -------------------------------------------------------------------------------- 1 | parallel(); 10 | 11 | $rectorConfig->paths([ 12 | __DIR__ . '/src/', 13 | ]); 14 | 15 | $rectorConfig->rule(RemoveUnusedPrivatePropertyRector::class); 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /e2e/parallel-reflection-resolver/src/NamespacedSomeClassFound.php: -------------------------------------------------------------------------------- 1 | paths([ 8 | __DIR__ . '/src/TestClass.php', 9 | __DIR__ . '/src/ExtendingTestClass.php', 10 | ]); 11 | 12 | $rectorConfig->rule(AddParamBasedOnParentClassMethodRector::class); 13 | }; -------------------------------------------------------------------------------- /e2e/print-new-node/src/ExtendingTestClass.php: -------------------------------------------------------------------------------- 1 | cacheClass(FileCacheStorage::class); 11 | $rectorConfig->parallel(0); 12 | 13 | $rectorConfig->paths([ 14 | __DIR__ . '/src', 15 | ]); 16 | 17 | $rectorConfig->sets([LevelSetList::UP_TO_PHP_82]); 18 | }; 19 | -------------------------------------------------------------------------------- /e2e/timeout-file-not-cached/src/SomeFixturePrinter.php: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | tests 15 | rules-tests 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /rules/Arguments/Contract/ReplaceArgumentDefaultValueInterface.php: -------------------------------------------------------------------------------- 1 | class); 24 | } 25 | 26 | public function getMethodName(): string 27 | { 28 | return $this->methodName; 29 | } 30 | 31 | public function getParamPosition(): int 32 | { 33 | return $this->paramPosition; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rules/CodeQuality/NodeAnalyzer/ClassLikeAnalyzer.php: -------------------------------------------------------------------------------- 1 | getProperties() as $property) { 19 | foreach ($property->props as $prop) { 20 | $propertyNames[] = $prop->name->toString(); 21 | } 22 | } 23 | 24 | return $propertyNames; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/CodeQuality/TypeResolver/AssignVariableTypeResolver.php: -------------------------------------------------------------------------------- 1 | nodeTypeResolver->getType($assign->expr); 22 | if ($exprType instanceof UnionType) { 23 | return $exprType; 24 | } 25 | 26 | return $this->nodeTypeResolver->getType($assign->var); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rules/CodeQuality/ValueObject/KeyAndExpr.php: -------------------------------------------------------------------------------- 1 | keyExpr; 25 | } 26 | 27 | public function getExpr(): Expr 28 | { 29 | return $this->expr; 30 | } 31 | 32 | /** 33 | * @return Comment[] 34 | */ 35 | public function getComments(): array 36 | { 37 | return $this->comments; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /rules/CodingStyle/Contract/ClassNameImport/ClassNameImportSkipVoterInterface.php: -------------------------------------------------------------------------------- 1 | types; 15 | 16 | foreach ($types as $type) { 17 | if ($type instanceof GenericTypeNode) { 18 | return true; 19 | } 20 | } 21 | 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /rules/DeadCode/ValueObject/BinaryToVersionCompareCondition.php: -------------------------------------------------------------------------------- 1 | versionCompareCondition; 21 | } 22 | 23 | public function getBinaryClass(): string 24 | { 25 | return $this->binaryClass; 26 | } 27 | 28 | public function getExpectedValue(): mixed 29 | { 30 | return $this->expectedValue; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rules/DeadCode/ValueObject/VersionCompareCondition.php: -------------------------------------------------------------------------------- 1 | firstVersion; 21 | } 22 | 23 | public function getSecondVersion(): int 24 | { 25 | return $this->secondVersion; 26 | } 27 | 28 | public function getCompareSign(): ?string 29 | { 30 | return $this->compareSign; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /rules/EarlyReturn/ValueObject/BareSingleAssignIf.php: -------------------------------------------------------------------------------- 1 | if->cond; 22 | } 23 | 24 | public function getIf(): If_ 25 | { 26 | return $this->if; 27 | } 28 | 29 | public function getAssign(): Assign 30 | { 31 | return $this->assign; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /rules/Naming/Matcher/CallMatcher.php: -------------------------------------------------------------------------------- 1 | expr instanceof MethodCall) { 22 | return $node->expr; 23 | } 24 | 25 | if ($node->expr instanceof StaticCall) { 26 | return $node->expr; 27 | } 28 | 29 | if ($node->expr instanceof FuncCall) { 30 | return $node->expr; 31 | } 32 | 33 | return null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rules/Naming/PhpArray/ArrayFilter.php: -------------------------------------------------------------------------------- 1 | $valueToCount */ 16 | $valueToCount = array_count_values($values); 17 | 18 | $duplicatedValues = []; 19 | 20 | foreach ($valueToCount as $value => $count) { 21 | /** @var int $count */ 22 | if ($count < 2) { 23 | continue; 24 | } 25 | 26 | $duplicatedValues[] = $value; 27 | } 28 | 29 | return $duplicatedValues; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /rules/Naming/ValueObject/ExpectedName.php: -------------------------------------------------------------------------------- 1 | name; 18 | } 19 | 20 | public function getSingularized(): string 21 | { 22 | return $this->singularized; 23 | } 24 | 25 | public function isSingular(): bool 26 | { 27 | return $this->name === $this->singularized; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rules/Php70/Enum/BattleshipCompareOrder.php: -------------------------------------------------------------------------------- 1 | firstExpr; 20 | } 21 | 22 | public function getSecondExpr(): Expr 23 | { 24 | return $this->secondExpr; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Php71/ValueObject/TwoNodeMatch.php: -------------------------------------------------------------------------------- 1 | firstExpr; 20 | } 21 | 22 | public function getSecondExpr(): Expr 23 | { 24 | return $this->secondExpr; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Php72/ValueObject/ListAndEach.php: -------------------------------------------------------------------------------- 1 | list; 21 | } 22 | 23 | public function getEachFuncCall(): FuncCall 24 | { 25 | return $this->eachFuncCall; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rules/Php74/Guard/MakePropertyTypedGuard.php: -------------------------------------------------------------------------------- 1 | type instanceof Node) { 21 | return false; 22 | } 23 | 24 | return $this->propertyTypeChangeGuard->isLegal($property, $classReflection, $inlinePublic); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Php74/Tokenizer/ParenthesizedNestedTernaryAnalyzer.php: -------------------------------------------------------------------------------- 1 | getOldTokens(); 15 | $startTokenPos = $ternary->getStartTokenPos(); 16 | $endTokenPos = $ternary->getEndTokenPos(); 17 | 18 | $hasOpenParentheses = isset($oldTokens[$startTokenPos]) && (string) $oldTokens[$startTokenPos] === '('; 19 | $hasCloseParentheses = isset($oldTokens[$endTokenPos]) && (string) $oldTokens[$endTokenPos] === ')'; 20 | 21 | return $hasOpenParentheses || $hasCloseParentheses; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /rules/Php80/AttributeDecorator/SensioParamConverterAttributeDecorator.php: -------------------------------------------------------------------------------- 1 | args[0]; 21 | $firstArg->name = null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /rules/Php80/Contract/ConverterAttributeDecoratorInterface.php: -------------------------------------------------------------------------------- 1 | getHaystackExpr()), new Arg($strStartsWith->getNeedleExpr())]; 18 | 19 | $funcCall = new FuncCall(new Name('str_starts_with'), $args); 20 | if ($strStartsWith->isPositive()) { 21 | return $funcCall; 22 | } 23 | 24 | return new BooleanNot($funcCall); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Php80/ValueObject/AttributeValueAndDocComment.php: -------------------------------------------------------------------------------- 1 | doctrineAnnotationTagValueNode; 20 | } 21 | 22 | public function getAnnotationToAttribute(): AnnotationToAttribute 23 | { 24 | return $this->annotationToAttribute; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Php80/ValueObject/MatchResult.php: -------------------------------------------------------------------------------- 1 | match; 20 | } 21 | 22 | public function shouldRemoveNextStmt(): bool 23 | { 24 | return $this->shouldRemoveNextStmt; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Php80/ValueObject/NestedDoctrineTagAndAnnotationToAttribute.php: -------------------------------------------------------------------------------- 1 | doctrineAnnotationTagValueNode; 20 | } 21 | 22 | public function getNestedAnnotationToAttribute(): NestedAnnotationToAttribute 23 | { 24 | return $this->nestedAnnotationToAttribute; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Php80/ValueObjectFactory/StrStartsWithFactory.php: -------------------------------------------------------------------------------- 1 | isFirstClassCallable()) { 15 | return null; 16 | } 17 | 18 | if (count($funcCall->getArgs()) < 2) { 19 | return null; 20 | } 21 | 22 | $haystack = $funcCall->getArgs()[0] 23 | ->value; 24 | $needle = $funcCall->getArgs()[1] 25 | ->value; 26 | 27 | return new StrStartsWith($funcCall, $haystack, $needle, $isPositive); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rules/Php81/Enum/AttributeName.php: -------------------------------------------------------------------------------- 1 | function; 21 | } 22 | 23 | public function getArgumentPosition(): int 24 | { 25 | return $this->argumentPosition; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rules/Renaming/Collector/RenamedNameCollector.php: -------------------------------------------------------------------------------- 1 | names[] = $name; 17 | } 18 | 19 | public function has(string $name): bool 20 | { 21 | return in_array($name, $this->names, true); 22 | } 23 | 24 | public function reset(): void 25 | { 26 | $this->names = []; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rules/Renaming/Contract/MethodCallRenameInterface.php: -------------------------------------------------------------------------------- 1 | oldAnnotation; 23 | } 24 | 25 | public function getNewAnnotation(): string 26 | { 27 | return $this->newAnnotation; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rules/Renaming/ValueObject/RenameAttribute.php: -------------------------------------------------------------------------------- 1 | oldAttribute; 21 | } 22 | 23 | public function getNewAttribute(): string 24 | { 25 | return $this->newAttribute; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rules/Transform/NodeFactory/PropertyFetchFactory.php: -------------------------------------------------------------------------------- 1 | propertyNaming->fqnToVariableName($objectType->getClassName()); 23 | 24 | return new PropertyFetch($thisVariable, $propertyName); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/ArrayDimFetchToMethodCall.php: -------------------------------------------------------------------------------- 1 | objectType; 20 | } 21 | 22 | public function getMethod(): string 23 | { 24 | return $this->method; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/ClassMethodReference.php: -------------------------------------------------------------------------------- 1 | class; 22 | } 23 | 24 | public function getMethod(): string 25 | { 26 | return $this->method; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/MethodCallToFuncCall.php: -------------------------------------------------------------------------------- 1 | objectType; 19 | } 20 | 21 | public function getMethodName(): string 22 | { 23 | return $this->methodName; 24 | } 25 | 26 | public function getFunctionName(): string 27 | { 28 | return $this->functionName; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/MethodCallToNew.php: -------------------------------------------------------------------------------- 1 | objectType; 24 | } 25 | 26 | public function getMethodName(): string 27 | { 28 | return $this->methodName; 29 | } 30 | 31 | public function getNewClassString(): string 32 | { 33 | return $this->newClassString; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/ScalarValueToConstFetch.php: -------------------------------------------------------------------------------- 1 | scalar; 24 | } 25 | 26 | public function getConstFetch(): ConstFetch|ClassConstFetch 27 | { 28 | return $this->constFetch; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/StaticCallToNew.php: -------------------------------------------------------------------------------- 1 | class; 22 | } 23 | 24 | public function getMethod(): string 25 | { 26 | return $this->method; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/StringToClassConstant.php: -------------------------------------------------------------------------------- 1 | string; 22 | } 23 | 24 | public function getClass(): string 25 | { 26 | return $this->class; 27 | } 28 | 29 | public function getConstant(): string 30 | { 31 | return $this->constant; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /rules/Transform/ValueObject/WrapReturn.php: -------------------------------------------------------------------------------- 1 | type); 23 | } 24 | 25 | public function getMethod(): string 26 | { 27 | return $this->method; 28 | } 29 | 30 | public function isArrayWrap(): bool 31 | { 32 | return $this->isArrayWrap; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/AlreadyAssignDetector/PropertyDefaultAssignDetector.php: -------------------------------------------------------------------------------- 1 | getProperty($propertyName); 16 | if (! $property instanceof Property) { 17 | return false; 18 | } 19 | 20 | return $property->props[0]->default instanceof Expr; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/FunctionLikeReturnTypeResolver.php: -------------------------------------------------------------------------------- 1 | getReturnType(); 22 | if ($functionReturnType === null) { 23 | return new MixedType(); 24 | } 25 | 26 | return $this->staticTypeMapper->mapPhpParserNodePHPStanType($functionReturnType); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/NodeAnalyzer/DeclareStrictTypeFinder.php: -------------------------------------------------------------------------------- 1 | declares as $declare) { 21 | if ($declare->key->toString() === 'strict_types') { 22 | return true; 23 | } 24 | } 25 | 26 | return false; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/NodeAnalyzer/ParamAnalyzer.php: -------------------------------------------------------------------------------- 1 | getParams() as $param) { 21 | $paramName = $this->nodeNameResolver->getName($param); 22 | if ('$' . $paramName !== $desiredParamName) { 23 | continue; 24 | } 25 | 26 | return $param; 27 | } 28 | 29 | return null; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/PhpDocParser/ParamPhpDocNodeFactory.php: -------------------------------------------------------------------------------- 1 | variadic, 24 | '$' . $this->nodeNameResolver->getName($param), 25 | '', 26 | false 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/TypeAnalyzer/GenericClassStringTypeNormalizer.php: -------------------------------------------------------------------------------- 1 | getTypes() as $type) { 15 | if (! $type instanceof GenericClassStringType) { 16 | return false; 17 | } 18 | } 19 | 20 | return true; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/TypeAnalyzer/NullableTypeAnalyzer.php: -------------------------------------------------------------------------------- 1 | nodeTypeResolver->getNativeType($expr); 22 | 23 | $baseType = TypeCombinator::removeNull($exprType); 24 | if (! $baseType instanceof ObjectType) { 25 | return null; 26 | } 27 | 28 | return $baseType; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/ValueObject/AddPropertyTypeDeclaration.php: -------------------------------------------------------------------------------- 1 | class; 23 | } 24 | 25 | public function getPropertyName(): string 26 | { 27 | return $this->propertyName; 28 | } 29 | 30 | public function getType(): Type 31 | { 32 | return $this->type; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/ValueObject/AssignToVariable.php: -------------------------------------------------------------------------------- 1 | variableName; 20 | } 21 | 22 | public function getAssignedExpr(): Expr 23 | { 24 | return $this->assignedExpr; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /rules/TypeDeclaration/ValueObject/DataProviderNodes.php: -------------------------------------------------------------------------------- 1 | $nodes 14 | */ 15 | public function __construct( 16 | public array $nodes, 17 | ) { 18 | } 19 | 20 | public function isEmpty(): bool 21 | { 22 | return $this->nodes === []; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /rules/Visibility/ValueObject/ChangeConstantVisibility.php: -------------------------------------------------------------------------------- 1 | class); 23 | } 24 | 25 | public function getConstant(): string 26 | { 27 | return $this->constant; 28 | } 29 | 30 | public function getVisibility(): int 31 | { 32 | return $this->visibility; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /rules/Visibility/ValueObject/ChangeMethodVisibility.php: -------------------------------------------------------------------------------- 1 | class; 22 | } 23 | 24 | public function getMethod(): string 25 | { 26 | return $this->method; 27 | } 28 | 29 | public function getVisibility(): int 30 | { 31 | return $this->visibility; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Application/Provider/CurrentFileProvider.php: -------------------------------------------------------------------------------- 1 | file = $file; 19 | } 20 | 21 | public function getFile(): ?File 22 | { 23 | return $this->file; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/Annotation/AnnotationNaming.php: -------------------------------------------------------------------------------- 1 | getComments(); 18 | 19 | foreach ($mergedNodes as $mergedNode) { 20 | $comments = array_merge($comments, $mergedNode->getComments()); 21 | } 22 | 23 | if ($comments === []) { 24 | return; 25 | } 26 | 27 | $newNode->setAttribute(AttributeKey::COMMENTS, $comments); 28 | 29 | // remove so comments "win" 30 | $newNode->setAttribute(AttributeKey::PHP_DOC_INFO, null); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/Contract/BasePhpDocNodeVisitorInterface.php: -------------------------------------------------------------------------------- 1 | betterTokenIterator = $betterTokenIterator; 17 | } 18 | 19 | public function provide(): BetterTokenIterator 20 | { 21 | if (! $this->betterTokenIterator instanceof BetterTokenIterator) { 22 | throw new ShouldNotHappenException(); 23 | } 24 | 25 | return $this->betterTokenIterator; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/Guard/NewPhpDocFromPHPStanTypeGuard.php: -------------------------------------------------------------------------------- 1 | isLegalUnionType($type); 17 | } 18 | 19 | return true; 20 | } 21 | 22 | private function isLegalUnionType(UnionType $type): bool 23 | { 24 | foreach ($type->getTypes() as $unionType) { 25 | if ($unionType instanceof MixedType) { 26 | return false; 27 | } 28 | } 29 | 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/PhpDoc/SpacelessPhpDocTagNode.php: -------------------------------------------------------------------------------- 1 | name . $this->value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/Printer/DocBlockInliner.php: -------------------------------------------------------------------------------- 1 | children === []) { 15 | return true; 16 | } 17 | 18 | foreach ($phpDocNode->children as $phpDocChildNode) { 19 | if ($phpDocChildNode instanceof PhpDocTextNode) { 20 | if ($phpDocChildNode->text !== '') { 21 | return false; 22 | } 23 | } else { 24 | return false; 25 | } 26 | } 27 | 28 | return true; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/ValueObject/DoctrineAnnotation/SilentKeyMap.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | public const CLASS_NAMES_TO_SILENT_KEYS = [ 13 | 'Symfony\Component\Routing\Annotation\Route' => 'path', 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/ValueObject/StartAndEnd.php: -------------------------------------------------------------------------------- 1 | start; 23 | } 24 | 25 | public function getEnd(): int 26 | { 27 | return $this->end; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/ValueObject/Type/BracketsAwareIntersectionTypeNode.php: -------------------------------------------------------------------------------- 1 | types); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/ValueObject/Type/FullyQualifiedIdentifierTypeNode.php: -------------------------------------------------------------------------------- 1 | name, '\\'); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/BetterPhpDocParser/ValueObject/Type/ShortenedIdentifierTypeNode.php: -------------------------------------------------------------------------------- 1 | firstDirectory; 19 | } 20 | 21 | public function getSecondDirectory(): string 22 | { 23 | return $this->secondDirectory; 24 | } 25 | 26 | public function getFilePath(): string 27 | { 28 | return $this->filePath; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/ChangesReporting/Contract/Output/OutputFormatterInterface.php: -------------------------------------------------------------------------------- 1 | commentRemovingNodeTraverser->traverse($nodes); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Comments/NodeTraverser/CommentRemovingNodeTraverser.php: -------------------------------------------------------------------------------- 1 | setAttribute(AttributeKey::COMMENTS, []); 19 | $clonedNode->setAttribute(AttributeKey::PHP_DOC_INFO, null); 20 | 21 | return $clonedNode; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Composer/ValueObject/InstalledPackage.php: -------------------------------------------------------------------------------- 1 | name; 18 | } 19 | 20 | public function getVersion(): string 21 | { 22 | return $this->version; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Config/RegisteredService.php: -------------------------------------------------------------------------------- 1 | className; 19 | } 20 | 21 | public function getAlias(): ?string 22 | { 23 | return $this->alias; 24 | } 25 | 26 | public function getTag(): ?string 27 | { 28 | return $this->tag; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Configuration/Deprecation/Contract/DeprecatedInterface.php: -------------------------------------------------------------------------------- 1 | > 19 | */ 20 | public function getNodeTypes(): array; 21 | 22 | /** 23 | * Process Node of matched type 24 | * @return Node|Node[]|null|NodeTraverser::* 25 | */ 26 | public function refactor(Node $node); 27 | } 28 | -------------------------------------------------------------------------------- /src/Differ/DefaultDiffer.php: -------------------------------------------------------------------------------- 1 | 'Original', 18 | 'toFile' => 'New', 19 | ]); 20 | $this->differ = new Differ($strictUnifiedDiffOutputBuilder); 21 | } 22 | 23 | public function diff(string $old, string $new): string 24 | { 25 | return $this->differ->diff($old, $new); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Enum/ClassName.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | public static function readFilePath(string $filePath): array 16 | { 17 | $fileContents = FileSystem::read($filePath); 18 | 19 | return Json::decode($fileContents, forceArrays: true); 20 | } 21 | 22 | /** 23 | * @param array $data 24 | */ 25 | public static function writeFile(string $filePath, array $data): void 26 | { 27 | $json = Json::encode($data, pretty: true); 28 | FileSystem::write($filePath, $json, null); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Git/RepositoryHelper.php: -------------------------------------------------------------------------------- 1 | .*?)\.git#'; 17 | 18 | public static function resolveGithubRepositoryName(string $currentDirectory): ?string 19 | { 20 | // resolve current repository name 21 | $process = new Process(['git', 'remote', 'get-url', 'origin'], $currentDirectory, null, null, null); 22 | $process->run(); 23 | 24 | $output = $process->getOutput(); 25 | 26 | $match = Strings::match($output, self::GITHUB_REPOSITORY_REGEX); 27 | return $match['repository_name'] ?? null; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/NodeAnalyzer/ArgsAnalyzer.php: -------------------------------------------------------------------------------- 1 | name instanceof Identifier) { 19 | return true; 20 | } 21 | } 22 | 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/NodeAnalyzer/ClassAnalyzer.php: -------------------------------------------------------------------------------- 1 | isAnonymousClass($node->class); 17 | } 18 | 19 | if ($node instanceof Class_) { 20 | return $node->isAnonymous(); 21 | } 22 | 23 | return false; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/NodeAnalyzer/MagicClassMethodAnalyzer.php: -------------------------------------------------------------------------------- 1 | nodeNameResolver->isName($classMethod, MethodName::INVOKE)) { 21 | return false; 22 | } 23 | 24 | return $classMethod->isMagic(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/NodeAnalyzer/ScopeAnalyzer.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | private const NON_REFRESHABLE_NODES = [Name::class, Identifier::class, ComplexType::class]; 18 | 19 | public function isRefreshable(Node $node): bool 20 | { 21 | foreach (self::NON_REFRESHABLE_NODES as $noScopeNode) { 22 | if ($node instanceof $noScopeNode) { 23 | return false; 24 | } 25 | } 26 | 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/NodeAnalyzer/VariableAnalyzer.php: -------------------------------------------------------------------------------- 1 | getAttribute(AttributeKey::IS_GLOBAL_VAR) === true) { 15 | return true; 16 | } 17 | 18 | return $variable->getAttribute(AttributeKey::IS_STATIC_VAR) === true; 19 | } 20 | 21 | public function isUsedByReference(Variable $variable): bool 22 | { 23 | return $variable->getAttribute(AttributeKey::IS_BYREF_VAR) === true; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/NodeCollector/ValueObject/ArrayCallable.php: -------------------------------------------------------------------------------- 1 | class; 23 | } 24 | 25 | public function getMethod(): string 26 | { 27 | return $this->method; 28 | } 29 | 30 | public function getCallerExpr(): Expr 31 | { 32 | return $this->callerExpr; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/NodeCollector/ValueObject/ArrayCallableDynamicMethod.php: -------------------------------------------------------------------------------- 1 | getParams() as $param) { 25 | $paramNames[] = $this->nodeNameResolver->getName($param); 26 | } 27 | 28 | return $paramNames; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/NodeNameResolver/Contract/NodeNameResolverInterface.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | public function getNode(): string; 19 | 20 | /** 21 | * @param TNode $node 22 | */ 23 | public function resolve(Node $node, ?Scope $scope): ?string; 24 | } 25 | -------------------------------------------------------------------------------- /src/NodeNameResolver/NodeNameResolver/NameNameResolver.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | final class NameNameResolver implements NodeNameResolverInterface 16 | { 17 | public function getNode(): string 18 | { 19 | return Name::class; 20 | } 21 | 22 | /** 23 | * @param Name $node 24 | */ 25 | public function resolve(Node $node, ?Scope $scope): string 26 | { 27 | return $node->toString(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/NodeNameResolver/NodeNameResolver/UseNameResolver.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | final class UseNameResolver implements NodeNameResolverInterface 16 | { 17 | public function getNode(): string 18 | { 19 | return Use_::class; 20 | } 21 | 22 | /** 23 | * @param Use_ $node 24 | */ 25 | public function resolve(Node $node, ?Scope $scope): ?string 26 | { 27 | if ($node->uses === []) { 28 | return null; 29 | } 30 | 31 | $onlyUse = $node->uses[0]; 32 | return $onlyUse->name->toString(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/NodeNameResolver/NodeNameResolver/VariableNameResolver.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | final class VariableNameResolver implements NodeNameResolverInterface 17 | { 18 | public function getNode(): string 19 | { 20 | return Variable::class; 21 | } 22 | 23 | /** 24 | * @param Variable $node 25 | */ 26 | public function resolve(Node $node, ?Scope $scope): ?string 27 | { 28 | if ($node->name instanceof Expr) { 29 | return null; 30 | } 31 | 32 | return $node->name; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/NodeTypeResolver/Contract/NodeTypeResolverAwareInterface.php: -------------------------------------------------------------------------------- 1 | > 17 | */ 18 | public function getNodeClasses(): array; 19 | 20 | /** 21 | * @param TNode $node 22 | */ 23 | public function resolve(Node $node): Type; 24 | } 25 | -------------------------------------------------------------------------------- /src/NodeTypeResolver/NodeTypeCorrector/AccessoryNonEmptyStringTypeCorrector.php: -------------------------------------------------------------------------------- 1 | isNonEmptyString()->yes()) { 20 | return $mainType; 21 | } 22 | 23 | return new StringType(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/NodeTypeResolver/PHPStan/ObjectWithoutClassTypeWithParentTypes.php: -------------------------------------------------------------------------------- 1 | parentTypes; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/NodeTypeResolver/PHPStan/Scope/Contract/NodeVisitor/ScopeResolverNodeVisitorInterface.php: -------------------------------------------------------------------------------- 1 | phpStanScopeFactory->create($scopeContext); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/NodeTypeResolver/TypeAnalyzer/ArrayTypeAnalyzer.php: -------------------------------------------------------------------------------- 1 | nodeTypeResolver->getNativeType($expr); 20 | return $nodeType->isArray() 21 | ->yes(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/NodeTypeResolver/TypeAnalyzer/StringTypeAnalyzer.php: -------------------------------------------------------------------------------- 1 | nodeTypeResolver->getType($expr); 20 | return $nodeType->isString() 21 | ->yes(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/NodeTypeResolver/ValueObject/OldToNewType.php: -------------------------------------------------------------------------------- 1 | oldType; 20 | } 21 | 22 | public function getNewType(): Type 23 | { 24 | return $this->newType; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/PHPStanStaticTypeMapper/Enum/TypeKind.php: -------------------------------------------------------------------------------- 1 | shortAttributeName; 21 | } 22 | 23 | public function getUseImportName(): string 24 | { 25 | return $this->useImportName; 26 | } 27 | 28 | public function getUseUse(): UseItem 29 | { 30 | return $this->useItem; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/PhpDocParser/PhpDocParser/Contract/PhpDocNodeVisitorInterface.php: -------------------------------------------------------------------------------- 1 | hasAttribute(PhpDocAttributeKey::ORIG_NODE)) { 23 | $clonedNode->setAttribute(PhpDocAttributeKey::ORIG_NODE, $node); 24 | } 25 | 26 | return $clonedNode; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/PhpDocParser/PhpDocParser/ValueObject/PhpDocAttributeKey.php: -------------------------------------------------------------------------------- 1 | message = $parserErrorsException->getMessage(); 18 | $this->line = $parserErrorsException->getAttributes()['startLine'] ?? $parserErrorsException->getLine(); 19 | } 20 | 21 | public function getMessage(): string 22 | { 23 | return $this->message; 24 | } 25 | 26 | public function getLine(): int 27 | { 28 | return $this->line; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/PhpParser/ValueObject/StmtsAndTokens.php: -------------------------------------------------------------------------------- 1 | $tokens 15 | */ 16 | public function __construct( 17 | private array $stmts, 18 | private array $tokens 19 | ) { 20 | } 21 | 22 | /** 23 | * @return Stmt[] 24 | */ 25 | public function getStmts(): array 26 | { 27 | return $this->stmts; 28 | } 29 | 30 | /** 31 | * @return array 32 | */ 33 | public function getTokens(): array 34 | { 35 | return $this->tokens; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/PostRector/Contract/Rector/PostRectorInterface.php: -------------------------------------------------------------------------------- 1 | name; 22 | } 23 | 24 | public function getType(): ?Type 25 | { 26 | return $this->type; 27 | } 28 | 29 | public function getFlags(): int 30 | { 31 | return $this->flags; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Reflection/ClassReflectionAnalyzer.php: -------------------------------------------------------------------------------- 1 | getNativeReflection(); 15 | if ($nativeReflection instanceof ReflectionEnum) { 16 | return null; 17 | } 18 | 19 | return $nativeReflection->getParentClassName(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Set/Contract/SetInterface.php: -------------------------------------------------------------------------------- 1 | groupName; 26 | } 27 | 28 | public function getName(): string 29 | { 30 | return $this->setName; 31 | } 32 | 33 | public function getSetFilePath(): string 34 | { 35 | return $this->setFilePath; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Skipper/FileSystem/FnMatchPathNormalizer.php: -------------------------------------------------------------------------------- 1 | skippedPathsResolver->resolve(); 21 | return $this->fileInfoMatcher->doesFileInfoMatchPatterns($filePath, $skippedPaths); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/StaticTypeMapper/Contract/PhpDocParser/PhpDocTypeMapperInterface.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | public function getNodeType(): string; 21 | 22 | /** 23 | * @param TTypeNode $typeNode 24 | */ 25 | public function mapToPHPStanType(TypeNode $typeNode, Node $node, NameScope $nameScope): Type; 26 | } 27 | -------------------------------------------------------------------------------- /src/StaticTypeMapper/Contract/PhpParser/PhpParserNodeMapperInterface.php: -------------------------------------------------------------------------------- 1 | 17 | */ 18 | public function getNodeType(): string; 19 | 20 | /** 21 | * @param TNode $node 22 | */ 23 | public function mapToPHPStan(Node $node): Type; 24 | } 25 | -------------------------------------------------------------------------------- /src/StaticTypeMapper/PhpParser/StringNodeMapper.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | final class StringNodeMapper implements PhpParserNodeMapperInterface 17 | { 18 | public function getNodeType(): string 19 | { 20 | return String_::class; 21 | } 22 | 23 | /** 24 | * @param String_ $node 25 | */ 26 | public function mapToPHPStan(Node $node): Type 27 | { 28 | return new StringType(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/StaticTypeMapper/Resolver/ClassNameFromObjectTypeResolver.php: -------------------------------------------------------------------------------- 1 | getObjectClassNames(); 14 | 15 | if (count($objectClassNames) !== 1) { 16 | return null; 17 | } 18 | 19 | return $objectClassNames[0]; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/StaticTypeMapper/ValueObject/Type/FullyQualifiedGenericObjectType.php: -------------------------------------------------------------------------------- 1 | className; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Testing/Contract/RectorTestInterface.php: -------------------------------------------------------------------------------- 1 | > 15 | */ 16 | public static function yieldDirectory(string $directory, string $suffix = '*.php.inc'): Iterator 17 | { 18 | $finder = (new Finder()) 19 | ->in($directory) 20 | ->files() 21 | ->name($suffix) 22 | ->sortByName(); 23 | 24 | foreach ($finder as $fileInfo) { 25 | yield [$fileInfo->getRealPath()]; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Testing/Fixture/FixtureTempFileDumper.php: -------------------------------------------------------------------------------- 1 | 1) { 18 | $version = $explodeDash[0]; 19 | } 20 | 21 | $explodeVersion = explode('.', $version); 22 | $countExplodedVersion = count($explodeVersion); 23 | 24 | if ($countExplodedVersion >= 2) { 25 | return (int) $explodeVersion[0] * 10000 + (int) $explodeVersion[1] * 100; 26 | } 27 | 28 | return (int) $version; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Util/StringUtils.php: -------------------------------------------------------------------------------- 1 | mainConfigFile; 21 | } 22 | 23 | /** 24 | * @return string[] 25 | */ 26 | public function getConfigFiles(): array 27 | { 28 | $configFiles = []; 29 | if ($this->mainConfigFile !== null) { 30 | $configFiles[] = $this->mainConfigFile; 31 | } 32 | 33 | return array_merge($configFiles, $this->setConfigFiles); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ValueObject/FileProcessResult.php: -------------------------------------------------------------------------------- 1 | systemErrors; 29 | } 30 | 31 | public function getFileDiff(): ?FileDiff 32 | { 33 | return $this->fileDiff; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/ValueObject/FuncCallAndExpr.php: -------------------------------------------------------------------------------- 1 | funcCall; 21 | } 22 | 23 | public function getExpr(): Expr 24 | { 25 | return $this->expr; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/ValueObject/PolyfillPackage.php: -------------------------------------------------------------------------------- 1 | arrayItems; 27 | } 28 | 29 | public function getStringValue(): string 30 | { 31 | return $this->string->value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/ValueObject/Visibility.php: -------------------------------------------------------------------------------- 1 | > 17 | */ 18 | public function getNodeTypes(): array 19 | { 20 | // @todo select node type 21 | return [\PhpParser\Node\Stmt\Class_::class]; 22 | } 23 | 24 | /** 25 | * @param \PhpParser\Node\Stmt\Class_ $node 26 | */ 27 | public function refactor(Node $node): ?Node 28 | { 29 | // @todo change the node 30 | 31 | return $node; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /templates/rector-gitlab-check.yaml: -------------------------------------------------------------------------------- 1 | stages: 2 | - setup 3 | - rector 4 | - commit_changes 5 | 6 | setup: 7 | stage: setup 8 | # see https://github.com/thecodingmachine/docker-images-php 9 | image: thecodingmachine/php:8.2-v4-slim-cli 10 | 11 | rector: 12 | stage: rector 13 | script: 14 | - vendor/bin/rector --ansi 15 | # @todo apply coding standard if used 16 | 17 | commit_changes: 18 | stage: commit_changes 19 | script: 20 | - git config --global user.email "ci@gitlab.com" 21 | - git config --global user.name "GitLab CI 22 | # - git checkout $CI_COMMIT_REF_NAME 23 | - git add . 24 | - git commit -m "[rector] Rector fixes" 25 | - git push origin $CI_COMMIT_REF_NAME 26 | only: 27 | - merge_requests 28 | -------------------------------------------------------------------------------- /templates/rector.php.dist: -------------------------------------------------------------------------------- 1 | withPaths([ 9 | __PATHS__ 10 | ]) 11 | // uncomment to reach your current PHP version 12 | // ->withPhpSets() 13 | ->withTypeCoverageLevel(0) 14 | ->withDeadCodeLevel(0) 15 | ->withCodeQualityLevel(0); 16 | -------------------------------------------------------------------------------- /tests-paths/path/NoExtensionFile: -------------------------------------------------------------------------------- 1 |