Releases: rectorphp/rector
Releases · rectorphp/rector
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)
Released Rector 2.2.4
New Features 🥳
- [code-quality] Add RepeatedAndNotEqualToNotInArrayRector (#7517)
- [code-quality] Add ReplaceConstantBooleanNotRector (#7527)
- [code-quality] Add VariableConstFetchToClassConstFetchRector (#7457)
- [coding-style] Add BinaryOpStandaloneAssignsToDirectRector (#7466)
Bugfixes 🐛
- Fix autoload preload on PHPUnit 12+ on global installation (#7468) (#7472) (#7475)
- [TypeDeclaration] Skip override from parent method on
AddParamStringTypeFromSprintfUseRector(#7479) - Run PHPUnit 12 and PHPStan compatibilty check (#7455)
- [TypeDeclarationDocblocks] Handle repeated item type on DocblockReturnArrayFromDirectArrayInstanceRector (#7459)
- [BetterPhpDocParser] Unique handling string on
BracketsAwareUnionTypeNode(#7462) - [CodeQuality] Skip non-variable fetch on
VariableConstFetchToClassConstFetchRectoras may cause side effect (#7464) - [CodingStyle] Skip any CallLike with args !== [] on
BinaryOpStandaloneAssignsToDirectRector(#7469) - [CodingStyle] Skip compare binary op on BinaryOpStandaloneAssignsToDirectRector (#7470)
- [CodingStyle] Skip by ref params on BinaryOpStandaloneAssignsToDirectRector (#7471)
Removed and deprecated 💀
- [deprecated] Deprecate
strict-typesrules as risky and not practical (#7523) - [DeadCode] Skip vars exists in static vars on RemoveNonExistingVarAnnotationRector (#7463)
- [autoload] Remove PHPUnit version 12 check on preload.php load (#7474)
- [Removal] Remove --kaizen option, as it might jump right to risky rules, use levels instead (#7478)
rectorphp/rector-phpunit
Released Rector 2.2.3
New Features 🥳
- [code-quality] Add
VariableConstFetchToClassConstFetchRector(#7457) - [coding-style] Add
BinaryOpStandaloneAssignsToDirectRector(#7466) - [type-declaration] Add
AddParamStringTypeFromSprintfUseRector(#7477)
Bugfixes 🐛
- [TypeDeclaration] Skip override from parent method on AddParamStringTypeFromSprintfUseRector (#7479)
- [ci] Run PHPUnit 12 and PHPStan compatibilty check (#7455)
- [TypeDeclarationDocblocks] Handle repeated item type on DocblockReturnArrayFromDirectArrayInstanceRector (#7459)
- [BetterPhpDocParser] Unique handling string on BracketsAwareUnionTypeNode (#7462)
- [CodeQuality] Skip non-variable fetch on VariableConstFetchToClassConstFetchRector as may cause side effect (#7464)
- Fix autoload preload on PHPUnit 12+ on global installation (#7468)
- [DeadCode] Skip vars exists in static vars on RemoveNonExistingVarAnnotationRector (#7463)
Removed 💀
- [removal] Remove --kaizen option, as it might jump right to risky rules, use levels instead (#7478)
- remove @experimental from level classes, as used (rectorphp/rector-src@3ff3caa)
Released Rector 2.2.2
This release contains important fix for Rector custom rules running on PHPUnit 12.2+ ✔️
PHPUnit started to preload it's own php-parser version, that conflicts with Rector's one. Now we preload our side first again. Your tests shall run 👍 If not: let us know in: #9416
New Features 🥳
- [tdd] Add
AddParamArrayDocblockBasedOnArrayMapRector(#7435) - [Php85] Add
ShellExecFunctionCallOverBackticksRector(#7445)
Bugfixes 🐛
- [Scoped] Load early preload.php on scoped bootstrap.php on phpunit 12+ running (#7451)
- [autoload] Fix phpstan + rector tests co-run to avoid duplicated php-parser loading error (#7440)
- [Php80] Skip inside by ref method on ChangeSwitchToMatchRector (#7443)
- [Renaming] Allow self/static on RenamePropertyRector (#7444)
- Directly check type of substr() on RecastingRemovalRector (#7446)
- [fix] Skip symfony config closures on FirstClassCallableRector as they do not support first class callables (#7447)
- [DeadCode] Skip ClassLikeNameClassNameImportSkipVoter for RecastingRemovalRector (#7448)
- [dead-code] Skip substr casting removal on PHP 7.x, as can return false|string (#7449)
- [Php74] Skip used in compact on ClosureArrowFunctionAnalyzer (#7453)
- [TypeDeclarationDocblocks] Fix missing backslash on class-string type on DocblockGetterReturnArrayFromPropertyDocblockVarRector (#7454)
Released Rector 2.2.1
Released Rector 2.2
This release includes dozens of fixes, new PHP and Type Declaration rules, many Symfony Console rules improvements...
...and one brand new set: type coverage docblocks 🎉 🎉 🎉
Read the gist on our blog - Rector 2.2: New rules for Array Docblocks
New Features and Improvements 🚀
New rules for Type Coverage Docblocks:
- Add AddReturnDocblockForCommonObjectDenominatorRector (#7249)
- Add AddParamArrayDocblockFromDimFetchAccessRector (#7253)
- Add AddParamArrayDocblockFromDataProviderRector (#7257)
- Add ClassMethodArrayDocblockParamFromLocalCallsRector (#7259)
- Add AddReturnDocblockDataProviderRector (#7266)
- Add fixture for data provider return options (#7268)
- Add AddReturnDocblockForArrayDimAssignedObjectRector (#7302)
- Add DocblockVarArrayFromPropertyDefaultsRector (#7311)
- Add DocblockVarArrayFromGetterReturnRector (#7313)
- Add AddReturnDocblockForJsonArrayRector (#7320)
- Add AddParamArrayDocblockFromAssignsParamToParamReferenceRector (#7323)
- [dx] add withTypeCoverageDocblockLevel() (#7363)
- [dead-code] Add
RemoveUnusedVariableUseRector(#7430) - [Php 8.5] Add WakeupToUnserializeRector (#7242), Thanks @arshidkv12!
- [code-quality] Add
RepeatedOrEqualToInArrayRector(#7400) - [Php 8.1] Add
NullToStrictIntPregSlitFuncCallLimitArgRector(#7240) - feat: add greater and smaller support to StrlenZeroToIdenticalEmptyStringRector (#7329), Thanks @calebdw!
- [TypeDeclaration] Allow empty array to native array on AddMethodCallBasedStrictParamTypeRector (#7342)
- [TypeDeclaration] Allow named arg on AddArrayFunctionClosureParamTypeRector (#7397)
- [type-declarations] Add
KnownMagicClassMethodTypeRector(#7419) - Add rector to migrate __sleep() to __serialize() (#7212), Thanks @arshidkv12!
- [type-declaration] Add
AddParamFromDimFetchKeyUseRector(#7424) - Add first class callable support to
CallUserFuncArrayToVariadicRector(#7428)
Bugfixes 🐛
- fix: remove empty construct when parent has no construct (#7239), Thanks @calebdw!
- fix: overly strict ArraySpreadInsteadOfArrayMergeRector (#7247), Thanks @calebdw!
- [CodingStyle] Skip non-native array type on PHP 7.4 for ArraySpreadInsteadOfArrayMergeRector (#7248)
- fix:
FunctionLikeToFirstClassCallableRector(#7265), Thanks @calebdw! - fix:
EnumCaseToPascalCaseRectorskips existing pascal case (#7264), Thanks @calebdw! - [CodeQuality] Skip init not empty array on InlineArrayReturnAssignRector (#7276)
- fix: EnumCaseToPascalCaseRector bugs (#7278), Thanks @calebdw!
- Avoid complex nesting in ConstantArrayTypeGeneralizer (#7282)
- [TypeDeclaration] Fix return by variable anonymous on ReturnTypeFromReturnNewRector (#7292)
- [Php84] Allow early return on ForeachToArrayAllRector (#7316), Thanks @Orest-Divintari!
- [TypeDeclaration] Fix configurable on IncreaseDeclareStrictTypesRector to show on getrector.com (#7327)
- Skip nested array dim fetch assigns in InlineArrayReturnAssignRector (#7380)
- [CodeQuality] Fix escape character on SimplifyRegexPatternRector (#7390)
- Try use double quote on SimplifyRegexPatternRector (#7392)
- [type-declarations] Open isset check in StrictArrayParamDimFetchRectorTest, move to last position in type-declaration level (#7388)
- [CodeQuality] allow coalesce not on full variable, but dim fetch in StrictArrayParamDimFetchRector (#7404)
- [CodeQuality] Skip bool equal integer on UseIdenticalOverEqualWithSameTypeRector (#7411)
- update comment on fixtures (#7413)
- [CodeQuality] Use ->isBoolean() check on compare boolean and constant bool on UseIdenticalOverEqualWithSameTypeRector (#7415)
Removed 💀
- [Differ] Remove ConsoleDiffer, use DefaultDiffer that utilize ColorConsoleDiffFormatter instead to avoid double diffing process (#7309)
Rector Symfony 🎵
- [Symfony61] Handle already exists attributes name on CommandConfigureToAttributeRector (#849)
- [Symfony 6.2] Move symfony/security-core to security-http and security-bundle as target class/contant exists there (#848)
- [Symfony73] Remove extends AbstractExtension after apply change on GetFunctionsToAsTwigFunctionAttributeRector (#846)
- [code-quality] keep attribute in InlineClassRoutePrefixRector if it contains other metadata (#845)
- [console] [7.3] Add implicit boolean type in InputOption::VALUE_NONE option (#844)
- [console] [7.3] Add type declaration based on default value type in InvokableCommandInputAttributeRector (#843)
- [console] [7.3] add array argument support to /InvokableCommandInputAttributeRector (#842)
- [console] [7.3] Add support for default values in InvokableCommandInputAttributeRector (#841)
- [console] [7.3] Add const names in InvokableCommandInputAttributeRector + fix -_ naming to camel case (#840)
- [console] [7.3] Fix missing options in InvokableCommandInputAttributeRector (#839)
- [console] [7.3] Replace input/output with symfony style if used in InvokableCommandInputAttributeRector (#838)
Rector Doctrine 🟠
- [dbal] [4.0] remove constant rename, as will be turned into enum right away and required manaul upgrade (#467)
- Fix PHPStan notice on PHPStan 2.1.23 (#466)
Rector PHPUnit 🟢
- [CodeQuality] Ensure verify ClassReflection->hasConstructor() on MethodParametersAndReturnTypesResolver (#550)
- [CodeQuality] Skip not match position named argument part 2 (#548)
- [code-quality] add New_ support to ScalarArgumentToExpectedParamTypeRector (#547)
- [phpunit] [9.0] resolve WithConsecutiveRector naming ad-hoc to PHPUnit real code (#546)
Released Rector 2.1.7
New Features 🥳
- Php8.5 OrdSingleByteRector (#7219), Thanks @arshidkv12!
Bugfixes 🐛
- fix: skip privatizing Laravel Model attributes and scopes (#7218), Thanks @calebdw!
- [CodeQuality] Change behaviour of OptionalParametersAfterRequiredRector to fill null default value when previous param is optional (#7222)
- [CodeQuality] Handle intersection on OptionalParametersAfterRequiredRector (#7223)
- [CodeQuality] Fill reasonable default value on OptionalParametersAfterRequiredRector (#7226)
- Support Param nodes in makeNonFinal() (#7228), Thanks @arshidkv12!
- [CodeQuality] Add Closure support on OptionalParametersAfterRequiredRector (#7224)
rectorphp/rector-symfony 🎵
- [console] [7.3] add array argument support to /InvokableCommandInputAttributeRector (#842)
- [console] [7.3] Add support for default values in InvokableCommandInputAttributeRector (#841)
- [console] [7.3] Add const names in InvokableCommandInputAttributeRector + fix -_ naming to camel case (#840)
- [console] [7.3] Fix missing options in InvokableCommandInputAttributeRector (#839)
- [console] [7.3] Replace input/output with symfony style if used in InvokableCommandInputAttributeRector (#838)
rectorphp/rector-doctrine 🟠
- add target document support to CompletePropertyDocblockFromToManyRector (#465)
- add support for multiple items (#464)
- [typed-collections] Add CollectionDocblockGenericTypeRector (#463)
- fix document service repository class (#462)
- [code-quality] add document repository support to AddAnnotationToRepositoryRector (#461)
rectorphp/rector-phpunit 🟢
- [code-quality] add local call support to ScalarArgumentToExpectedParamTypeRector (#543)
- cover scalar argument in behat as well (#542)
- [CodeQuality] Skip not match position named argument on ScalarArgumentToExpectedParamTypeRector (#540)
- add float support to scalar argument rule (#539)
- Add nullable support to ScalarArgumentToExpectedParamTypeRector (#538)
- [CodeQuality] Handle crash on no @Depends on AddParamTypeFromDependsRector (#537)