Releases: rectorphp/rector
Releases · rectorphp/rector
Released Rector 2.4.1
New Features 🥳
- [DeadCode] Add
RemoveUselessTernaryRector(#7961) - [CodeQuality] Add
CoalesceToTernaryRector(#7960) - Add
--rules-summaryoption to display applied rules summary with count (#7874), Thanks @carlos-granados! - Add support for adding the
#[Override]attribute to methods implementing interfaces (#7934), Thanks @hockdudu! - feat(printer): add per-node NEWLINE_ON_FLUENT_CALL attribute to BetterStandardPrinter (#7910), Thanks @MrPunyapal!
- Show line numbers in diff output (#7875), Thanks @carlos-granados!
Bugfixes 🐛
- [CodeQuality] Skip with HTML on CompleteMissingIfElseBracketRector (#7952)
- [CodeQuality] Handle with assign on SimplifyIfElseToTernaryRector (#7951)
- [CodeQuality] Skip with HTML on TernaryFalseExpressionToIfRector (#7954)
- [automated] Apply Coding Standard (#7955)
- Make compatible with PHPStan 2.1.x-dev for ObjectType::equals() change behaviour (#7956)
- [AutoImport] Handle FQCN in/not in use on auto import + remove unused import as prefix = suffix (#7957)
- perf: use hash map for installed packages (#7878), Thanks @calebdw!
- [ChangesReporting][Alternative] Collect changed_files on --no-diffs with json output with use of JsonOutputFactory (#7821)
- fix: OOM crash in RemoveUnusedVariableAssignRector (#7964), Thanks @calebdw!
Deprecations 💀
Released Rector 2.4.0
New Features 🥳
- chore: add
SafeDeclareStrictTypesRectorto code quality set (#7935), Thanks @calebdw! - [Caching] Add CacheMetaExtensionInterface for custom cache invalidation (#7933), Thanks @ruudk!
- feat(php86): add min/max to clamp rector (#7942), Thanks @calebdw!
Bugfixes 🐛
- [Php85] Do not convert to pipe on use directly of spread operator on NestedFuncCallsToPipeOperatorRector (#7938)
- [Console] Allow short command "p" on ProcessCommand (#7931)
- [Arguments] Skip self class const fetch inside this class target replacement on ReplaceArgumentDefaultValueRector (#7940)
- [CodeQuality] Hnadle with negation binary op previous if on CombineIfRector (#7945)
- [CodingStyle] Skip by reference required params on call inside on ArrowFunctionDelegatingCallToFirstClassCallableRector (#7949)
Removed 💀
- [DeadCode] Skip pipe operator on RemoveDeadStmtRector (#7941)
- [DeadCode] Handle crash on multi elseif on RemoveDeadIfBlockRector (#7946)
- [DeadCode] Skip with assign to call with target has #[NoDiscard] attribute on RemoveUnusedVariableAssignRector (#7950)
rectorphp/rector-symfony 🎵
- [CodeQuality] Handle different parameter type same name used on ControllerMethodInjectionToConstructorRector (#929)
- [CodeQuality] Skip used by static closure use on ControllerMethodInjectionToConstructorRector (#928)
- [Symfony61] Skip non static external class callable on MagicClosureTwigExtensionToNativeMethodsRector (#927), Thanks @wuchen90
rectorphp/rector-doctrine 🟠
- Fix infinite loop check instanceof name check to use Name class (#481)
rectorphp/rector-phpunit 🟢
- [PHPunit 9] Move AssertRegExpRector to phpunit 90 set with refactor to use assertMatchesRegularExpression/assertDoesNotMatchRegularExpression (#667)
- [PHPUnit 9] Rename assertRegExp/assertNotRegExp to assertMatchesRegularExpression/assertDoesNotMatchRegularExpression on phpunit 90 set (#666)
- Fix assert PHPStan on ConfiguredMockEntityToSetterObjectRector (#665)
Released Rector 2.3.9
New Features 🥳
- [CodingStyle] Add
StrictInArrayRector(#7921)
Bugfixes 🐛
- [Php71] Handle crash on partial destruct on assign var on ListToArrayDestructRector (#7909)
- [CodeQuality] Skip no code parameter on custom Throwable instance on ThrowWithPreviousExceptionRector (#7912)
- Bump to PHPStan ^2.1.40 and utilize ClassConstantReflection->isFinalByKeyword() (#7911)
- [Php70] Handle keep right parentheses on ternary else is BinaryOp on TernaryToNullCoalescingRector (#7916)
- Properly build text node for junit output formatter (#7917), Thanks @brandonja991!
- [CodeQuality] Skip with custom param in previous position on ThrowWithPreviousExceptionRector (#7919)
- [automated] Apply Coding Standard (#7922)
- [DX] Define list of allowed implicit commands on ConsoleApplication (#7918)
- [CodeQuality] Skip used by other property hooks on InlineConstructorDefaultToPropertyRector (#7920)
- [automated] Apply Coding Standard (#7926)
- [StrictStringParamConcatRector] Skip PHP version 5.6 or earlier (#7927), Thanks @ghostwriter!
- [Php85] Skip single char literal string/int on OrdSingleByteRector (#7928)
rectorphp/rector-symfony 🎵
- [CodeQuality] Allow Doctrine EntityManagerInterface on ControllerMethodInjectionToConstructorRector (#926)
- [CodeQuality] Skip has conflicted param name different object on different method on ControllerMethodInjectionToConstructorRector (#925)
- [Symfony73] Handle with set allowExtraFields named argument on ConstraintOptionsToNamedArgumentsRector (#924)
- Skip classes with Symfony 7.1 Workflow listener attributes (#923), Thanks @dionisvl
rectorphp/rector-doctrine 🟠
- [TypedCollections] Skip with string key already on CompleteReturnDocblockFromToManyRector (#480)
rectorphp/rector-phpunit 🟢
- [CodeQuality] Skip test method via #[Test] Attribute on DataProviderArrayItemsNewLinedRector (#664)
- skip conflicting return node and return type in TypeWillReturnCallableArrowFunctionRector! (#663)
- [Phpunit12] Skip as Argument with required MockObject Type on CreateStubOverCreateMockArgRector (#662)
- feat: add IntersectionType support to PropertyCreateMockToCreateStubRector (#661), Thanks @asumikam
Released Rector 2.3.8
Bugfixes 🐛
- [CodeQuality] Only allow from final class or constant is marked final on VariableConstFetchToClassConstFetchRector (#7904)
- [CodeQuality] Skip custom exception param order flipped on no namespace on ThrowWithPreviousExceptionRector (#7906)
- [DeadCode] Skip different default param not typed on RemoveParentDelegatingConstructorRector (#7905)
- [DeadCode] Skip non-literal 0 or 1 usage on RemoveDeadZeroAndOneOperationRector (#7907)
- [TypeDeclarationDocblocks] Typo fix RuleDefinition description on AddVarArrayDocblockFromDimFetchAssignRector (#7902)
- [Php83] Fix infinite add - remove #[Override] on tearDown() method on AddOverrideAttributeToOverriddenMethodsRector when combined with NoSetupWithParentCallOverrideRector (#7903)
rectorphp/rector-symfony
- [CodeQuality] Skip symfony UuidV4 on ControllerMethodInjectionToConstructorRector (#922)
Released Rector 2.3.7
New Features 🥳
- feat: add ComposerPackageConstraintInterface (#7877), Thanks @calebdw!
- Add AddOverrideAttributeToOverriddenPropertiesRector for PHP 8.5 (#7880), Thanks @carlos-granados!
Bugfixes 🐛
- Skip ClosureToArrowFunctionRector when closure has @ var docblock (#7885), Thanks @QDenka!
- [Php80] Skip property hook with indirect set on ClassPropertyAssignToConstructorPromotionRector (#7887)
- [Php70] Keep right parentheses on TernaryToNullCoalescingRector (#7889)
- Bump nette/utils to ^4.1.3 (part 2) (#7894)
- [Php72] Handle crash on hex backreference on PregReplaceEModifierRector (#7896)
- Update code sample for SimplifyEmptyCheckOnEmptyArrayRector (#7897), Thanks @ramonrietdijk!
- [Php80] Handle Behat transform annotation (#7899), Thanks @loic425!
- fix: Skip attribute decorated parameters in
RemoveParentDelegatingConstructorRector(#7900), Thanks @marcreichel! - [DeadCode] Handle only remove 1 @ var on multi vars on RemoveUselessVarTagRector (#7884)
- Fix abstract declaration in fixture source (#7901), Thanks @Victor-Vechi!
rectorphp/rector-symfony 🎵
- [CodeQuality] Skip DateTimeInterface instance on ControllerMethodInjectionToConstructorRector (#921)
- [Symfony73] Skip with @ Translate docblock on ConstraintOptionsToNamedArgumentsRector (#920)
rectorphp/rector-phpunit 🟢
- [PhpUnit 8] Skip on possible return array on SpecificAssertContainsRector (#660)
- [CodeQuality] check class exists on BehatPHPUnitAssertToWebmozartRector (#659)
- [behat] Add
BehatPHPUnitAssertToWebmozzartRector(#658) - [code-quality] Add
AddKeysExistsAssertForKeyUseRector(#657) - [PHPUnit120] Skip non-mock object on AllowMockObjectsWithoutExpectationsAttributeRector (#656)
- [CodeQuality] Skip on non-mock object on DecorateWillReturnMapWithExpectsMockRector (#655)
- [CodeQuality] Skip first class callable on DecorateWillReturnMapWithExpectsMockRector (#654)
- improve DecorateWillReturnMapWithExpectsMockRector edge cases (#653)
- convert tearDown in NoSetupWithParentCallOverrideRector as well (#652)
- [config] split off 12.5 set, just to improve readability (#651)
rectorphp/rector-downgrade-php ⬇️
Released Rector 2.3.6
New Features 🥳
- Allow using a canonical
rector.dist.phpdist file (#7845), Thanks @carlos-granados!
Bugfixes 🐛
- [Php83] Handle parent class consume trait on AddOverrideAttributeToOverriddenMethodsRector (#7868)
- Fix fixture source warning on AddOverrideAttributeToOverriddenMethodsRector (missing TestCase suffix) (#7869)
- add JSON_THROW_ON_ERROR even if there is already a flag (#7867), Thanks @Lenny4!
- [DeadCode] No need additional parentheses () on multiply to function call (#7883)
- [Php80] Handle crash on empty name attribute field value on AnnotationToAttributeRector (#7864)
- Fix JsonValidateRector: remove associative argument not supported by json_validate (#7865), Thanks @carlos-granados!
- Fix deep ArrayItem scope filling on Foreach_ value (#7873)
- Fix StaticCallOnNonStaticToInstanceCallRector for same-class calls (#7876), Thanks @carlos-granados!
- Bump PHPStan to 2.1.38 (#7879)
- [DeadCode] Allow remove @var on expression assign on RemoveUselessVarTagRector (#7871)
- [DeadCode] Handle multiply to parenthesized on RemoveDeadZeroAndOneOperationRector (#7882)
rectorphp/rector-symfony 🎵
rectorphp/rector-phpunit 🟢
- [phpunit 12] Add CreateStubInCoalesceArgRector (#650)
- [code-quality] Add DecorateWillReturnMapWithExpectsMockRector (#649)
- [code-quality] Add RemoveStandaloneCreateMockRector (#648)
- add class method (#647)
- improve check for used mock property (#646)
- skip if used in array (#645)
- [code-quality] Add RemoveNeverUsedMockPropertyRector (#644)
- [phpunit 12] Add AllowMockObjectsForDataProviderRector (#643)
- add to setUp with only variables (#642)
- [phpunit 12] Add AllowMockObjectsWhereParentClassRector (#641)
- improve AllowMockObjectsWithoutExpectationsAttributeRector (#639)
- add fixture (#638)
- handle in call likes as well (#637)
- [code-quality] Add InlineStubPropertyToCreateStubMethodCallRector (#636)
- skip property fetch in CreateStubOverCreateMockArgRector (#635)
- [phpunit 12] Add PropertyCreateMockToCreateStubRector (#634)
- add variable support to CreateStubOverCreateMockArgRector (#633)
- [CodeQuality] Add failing fixture crash on deep ArrayItem as Foreach_ value on DirectInstanceOverMockArgRector (#632)
- skip abstract entity and interface, as cannot be instantiated (#630)
- [code-quality] Add ConfiguredMockEntityToSetterObjectRector (#629)
- [code-quality] Add AssertThatToDirectAssertRector (#627)
- [phpunit 12] Add ExpressionCreateMockToCreateStubRector (#626)
- cover interfaces in BareCreateMockAssignToDirectUseRector (#625)
- [code-quality] Add SuffixMockObjectPropertyRector, not enabled (#622)
- [phpunit 12] Add ExplicitMockExpectsCallRector (#621)
Released Rector 2.3.5
New Features 🥳
Bugfixes 🐛
- Fix ArrayItem scope filling on Foreach_ value (#7858)
- Fix use of deprecated Node\Expr\ArrayItem over Node\ArrayItem (#7859)
- make PropertyFetchFinder more generic (to be used in rector-phpunit) (#7860)
- Fix arrow function scope search in BetterNodeFinder (#7861)
rectorphp/rector-symfony 🎵
rectorphp/rector-doctrine 🟠
- [ODM 2.16] Rename 'Doctrine\ODM\MongoDB\Mapping\Annotations' namespace to 'Doctrine\ODM\MongoDB\Mapping\Attribute' (#477), Thanks @mickverm
rectorphp/rector-phpunit 🟢
Released Rector 2.3.4
Released Rector 2.3.3
Bugfixes 🐛
- rectorphp/rector-src@61f8719 Pin PHPStan 2.1.34, as 2.1.35 introduced a complex regression breaking Rector - see rectorphp/rector-src#7847
Released Rector 2.3.2
New Features 🥳
- [dx] Rename
DeprecatedAnnotationToDeprecatedAttributeRectorfor PHP 8.5 to explicit ConstAndTraitDeprecatedAttributeRector, add trait suport (#7823)
Bugfixes 🐛
- Bump to PHPStan 2.1.34 and fix compatible code (rectorphp/rector-src#7844)
- [perf] optimize ParamTypeByMethodCallTypeRector for speed with early checks (#7831)
- make resolveClassReflection non-nullable as always passed a node (#7833)
- [Php74] Skip closure in attribute on ClosureToArrowFunctionRector (#7834)
- Manage named arguments when removing values (#7835), Thanks @carlos-granados!
- bump to PHP 8.3 + update deps + allow it in CI (#7838)
- Support array_values in ArrayFirstLastRector (#7830), Thanks @Orest-Divintari!
- [Php85] Skip as assigned var/op on ArrayFirstLastRector (#7843)
- Remove no longer needed tweak AlwaysRememberedExpr on Printer per PHPStan 2.1.34 (#7770)
rectorphp/rector-phpunit 🟢
- fix a class name that should be string (#607)
- Support array_values in ArrayFirstLastRector (#7830), Thanks @Orest-Divintari!
- [Php85] Skip as assigned var/op on ArrayFirstLastRector (#7843)