New Features and Changes 🥳
- [CodeQuality] Add CompleteMissingIfElseBracketRector (#5121)
- [CodeQuality] Add Else and ElseIf on CompleteMissingIfElseBracketRector (#5124)
- [TypeDeclaration] Utilize ClassMethodReturnTypeOverrideGuard on AddReturnTypeDeclarationFromYieldsRector (#5156)
- [DeadCode] Add RemoveUselessReturnExprInConstructRector (#5158)
- Improve UnaryPlus and UnaryMinus support in isDynamicExpr (#5177), Thanks @JulianCBC!
Bugfixes 🐛
- [CodeQuality] Skip VB style if endif on CompleteMissingIfElseBracketRector (#5122)
- [CodeQuality] Skip direct InlineHTML on CompleteMissingIfElseBracketRector (#5125)
- [CodeQuality] Skip spaced elseif cond on CompleteMissingIfElseBracketRector (#5126)
- [CodeQuality] Only check start from current Stmt token pos up until open parentheses on CompleteMissingIfElseBracketRector (#5127)
- [CodeQuality] Handle all if,elseif,else no bracket on CompleteMissingIfElseBracketRector (#5129)
- [CodeQuality] Skip VB style in complex HTML on CompleteMissingIfElseBracketRector (#5132)
- Skip
__construct()
in BoolReturnTypeFromStrictScalarReturnsRector (#5133), Thanks @staabm! - [CodeQuality] Handle missing bracket on If only on CompleteMissingIfElseBracketRector (#5134)
- [CodeQuality] Handle on closure, anonymous function, method call on CompleteMissingIfElseBracketRector (#5135)
- [CodeQuality] Use its start token pos on Else_ on CompleteMissingIfElseBracketRector as no cond (#5136)
- [PhpParser] Reduce AstResolver complexity by move check fileName is null to parseFileNameToDecoratedNodes() (#5138)
- [TypeDeclaration] Handle Union with array type on ReturnUnionTypeRector (#5144)
- [TypeDeclaration] Handle union A extends B on ReturnUnionTypeRector (#5149)
- [CodeQuality] Fix missing parentheses on CombineIfRector (#5151)
- [TypeDeclaration] Utilize ClassMethodReturnTypeOverrideGuard on NumericReturnTypeFromStrictScalarReturnsRector (#5155)
- [CodeQuality] Handle negative and positive int/float on InlineConstructorDefaultToPropertyRector (#5159)
- [CodeQuality] Skip docblock usage on SimplifyBoolIdenticalTrueRector (#5161)
- [CodeQuality] Skip magic property fetch on IssetOnPropertyObjectToPropertyExistsRector (#5163)
- [PostRector] Reduce loop on ClassRenamingPostRector (#5174)
- [PostRector] Fix ClassRenamingPostRector return when no auto import replacement (#5175)
- [Renaming] Skip nullable object object|null on RenameMethodRector (#5181)
- [Downgradephp81][DowngradePhp80] Handle No scope crash on DowngradeSetAccessibleReflectionPropertyRector + DowngradeMatchToSwitchRector (#5183)
- [Naming] Skip DateTime from renaming, to keep convention of named dates (#5184)
- Skip new self in RenameVariableToMatchNewTypeRector (#5185)
- Skip DateTime in ExpectedNameResolver (#5186)
- [Naming] Skip all kinds of generators (#5187)
- [Renaming] Skip pointless names in RenameForeachValueVariableToMatchMethodCallReturnTypeRector (#5188)
- [Php70] Fix Php4 contructor not replaced with __construct() on php 7.4 environment (#5189)
- [Php74][Php81] Allow mixed key on ArraySpreadInsteadOfArrayMergeRector on php 8.1 version feature enabled (#5190)
- [TypeDeclaration] Handle skipped by file path on DeclareStrictTypesRector due to use beforeTraverse() (#5191)
- Fix phpstan notice $phpVersion on Rector\Config\RectorConfig::phpVersion() (#5193)
- [PHPStanStaticTypeMapper] Remove BoolUnionTypeAnalyzer on UnionTypeMapper (#5141)
- [DeadCode] Remove UnionType check on RecastingRemovalRector (#5142)
- Remove src/constants.php for T_ENUM and T_NAME_RELATIVE (#5143)
- [PHPStanStaticTypeMapper] Remove narrow string and int on UnionTypeMapper (#5145)
- [PHPStanStaticTypeMapper] Remove matchArrayTypes() on UnionTypeMapper (#5146)
- [DeadCode] Skip indirect variable definition on RemoveNonExistingVarAnnotationRector (#5152)
- [DeadCode] Skip key used in next stmt on RemoveUnusedForeachKeyRector (#5153)
- [DeadCode] Skip used in next For_/Foreach_ on RemoveDeadIfForeachForRector (#5154)
- [DeadCode] Handle file_get_contents() only remove variable on RemoveUnusedVariableAssignRector (#5162)
- [DeadCode] Skip count() on mixed on RemoveUnusedNonEmptyArrayBeforeForeachRector (#5160)
- RemoveUnusedNonEmptyArrayBeforeForeachRector: ignore phpdoc types (#5169), Thanks @staabm!
- RemoveUnusedNonEmptyArrayBeforeForeachRector: skip array dim fetch (#5166), Thanks @staabm!
- [DeadCode] Skip return false pseudo type in union on RemoveUselessReturnTagRector (#5172)
- [AutoImport] [Renaming] Skip remove used use statement on annotation during rename + auto import when no replacement on auto import (#5168)
- [DeadCode] Mirror comment on assign method call on RemoveUnusedVariableAssignRector (#5195)