Releases: rectorphp/rector
Releases · rectorphp/rector
Released Rector 2.2.14
Bugfixes 🐛
- [fix] warn early about deprecated skipped rules, as not neccessary to skip anymore + restore
FirstClassCallableRectorand mark as deprecated to keep BC (#7742)
Released Rector 2.2.13
Bugfixes 🐛
- [fix] restore missing pInterpolatedStringPart(), cover with test (#7741)
Released Rector 2.2.12
Bugfixes 🐛
- [cleanup] Make FirstClassCallableRector use attributes over node traverser hacks (#7696)
- [CodingStyle] Skip enum case on
NewlineBetweenClassLikeStmtsRector(#7698), Thanks @parth391! - [fix] skip all-but standalone assign on
SetTypeToCastRector(#7699) - [fix] avoid changing generic interface in NarrowObjectReturnTypeRector, focus on objects as in definition (#7700)
- Remove direct
NodeTravser::*where possible, use node visitor attribute key instead (#7697)
Removed and Deprecated 💀
- [dx] add stmts aware deprecation notice in `getNodeTypes()`` (#7692)
rectorphp/rector-symfony 🎵
Released Rector 2.2.11
Bugfixes 🐛
- [cleanup] Make FirstClassCallableRector use attributes over node traverser hacks (#7696)
- [CodingStyle] Skip enum case on NewlineBetweenClassLikeStmtsRector (#7698), Thanks @parth391!
- [fix] skip all-but standalone assign on SetTypeToCastRector (#7699)
- [fix] avoid changing generic interface in NarrowObjectReturnTypeRector, focus on objects as in definition (#7700)
- [transform] tidy up array dim fetch to method call rector (#7694)
- Remove direct NodeTravser::* where possible, use node visitor attribute key instead (#7697)
Removed and Deprecated 💀
- [dx] add stmts aware deprecation notice in getNodeTypes() (#7692)
rectorphp/rector-symfony
Released Rector 2.2.10
New Features and Improvements 🥳
- Support Attribute in
SortNamedParamRector(#7684), Thanks @VincentLanglet!
Bugfixes 🐛
- [PhpParser] Add Stmt\Block to NodeGroup::STMTS_AWARE (#7689)
- skip already dim fetch variable on OrdSingleByteRector (#7681)
- [Php85] Handle crash on no arg on OrdSingleByteRector (#7682)
- [Php70] Handle return ternary on IfIssetToCoalescingRector (#7683)
- [CodingStyle] Skip use trait on NewlineBetweenClassLikeStmtsRector (#7685)
- [CodingStyle] Handle use trait after property on
NewlineBetweenClassLikeStmtsRector(#7687) - [CodeQuality] Skip with HTML on
ShortenElseIfRector(#7686) - [Variables] Fetch list super global variable names from PHPStan Scope::SUPERGLOBAL_VARIABLES constant (#7663)
- Fix typo in rule definition message (#7690), Thanks @simonschaufi!
rectorphp/rector-symfony 🎵
- [code-quality] Skip enum in ControllerMethodInjectionToConstructorRector (#893)
- [symfony 7.3] Add CommandDefaultNameAndDescriptionToAsCommandAttributeRector (#892)
- [symfony 7.x] update sets (#890)
- [CodeQuality] Skip parent method exists on ControllerMethodInjectionToConstructorRector (#889)
- skip params with attributes in ControllerMethodInjectionToConstructorRector (#887)
- [stmts-aware] Use NodeGroup::STMTS_AWARE over StmtsAwareInterface (#886)
rectorphp/rector-phpunit 🟢
- [fix] Improve AssertComparisonToSpecificMethodRector for assert false (#594)
Released Rector 2.2.9
New Features and Changes 🥳
- [exp] Add
RemoveReturnThisFromSetterClassMethodRector(#7624) - [exp] Add
FluentSettersToStandaloneCallMethodRector(#7625) - [dead-code] Add
RemoveNextSameValueConditionRector(#7525) - Update PHP upgrade support to version 8.5 (#7644), Thanks @guilheb!
- [stmts-aware] Deprecate
StmtsAwareInterfaceinterface and replace with meta-type + groups (#7679) - How to upgrade?
Bugfixes 🐛
- Improve parent call fixture in Php4ConstructorRector not to use KEY constant (#7642)
- Improve ClassPropertyAssignToConstructorPromotionRector not to use STMT_KEY attribute value (#7645)
- [TypeDeclaration] Handle crash on combine union types on AddClosureParamTypeForArrayReduceRector (#7636)
- [TypeDeclaration] Skip no key generic object return on NarrowObjectReturnTypeRector (#7623)
- [CodingStyle] Do not use FullyQualified on "self" on
ClosureFromCallableToFirstClassCallableRector(#7632), Thanks @devnix! - [Php80] Handle mix still annotation and already attribute on AnnotationToAttributeRector (#7639), Thanks @acoulton!
- cleanup RemoveUnsuedPrivateMethodRector (#7643)
- re-index changed nodes only (#7651)
- avoid
spl_object_id()if no change in AbstractRector (#7653) - Refine bug report template formatting (#7655), Thanks @u01jmg3!
- [Php85] Skip inside expression assign on ArrayFirstLastRector (#7657)
- Rename SymplifyQuoteEscapeRector to SimplifyQuoteEscapeRector (#7658), Thanks @VincentLanglet!
- docs: fix typos in deprecation notice (#7666), Thanks @sir-kain!
- [Dep] Ignore unknown class error on build/config/config-downgrade.php on shipmonk/composer-dependency-analyser to 1.8.4 (#7668)
- [dx] Make registration of custom NodeVisitor is easier (#7669)
- raise deps (rectorphp/rector-src@440d6d7)
- [Experiment][Printer] Move AlwaysRememberedExpr tweak logic to separate service after a Match_ found (#7654)
- Narrow object return type v2 (#7618), Thanks @Orest-Divintari!
- [Php80] Handle OpenApi\Attributes\Property example to keep numeric string on AnnotationToAttributeRector (#7677)
- keep file without namespace implementing interface to alling with other nodes (#7679)
- [EarlyReturn] Handle If, elseIf, else all returned on RemoveAlwaysElseRector (#7659)
- [DeadCode] skip Ds\Map::get() on RemoveNullArgOnNullDefaultParamRector (#7665)
Removed 💀
- [DeadCode] Skip used from property fetch reference on loop on RemoveUnusedVariableAssignRector (#7635)
- [internal] Extract ImmutableNodeTraverser from vendor, to remove patch and keep using cache for node types (#7634)
- Deprecated STMT_KEY and remove its set attribute value (#7647)
- [attribute] Remove unused AttributeKey::REPRINT_RAW_VALUE (#7664)
rectorphp/rector-symfony 🎵
- [stmts-aware] Use NodeGroup::STMTS_AWARE over StmtsAwareInterface (#886)
- Fix rule when method is __invoke (#884), Thanks @wilfi00
- [CodeQuality] Do not replace variable assign on ControllerMethodInjectionToConstructorRector (#883)
- Handle Doctrine constraints in ConstraintOptionsToNamedArgumentsRector (#882), Thanks @johndodev
- [CodeQuality] Skip FOS\RestBundle ParamFetcher on ControllerMethodInjectionToConstructorRector (#881)
- [CodeQuality] Skip autowire() method via @required and Required attribute (#880)
- Fix scoped \ cleared on single quote string on ControllerMethodInjectionToConstructorRector (#879)
- [CodeQuality] Skip Common Entity contains subnamespaces on ControllerMethodInjectionToConstructorRector (#878)
- [CodeQuality] Skip from route path /edit/{id} on ControllerMethodInjectionToConstructorRector (#877)
- handle use var (#875)
- Remove STMT_KEY from rules (#874)
- Remove stmt key from LogoutHandlerToLogoutEventSubscriberRector (#870)
- Fix build of prefixed SymfonyFunctionName::REF and SymfonyFunctionName::SERVICE usage (#869)
- [config] Fix couple config autowire rules (#868)
- Fix unit test (#867)
- skip constructor in ControllerMethodInjectionToConstructorRector (#866)
- [code-quality] Add ControllerMethodInjectionToConstructorRector (#865)
rectorphp/rector-phpunit 🟢
- [CodeQuality] Skip Generator on AssertCompareOnCountableWithMethodToAssertCountRector (#591)
- remove stmt key from ConstructClassMethodToSetUpTestCaseRector (#590)
- Remove stmt key from TestListenerToHooksRector (#589)
- fix phpunit covers default class with short covers methods (#588), Thanks @irosner
- [CodeQuality] Do not use FullyQualified on "self" on WithCallbackIdenticalToStandaloneAssertsRector (#587)
- [phpunit 10] Improve PropertyExistsWithoutAssertRector coverage (#586)
- [depre] Deprecate AssertPropertyExistsRector as method was removed in PHPUnit 10 (#585)
- [depre] Deprecate RemoveDataProviderParamKeysRector as the keys can be useful to improve test readability (#584), Thanks @MacDada
- [CodeQuality] Handle on without namespace on DeclareStrictTypesTestsRector (#583)
Released Rector 2.2.8
New Features 🥳
- [type-declaration] Add return data provider array type from strict test method param (#7605)
- [coding-style] Add NestedTernaryToMatchRector (#7572)
- [TypeDeclaration] Register NarrowObjectReturnTypeRector to type declaration set (#7615)
Bugfixes 🐛
- [Diffs] Handle --no-diffs usage to show file have been changed if any with --dry-run + --no-diffs (#7619)
- [Php81] Skip callable variadic in array_all() on FunctionLikeToFirstClassCallableRector (#7606)
- fix a syntax error in the ArrayFirstLastRector rule documentation (#7613), Thanks @esnard!
- Narrow object return type (#7575), Thanks @Orest-Divintari!
- [type-declaration] Rename NarrowTooWideReturnType to NarrowWideUnionReturnTypeRector (#7614)
- [TypeDeclaration] Also update generic collection docblock on NarrowObjectReturnTypeRector (#7616)
- [TypeDeclaration] Do not change valid generic docblock on NarrowObjectReturnTypeRector (#7617)
- [Privatization] Do not remove readonly on promoted property on PrivatizeFinalClassPropertyRector (#7611)
Removed 💀
- [dx] help - omit explicit command name as no longer needed; remove verbosity option, use debug instead (#7620)
rectorphp/rector-symfony 🎵
- ensure reset args after loop (#864)
- Bump PHPStan to ^2.1.32 and fix test for InlineClassRoutePrefixRector (#863)
- [Symfony74] replace PropertyMetadata deprecated functions (#862), Thanks @MrYamous
- [Symfony74] update WorkflowDumpCommand namespace (#861), Thanks @MrYamous
- add property support to ErrorNamesPropertyToConstantRector (#860)
- Support converting all options to twig attributes (#859), Thanks @Spea
rectorphp/rector-phpunit 🟢
- [CodeQuality] Skip in static method on AssertFuncCallToPHPUnitAssertRector (#582)
- add implicit method call support (#581)
- add multi callbacks support (#580)
- allow extra stmt (#579)
- add dynamic instanceof support (#578)
- [code-quality] Add SimplerWithIsInstanceOfRector (#577)
- add sole instanceof support (#576)
- add use var (#575)
- add return type or empty if nothing to add (#574)
- [code-quality] Add MergeWithCallableAndWillReturnRector (#573)
- handle solo identical as well, to get better message (#572)
- always return true, as required by contract (#571)
- add external variable use (#570)
- add isset support, revert order to respect original one (#569)
- [code-quality] Add WithCallbackIdenticalToStandaloneAssertsRector (#568)
rectorphp/rector-downgrade-php ⬇️
- Bump to PHPStan ^2.1.32 and ignore false positive instanceof in OR usage (#344)
Released Rector 2.2.7
New Features 🥳
- [type-declaration] Add ReturnIteratorInDataProviderRector (#7593)
- [type-declarations] Add TypedStaticPropertyInBehatContextRector (#7596)
- [DeadCode] Register RemoveNullArgOnNullDefaultParamRector to dead code set (#7597)
- [php 8.5] Split of nested functions calls to pipe operator in a new standalone rule (#7603)
Bugfixes 🐛
- always add nullable on TypedPropertyFromJMSSerializerAttributeTypeRector as serializer does not use constructor (#7599)
- [Php81] Skip callable param union on FunctionLikeToFirstClassCallableRector (#7589)
- [CodeQuality] Skip ArrayDimFetch with BitwiseXor on CombinedAssignRector (#7590)
- [Php84] Skip variable extraction with return early on ForeachToArrayAllRector (#7591)
- [PHP 8.5] rename NestedToPipeOeratorRector to SequentialAssignmentsToPipeOperatorRector, handle only assigns, not nested calls (#7588)
- [Php81] Skip as Arg of non-native function call on FunctionLikeToFirstClassCallableRector (#7592)
- skip different args passed to call-like and required by arrow function in FunctionLikeToFirstClassCallableRector (#7594)
- handle public properties in TypedPropertyFromJMSSerializerAttributeTypeRector as nullable (#7595)
- skip to many in /TypedPropertyFromJMSSerializerAttributeTypeRector (#7598)
- skip refernce one as well in /TypedPropertyFromJMSSerializerAttributeTypeRector (rectorphp/rector-src@842aa94)
- split TypedPropertyFromJMSSerializerAttributeTypeRector to scalar and object types (#7602)
- Don't require parentheses for short-ternaries (#7604), Thanks @martinstuecklschwaiger!
rectorphp/rector-symfony 🎵
- [Configs] Skip first class callable on RemoveConstructorAutowireServiceRector (#858)
rectorphp/rector-phpunit 🟢
- [depre] Deprecate SetUpBeforeClassToSetUpRector as can break code easily (#567)
Released Rector 2.2.6
New Features 🥳
- [PHP 8.5] Add
NestedToPipeOperatorRector(#7577) - [code-quality] Add
DirnameDirConcatStringToDirectStringPathRector(#7552) - [dead-code] Add
RemoveNullArgOnNullDefaultParamRector(#7562) - register AddClosureParamTypeFromIterableMethodCallRector to type declaration set (rectorphp/rector-src@4d78f41)
- register AddParamArrayDocblockBasedOnCallableNativeFuncCallRector in type declaration docblocks (rectorphp/rector-src@80f7db8)
Bugfixes 🐛
- Fix next catch missed variable rename in CatchExceptionNameMatchingTypeRector (#7547)
- [Php81] Fix first class callable should not have trailing comma on FunctionLikeToFirstClassCallableRector (#7551)
- [CodingStyle] Skip Method target not found or defined only via @method on FunctionLikeToFirstClassCallableRector (#7553)
- [Php81][CodingStyle] Allow both exists in both @method and native method on FunctionLikeToFirstClassCallableRector (#7559)
- [Php81][CodingStyle] Skip param used as invokable function multi args on FunctionLikeToFirstClassCallableRector (#7563)
- [Php81][CodingStyle] Skip Closure/ArrowFunction as assign expr on FunctionLikeToFirstClassCallableRector (#7564)
- finalize rules as well (#7575), Thanks @Orest-Divintari!
- [Php85] Clean up dynamic expr check on NestedToPipeOperatorRector (#7578)
- [Php81] Skip Closure bindTo on FunctionLikeToFirstClassCallableRector (#7581)
- Remove trait support rom AddParamBasedOnParentClassMethodRector as depends on context; move to Class_ node hooking for efficiency (#7587)
- [Php85] Handle indent inside class method on NestedToPipeOperatorRector (#7584)
- make DeclareStrictTypesRector skip files without namespace, as very risky in files without PSR-4 autodiscovery (#7585)
- speedup - skip refleciton if all params are typed (rectorphp/rector-src@08f6dc3)
- skip all-typed properties in TypedPropertyFromStrictConstructorRector (rectorphp/rector-src@c5d9fdf)
- skip no-type params in RenameParamToMatchTypeRector (rectorphp/rector-src@cd7eb93)
- optimize ParamTypeByParentCallTypeRector to handle only classes with parents and method without param type (rectorphp/rector-src@0ca4e91)
- [DeadCode] Allow FuncCall on RemoveNullArgOnNullDefaultParamRector (#7567)
- [DeadCode] Handle with middle default not null on RemoveNullArgOnNullDefaultParamRector (#7565)
- [DeadCode] Allow remove named argument if position is match with param on RemoveNullArgOnNullDefaultParamRector (#7566)
- [comments] Remove attribute comments support as comments require standalone line before any doctrine annotation (#7582)
Removed and Deprecated 💀
- [depre] Deprecate ParentClassToTraitsRector as very narrow use case to be generic, create custom rule instead (#7550)
- [depre] Deprecate ReplaceParentCallByPropertyCallRector as not used since doctrine set service removed, not standalone rule (#7554)
- [depre] Deprecate MethodCallToNewRector as not used and based on assumptions (#7555)
- [depre] Deprecate MethodCallToPropertyFetchRector, as not practical/used and part of removed set (#7556)
- [depre] Deprecate MethodCallToPropertyFetchRector as not used and part of removed set (#7557)
- [depre] Deprecate PropertyFetchToMethodCallRector not used and as too generic, use custom rule instead (#7558)
- [depre] Deprecate PropertyAssignToMethodCallRector as too narrow use-case and never used (#7561)
- [depre] Deprecate ReturnTypeWillChangeRector as discourages from filling correct types, use type declaration set instead (#7570)
- [depre] Deprecate MultiDimensionalArrayToArrayDestructRector as not part of any set, can create less readable and harder to analyse code (#7573)
- [depre] Deprecate InlineVarDocTagToAssertRector as not par of any set, and create prod crashing code (#7574)
- [depre] Deprecate AddAllowDynamicPropertiesAttributeRector, as not in PHP sets and does not help by adding attribute everywhere (#7568)
- [depre] Deprecate AddLiteralSeparatorToNumberRector as cannot be automated and depends on context (#7569)
rectorphp/rector-symfony 🎵
- [Configs] Skip first class callable on RemoveConstructorAutowireServiceRector (#858)
- [config] Add FromServicePublicToDefaultsPublicRector (#857)
- cover 2nd arg class in RemoveConstructorAutowireServiceRector (#856)
- [config] Add RemoveConstructorAutowireServiceRector (#855)
- [Symfony73] Skip empty result of named arguments on ConstraintOptionsToNamedArgumentsRector (#853)
- [depre] Deprecate StringExtensionToConfigBuilderRector as deprecated in Symfony 7.4 (#854)
rectorphp/rector-phpunit 🟢
- [code-quality] Add DeclareStrictTypesTestsRector to code-quality test (#566)
- [depre] Deprecate AddParentSetupCallOnSetupRector as not generic to be automated, fill manually where needed (#565)
- [CodeQuality] Skip used inside static closure on AssertFuncCallToPHPUnitAssertRector (#564)
- register ReplaceAtMethodWithDesiredMatcherRector to code-quality (#563)
- [depre] Deprecate CreateMockToAnonymousClassRector as requires manual work, often value object setter can be better alternative (#562)
Released Rector 2.2.5
Rules Registered in sets 🥳
Couple long-existing rules were added to PHP 8.1, code quality and type declaration sets after optional community testing ✔️
If you'll experience any undersired changes, let us know 👍
- register AddClosureParamTypeForArrayMapRector in type declaration level (rectorphp/rector-src@68bb0cc)
- register AddClosureParamTypeForArrayReduceRector to type declaration level (rectorphp/rector-src@38ecb98)
- improve description (rectorphp/rector-src@1ae7187)
- add FunctionFirstClassCallableRector to PHP 8.1 set (rectorphp/rector-src@0e18562)
- register ReplaceConstantBooleanNotRector in code-quality level (rectorphp/rector-src@e164069)
- register ClosureFromCallableToFirstClassCallableRector to PHP 8.1 set (rectorphp/rector-src@d229205)
- register NewInInitializerRector in PHP 8.1 (#7545)
Bugfixes 🐛
- [fix] skip variadic param on ParamTypeByParentCallTypeRector (#7532)
- [Php81][CodingStyle] Skip multi params on FunctionLikeToFirstClassCallableRector (#7537)
- [Php81][CodingStyle] Skip callable param assign with signature multi params on FunctionLikeToFirstClassCallableRector (#7538)
- Fix NullToStrictStringFuncCallArgRector with probabilistic check for plural array passed to function where array allowed (#7539)
- [Php81][CodingStyle] Skip variadic not used on FunctionLikeToFirstClassCallableRector (#7540)
- [Php81] Keep nullable param on NewInInitializerRector (#7545)
- [php 8.1] skip nullable property without null default in NewInInitializerRector (#7546)
Removed and deprecated 💀
- [depre] Deprecate 3 configurable-only, never used closure param rules as too specific (#7541)
- [depre] Deprecate RenameFunctionLikeParamWithinCallLikeArgRector as never used, too narrow and better suits custom project (#7544)
- [depre] Deprecate AddTypeFromResourceDocblockRector as breaks code and does not solve any real problem (#7542)
- [Php81] Completely remove AttributeGroupNewLiner (#7536)
rectorphp/rector-phpunit 🟢
- [depre] Add never used AddCoversClassAttributeRector, as very opionated and requires very specific file location - use custom rule instead (#561)
- Fix implicit PHP and PHPUnit version in RequiresAnnotationWithValueToAttributeRector (#560)
- [code-quality] Add AssertArrayCastedObjectToAssertSameRector (#559)