Releases: rectorphp/rector
Releases Β· rectorphp/rector
Released Rector 1.2.7
New Features π₯³
- Apply AddOverrideAttributeToOverriddenMethodsRector to traits (#6367), Thanks @jrjohnson!
- [Transform] MethodCall to New (#6352), Thanks @peterfox!
- Add RemoveTypedPropertyNonMockDocblockRector (#6306)
- [DX] Add links to open the editor to the names of processed files and the names of rules applied (#6272), Thanks @carlos-granados!
Bugfixes π
- Fixed --memory-limit=-1 option handling when used in parallel (#6349), Thanks @ddegasperi!
- [Php70] Fix delimiter in the middle on EregToPregMatchRector (#6356)
- [Php70] More delimiter case in the middle fix on EregToPregMatchRector (#6357)
- [Php80] Cast string/int for int vs string condition and case condition on ChangeSwitchToMatchRector (#6359)
- [DeadCode] Skip from call with return docblock on ReduceAlwaysFalseIfOrRector (#6361)
- [TypeDeclaration] Closure Param Types from Iterator Source (#6345), Thanks @peterfox!
- [Privatization] Allow privatize protected promoted property on PrivatizeFinalClassPropertyRector (#6360)
- [DeadCode] Skip with Else and ElseIf on SimplifyIfNotNullReturnRector (#6365)
- [Php70] Handle empty branch crash on unprintable char \x0C on EregToPregMatchRector (#6368)
- [UnusedImport] Different letter case for classes + optimization (#6362), Thanks @jorgsowa!
- [CodeQuality] Skip else indirect return on SimplifyIfReturnBoolRector (#6371)
- [CodeQuality] Clean up else check on SimplifyIfReturnBoolRector (#6372)
- [TypeDeclaration] Fix deep nested array docblock with \ prefix on ReturnTypeFromStrictNewArrayRector (#6373)
- [EarlyReturn] Skip nested with OR in root if statement condition on ChangeNestedForeachIfsToEarlyContinueRector (#6375)
- [DeadCode] Skip RemoveUnusedPrivatePropertyRector in middle assign (#6363)
Removed π
- [NodeAnalyzer] Remove ClassAnalyzer::isAnonymousClassName() (#6351)
- [NodeAnalyzer] Remove unused AstResolver on VariadicAnalyzer (#6353)
- [DeadCode] Clean up double private method filtering on RemoveUnusedPrivateMethodRector (#6364)
- [DeadCode] Skip union docblock param with is_object() native type check on RemoveAlwaysTrueIfConditionRector (#6370)
rectorphp/rector-symfony π΅
- [CodeQuality] Add AddTraitGetterReturnTypeBasedOnSetterRequiredRector (#671)
rectorphp/rector-phpunit π’
- [PHPUnit 10] Add ifs as default way for withConsecutive, as more readable and opens upgrade during PHPUnit 9 (#382)
- Use simple direct assert on consecutive in case of arrow function in callable (#381)
- Use more readable ifs on will return in WithConsecutiveRector (#380)
- add NarrowSingleWillReturnCallbackRector to code quality set (#379)
Released Rector 1.2.6
New Features π₯³
- [TypeDeclaration] Add isset(), empty(), and negation support on BoolReturnTypeFromBooleanStrictReturnsRector (#6339)
- [TypeDeclaration] Add NativeMethodReflection support on ReturnStrictTypeAnalyzer (#6344)
- [DX] Show paths not match any file/directory on ProcessCommand when given path not exists (#6307)
Bugfixes π
- [TypeDeclaration] Convert inline @var tag to assert() (#6300), Thanks @carlos-granados!
- Fix incorrect result after using RemoveByType in PhpDocInfo (#6301), Thanks @carlos-granados!
- [TypeDeclaration] Skip nullable callable on TypedPropertyFromAssignsRector (#6308)
- Fix LocallyCalledStaticMethodToNonStaticRector when static function is called using the class name (#6310), Thanks @carlos-granados!
- [Php81] Handle crash on ArrowFunction attribute on FirstClassCallableRector (#6313)
- [Performance] Reduce double traverse on StrictNativeFunctionReturnTypeAnalyzer (#6320)
- [PhpParser] Alternative PR for findInstancesOfScoped() to keep existing performance (#6324)
- [CodingStyle] Use double quote to escape quotes in EncapsedStringsToSprintfRector (#6326)
- [TypeDeclaration] Handle crash on func call not found on BoolReturnTypeFromBooleanStrictReturnsRector (#6327)
- Fix first class callable to use combineAcceptors() to avoid assert Arg instance error (#6330)
- [Php81] Allow used as assign expr on ReadOnlyPropertyRector (#6331)
- Skip arrow function in scoped search (#6333)
- [TypeDeclaration] Better approach for native type check on ReturnStrictTypeAnalyzer (#6343)
- [DeadCode] Skip extension load append variable on RemoveAlwaysTrueIfConditionRector (#6332)
- [TypeDeclaration] Remove only void type on ReturnedNodesReturnTypeInfererTypeInferer (#6340)
- [DeadCode] Skip indirect next line definition of @var on RemoveNonExistingVarAnnotationRector (#6348)
rectorphp/rector-symfony π΅
rectorphp/rector-phpunit π’
- [CodeQuality] Add NarrowSingleWillReturnCallbackRector (#374)
- [CodeQuality] Add SingleWithConsecutiveToWithRector (#370)
- [CodeQuality] Add NarrowIdenticalWithConsecutiveRector (#369)
- [CodeQuality] Add AddParentSetupCallOnSetupRector (#364)
- Include match() to invoke counting in WithConsecutiveRector (#362)
- Move WithConsecutiveRector to its PHPUnit100 namespace, CreateMockToAnonymousClassRector + PreferPHPUnitSelfCallRector to CodeQuality (#360)
- Add existing willReturnCallback() support to WithConsecutiveRector (#358)
Released Rector 1.2.5
New Features and Improvements π₯³
- 20-30 % Rector speedup - Optimise checking the node types allowed for each rule (#6232), Thanks @carlos-granados!
- [docs] Add help on the default process command (#6226), Thanks @94noni!
- [TypeDeclaration] Adds
AddClosureParamTypeFromArgRector
(#6258) - Adds
AddClosureParamTypeFromObjectRector
(#6265), Thanks @peterfox! - [Config] Improve ComposerJsonPhpVersionResolver API, make use of explicit php set files (#6273)
- [FileSystem] Add data and writable to not include on InitFilePathsResolver (#6285)
- always make paths absolute before processing files (#6293), Thanks @Kanti!
Bugfixes π
- [CodeQuality] Handle crash on first class callable inside match on OptionalParametersAfterRequiredRector (#6263)
- [ReturnTypeInferer] Drop this/static docblock type check on ReturnTypeInferer (#6270)
Removed π
- [deprecated] Remove deprecated ChangeAndIfToEarlyReturnRector, CallableThisArrayToAnonymousFunctionRector + casting rules (#6276)
- [deprecations] Remove deprecated GetClassToInstanceOfRector, UseIncrementAssignRector, DetectNodeCommand (#6278)
- [deprecated] Remove deprecated closure return rules, return type from strict bool/scalar returns (#6287)
rectorphp/rector-symfony π΅
- Add Class_ annotation support to TemplateAnnotationToThisRenderRector (#666)
rectorphp/rector-doctrine π
- Refactor the OrderByKeyToClassConstRector to use the new enum only in
Criteria::orderBy
method calls (#336), Thanks @julienfastre
Released Rector 1.2.4
Bugfixes π
- Fix PropertyTypeFromStrictSetterGetterRector for default null (#6231)
- [Php70] Fix with \r\n on EregToPregMatchRector (#6246)
- Optimise post rectors (#6240), Thanks @carlos-granados!
- [Php84] Do not reprint node type on ExplicitNullableParamTypeRector (#6250)
- Skip Doctrine collections in TypedPropertyFromAssignsRector (#6253)
- Skip Columns from TypedPropertyFromAssignsRector, as handled better in doctrine rules (#6254)
- [AutoImport] Do not add cast on valid Integer type on Name Node on auto import enabled (#6236)
- [AutoImport] Do not add cast on valid Integer type on aliased Name Node on auto import enabled (#6237)
- [Performance] Cache should traverse for AddUseStatementGuard (#6234)
New Features π₯³
- Adds the
ScalarValueToConstFetchRector
rule (#6195), Thanks @peterfox! - [TypeDeclaration] Add
AddParamArrayDocblockBasedOnCallableNativeFuncCallRector
(#6233) - [TypeDeclaration] Add
AddReturnArrayDocblockBasedOnArrayMapRector
(#6235)
Deprecated π
- Deprecate
PublicConstantVisibilityRector
, as adds public blindly everywhere; use scope-based approach instead (#6238)
rectorphp/rector-symfony π΅
- [Symfony 6.1] Skip abstract class on CommandConfigureToAttributeRector (#662)
- [CodeQuality] skip array + non native response return on ResponseReturnTypeControllerActionRector (#661)
- [CodeQuality] Skip posible return array + response on ResponseReturnTypeControllerActionRector (#660)
- Do not convert to array Process->setInput() (#647), Thanks @refsz
rectorphp/rector-doctrine π
- [CodeQuality] Skip blob type on TypedPropertyFromColumnTypeRector (#340)
- Fix attribute support in ImproveDoctrineCollectionDocTypeInEntityRector (#339)
rectorphp/rector-phpunit π΅
- [PHPUnit100] Fix typo in AssertIssetToAssertObjectHasPropertyRector (#356), Thanks @haydulski
- [Prefix] Fix Prefixed PHPUnit Ticket class (#355)
- [CodeQuality] Assert compare on countable (#353), Thanks @peterfox
Released Rector 1.2.3
New Features π₯³
- Add withRealPathReporting() to allow real paths in output formatters (#6187), Thanks @llaville!
- Add known type casting to AnnotationToAttributeRector (#6217)
- Improve Carbon use parse method (#6183), Thanks @florisbosch!
Bugfixes π
- Only import docblock if import name enabled on PostFileProcessor (#6185)
- fix issue #8755 about wrong systemError location (#6184), Thanks @llaville!
- Support more assign cases in PropertyFetchAssignManipulator (#6192), Thanks @andersonamuller!
- Skip Symfony Response in ReturnTypeFromReturnNewRector (#6202)
- Skip only response inside controller class (#6204)
- [Php54] No need reprint when array is just created on LongArrayToShortArrayRector (#6206)
- [TypeDeclaration] Handle crash on nullable intersection on ClosureReturnTypeRector (#6213)
- [Php71] Allow multiple same catches on MultiExceptionCatchRector (#6218)
- [CodeQuality] Skip Generator on SimplifyForeachToCoalescingRector (#6221)
- [CodeQuality] Ensure check native array type on Foreach* rules (#6222)
- [TypeDeclaration] Skip isset and empty with index on param variable on StrictArrayParamDimFetchRector (#6227)
- [TypeDeclaration] Skip mixed in union on ClosureReturnTypeRector (#6228)
Removed π
rectorphp/rector-symfony π΅
- Add the Symfony 7.0 set to SymfonySetList.php (#659), Thanks @pbowyer
- [Config] Add ParameterBagToAutowireAttributeRector (#654)
- add void fixture (#653)
- [CodeQuality] Remove no returns check on ResponseReturnTypeControllerActionRector (#652)
- Add new Response() support to ResponseReturnTypeControllerActionRector (#651)
- [Configs] Add MergeServiceNameTypeRector (#650)
- Deprecate ServicesSetNameToSetTypeRector as it creates invalid code (#649)
rectorphp/rector-doctrine π
- Add ODM support to TypedPropertyFromToManyRelationTypeRector (#335)
- Add next fixture (#334)
- Include ODM in description (#333)
- Add TYPED_COLLECTIONS set, to have rules deadling with collections together (#332)
- Merge AddReturnDocBlockToCollectionPropertyGetterByToManyAttributeRector to single rule (#331)
- Add odm support to AddReturnDocBlockToCollectionPropertyGetterByToManyAnnotationRector (#330)
- Add ODM support to ExplicitRelationCollectionRector (#329)
rectorphp/rector-phpunit π΅
Released Rector 1.2.2
New Features π₯³
- [TypeDeclaration] Add ReturnTypeFromMockObjectRector (#6166)
- [TypeDeclaration] Add TypedPropertyFromCreateMockAssignRector (#6177)
Bugfixes π
- Skip phpdoc types in NumericReturnTypeFromStrictReturnsRector (#6153), Thanks @staabm!
- [TypeDeclaration] Fix union type by multiple method calls on ParamTypeByMethodCallTypeRector (#6155)
- [TypeDeclaration] Handle throw without new on on ParamTypeByMethodCallTypeRector (#6156)
- [TypeDeclaration] Refactor CallerParamMatcher to avoid ambigous returns usage (#6157)
- [TypeDeclaration] Prevent uncaught exception in ReturnTypeFromReturnNewRector (#6159), Thanks @staabm!
- Prevent uncaught class-not-found exceptions (#6160), Thanks @staabm!
- [TypeDeclaration] Skip variadic on StrictArrayParamDimFetchRector (#6163)
- [CodeQuality] Skip used in next stmt on UnusedForeachValueToArrayKeysRector (#6164)
- [Scoper] Fix prefixed MockObject on ReturnTypeFromMockObjectRector (#6167)
- [TypeDeclaration] Flip position between bool return and return tyep from strict constant on TypeDeclarationLevel (#6168)
- [TypeDeclaration] Skip possible void and return by docblock on ReturnTypeFromMockObjectRector (#6170)
- [TypeDeclaration] Update fixture and example method name (#6171)
- [NodeTypeResolver] Handle crash on variable variable with assign on FirstClassCallableRector (#6173)
- [NodeTypeResolver] Clean up re-fill scope on PHPStanNodeScopeResolver on variable variable (#6174)
- [NodeTypeResolver] Fill scope of dynamic variable variable (#6175)
- fix: Convert DateTime to Carbon properly when hours/minutes/seconds are used (#6176), Thanks @florisbosch!
Released Rector 1.2.1
New Features π₯³
- [type-declarations] Add ReturnNullableTypeRector (#6110)
- [type-declarations] Add StringsReturnTypeFromStrictScalarReturnsRector to complete the string returns (#6111)
- [PhpDoc] Add warning about missing PhpDocInfo name form tag value node (#6134)
- [TypeDeclaration] Introducing ClosureReturnTypeRector to handle closure types separately (#6106)
- [TypeDeclaration] Skip has named arg on AddMethodCallBasedStrictParamTypeRector (#6137)
- [e2e][Printer] Handle crash indentation on AddParamBasedOnParentClassMethodRector (#6112)
Bugfixes π
- [TypeDeclaration] Skip variadic on AddParamTypeBasedOnPHPUnitDataProviderRector (#6150)
- [TypeDeclaration] Add ConstFetch support on ReturnTypeFromStrictConstantReturnRector (#6151)
- Refactor BooleanTypeMapper to handle value based on context (#6095)
- Check root return in ReturnTypeFromReturnNewRector (#6102)
- Make ReturnUnionTypeRector run on PHP 8.0+ (#6103)
- ReturnUnionTypeRector now return only non-nullable types, to prepare space for new nullable rule as off PHP 7.1+ (#6105)
- [TypeDeclaration] handle explicit if else new on ReturnTypeFromReturnNewRector (#6104)
- [Php70] Swap min is higher than max on RandomFunctionRector (#6109)
- Split StringReturnTypeFromStrictScalarReturnsRector into string, bool and numeric scalar + strict return type rules (#6113)
- [Php71] Handle not identical to Float for empty string should compare to 0.0 on BinaryOpBetweenNumberAndStringRector (#6117)
- [TypeDeclaration] Skip void on BoolReturnTypeFromBooleanStrictReturnsRector (#6118)
- [TypeDeclaration] Fix inline closure type on ClosureReturnTypeRector (#6119)
- [TypeDeclaration] Skip start with shebang on DeclareStrictTypesRector (#6121)
- [Php52] Handle deep if stmts on ContinueToBreakInSwitchRector (#6122)
- [Php52] Handle in deep else on ContinueToBreakInSwitchRector (#6123)
- [TypeDeclaration] Clean up ArrowFunction check on ReturnTypeInferer (#6124)
- [TypeDeclaration] Skip union with yield on NumericReturnTypeFromStrictScalarReturnsRector (#6125)
- [Php82] Handle has only readonly properties but not all promoted property on ReadOnlyClassRector (#6129)
- refactor: Move function first-class-callable to a standalone rule (#6131), Thanks @nikolicaleksa!
- typo (rectorphp/rector-src@d102bd1)
- Fix ArrayDimFetchToMethodCallRector (#6138), Thanks @peterfox!
- [CodeQuality] Skip used in static Closure/ArrowFunction on LocallyCalledStaticMethodToNonStaticRector (#6139)
- [CodeQuality] Skip multiple new lines on JoinStringConcatRector (#6141)
- [CodeQuality] Allow change empty() to [] compare of other object property usage on SimplifyEmptyCheckOnEmptyArrayRector (#6147)
- [Php55] Skip parse error on no concat in left in left Concat on PregReplaceEModifierRector (#6148)
- [CodingStyle] Handle with trait use adaptations on SeparateMultiUseImportsRector (#6149)
- [DeadCode] Remove unused @var on key after remove key on RemoveUnusedForeachKeyRector (#6135)
- [DeadCode] Handle same namespace param type on RemoveUselessParamTagRector (#6133)
Removed and deprecated π
- Add - number support, deprecate ReturnTypeFromStrictScalarReturnExprRector functionality, already split (#6114)
- Deprecate BoolReturnTypeFromStrictScalarReturnsRector, use BoolReturnTypeFromBooleanStrictReturnsRector instead (#6115)
- [DeadCode] Skip fluent no return type on RemoveUnusedPrivateMethodRector (#6108)
- [DeadCode] Skip fluent no return type on RemoveUnusedPrivateMethodRector take 2 (#6116)
- [Php80] Skip used in compact() on RemoveUnusedVariableInCatchRector (#6152)
rectorphp/rector-symfony
- Correct return type definition for DataTransformerInterface (#645), Thanks @bobvandevijver
- [Symfony 6.1] Improve CommandPropertyToAttributeRector to work with freshly created AsCommand (#644)
- Add more complex names support to CommandPropertyToAttributeRector (#643)
- [Symfony 6.3] Add ParamAndEnvAttributeRector (#641)
- [Symfony 6.2] Improve SecurityAttributeToIsGrantedAttributeRector (#640)
- Add args() support to AutowireAttributeRector (#639)
- [Config] Add configurable AutowireAttributeRector to add #[Autowire(...)] to services (#637)
- feat: add api-platform/core config key (#635), Thanks @dsdeboer
- feat: add nelmio/cors-bundle config key (#634), Thanks @dsdeboer
- feat: two additional config (#633), Thanks @dsdeboer
- Hybrid CommandConfigureToAttributeRector (#632), Thanks @ruudk
rectorphp/rector-doctrine
- Fix outdated documentation in README.md (#328), Thanks @alexis-boyer
- Check is nullable doctrine annotation (#324), Thanks @marcelthole
- Add return doc block to Collection property's getter method by ToMany annotation (#322), Thanks @jszutkowski
- Fix for AddReturnDocBlockToCollectionPropertyGetterByToManyAttributeRector (#321), Thanks @jszutkowski
rectorphp/rector-phpunit
- Add support for multiple dataProviders for a single test method (#349), Thanks @marcelthole
Released Rector 1.2.0
New Rules π
- [Renaming] Add RenameAttributeRector (#6009)
- [TypeDeclaration] Add AddClosureUnionReturnTypeRector (#6033)
- [TypeDeclaration] Add AddClosureNeverReturnTypeRector (#6039)
- [Php71] Add MultiDimensionalArrayToArrayDestructRector (#6031), Thanks @nikolicaleksa!
- [TypeDeclaration] Add AddClosureReturnTypeFromStrictParamRector (#6044)
- [TypeDeclaration] Add AddClosureReturnTypeFromReturnCastRector (#6061)
- [TypeDeclaration] Add AddClosureReturnTypeFromStrictNativeCallRector (#6059)
New Features π₯³
- [DX] Add withAttributes(all) option, add PHPUnit and Doctrine code quality sets to withPreparedSets() (#6004)
- [DX] Add symfony code quality preset (#6008)
- [DX] Add
withDowngradeSets()
to better target downgrades (#6015) - Add
always
config for EncapsedStringsToSprintfRector (#6050), Thanks @ruudk! - Add
only_direct_assign
config for SimplifyUselessVariableRector (#6034), Thanks @ruudk! - Skip files with short <?= PHP tag as leads to invalid changes (#6068), (#6075)
- [Bridge] Add SetRectorsResolver, SetProviderCollector for easier use in 3rd-party tools (#6030)
- [DX] Inform about deprecated rules in config (#6047)
- [Config] Exclude listed on .gitignore for withRootFiles() (#6028)
Bugfixes π
- AddTypeToConstRector: apply if const references another class const (#6017), Thanks @tugmaks!
- fix: Skip adding string casting to closure return when it returns str⦠(#6018), Thanks @nikolicaleksa!
- fix: Add code as a named argument (#6062), Thanks @nikolicaleksa!
- Fix message handler removal in RemoveUnusedPublicMethodParameterRector (#6001)
- fix: Skip refactoring when foreach if statement contains calls to met⦠(#6019), Thanks @nikolicaleksa!
- fix: Use named arguments if they are already used (#6022), Thanks @nikolicaleksa!
- [Naming] Handle used in arrow function param, then used again outer ArrowFunction on RenameParamToMatchTypeRector (#6046)
- Fix docker commands in CONTRIBUTING.md (#6023), Thanks @tugmaks!
- fix: Skip static calls which are made using the class name (#6024), Thanks @nikolicaleksa!
- feat: Support functions for first-class-callable (#6027), Thanks @nikolicaleksa!
- [Cleanup] Deprecate ChangeAndIfToEarlyReturnRector as creates less readable code with inverted conditions (#6041)
- fix: Convert DateTime to Carbon properly when negative days/months are used (#6051), Thanks @nikolicaleksa!
- [Php81] Handle usage as arg by ref key on falsy ObjectType on ReadOnlyPropertyRector (#6054)
- fix: Skip remove always true condition on method calls (#6063), Thanks @nikolicaleksa!
Removed and Deprecated π
- [TypeDeclaration] Remove ArrowFunction from ReturnTypeFromReturnDirectArrayRector and ReturnTypeFromReturnNewRector (#6032)
- [Cleanup] Remove @changelog as no longer maintained/used, use RuleDefinition instead (#6035)
- [Cleanup] Remove FormatPerservingPrinter as only delegate method, use BetterStandardPrinter directly (#6036)
- Remove CurrentFileProvider from ValueResolver, let type resolver handle dir and filename (#6069)
- [Cleanup] Deprecate UseIncrementAssignRector as depends on context and might be intentional ([#6042]
- [CodeQuality] Deprecate GetClassToInstanceOfRector as can create invalid comparison (#6005)
- [Cleanup] Deprecate *ToTypeCastRector rules as no difference in performance, handle by cs instead (#6043)
- deprecate SetListInterface (rectorphp/rector-src@442bff7)
- Unregister GetClassToInstanceOfRector from CodeQualityLevel.php (#6006)
- Split docblock name imports and name imports as different scope, skip for HTML nodes (#6071)
- [DX] Deprecate dump-node command, use more advanced https://getrector.com/ast instead (#6040)
This is first release that includes news from other Rector core rules, so you know about all the hot stuff π
Symfony (rectorphp/rector-symfony)
New Rules and Improvements
- Improve CommandConfigureToAttributeRector to allow merge with existing attribute (#632), Thanks @ruudk
- feat: add web_profiler as config builder (#631), Thanks @dsdeboer
- Add "hidden" support to CommandConfigureToAttributeRector (#628)
- [Symfony 7.0 and 7.1] Extend sets based on upgrade notes (#627)
- [Symfony 6.4] Add DataTransformerInterface return types (#624)
- [Symfony 6.4] Deprecate ChangeRouteAttributeFromAnnotationSubnamespaceRector, make use of RenameAttribute instead (#623)
- [Symfony 6.2] Add SecurityAttributeToIsGrantedAttributeRector (#622)
- [Symfony 6.1] Add CommandConfigureToAttributeRector (#619)
- [EventDispatcher] Skip EventListenerToEventSubscriberRector for classes with #[AsEventListener] attribute (#616)
Deprecated
- [Symfony 4.3] Deprecate WebTestCaseAssertSelectorTextContainsRector as does not create valid code (#621)
- [Symfony 4.0] Deprecate ProcessBuilderGetProcessRector, as change is not valid (#620)
- [CodeQuality] Deprecate MakeCommandLazyRector, as Symfony 6.1 introduces more reliable native attribute (#618)
- [Symfony 5.3] Deprecated CommandDescriptionToPropertyRector rule, as only middle step before 6.1 native attribute (#617)
Doctrine - rectorphp/rector-doctrine
- Add return doc block to Collection property's getter method by ToMany attribute (#317), Thanks @jszutkowski
PHPUnit - rectorphp/rector-phpunit
- Add support for multiple dataProviders for a single test method (#349), Thanks @marcelthole
- Remove NamedArgumentForDataProviderRector from the PHPUnit 11 set as optional upgrade path (#348)
- Fix prefixed scoped DataProvider class on NamedArgumentForDataProviderRector (#347)
- Make AddSeeTestAnnotationRector slightly more performant as very slow, keep existing see annotations (#343)
- [PHPUnit 10] Fix typo assertObjectHasNotProperty -> assertObjectNotHasProperty (#340)
- [PHPUnit 10] Rename assertObjectHasAttribute() to assertObjectHasProperty(), add AssertIssetToAssertObjectHasPropertyRector (#338)
- Fix AssertCompareToSpecificMethodRector to skip gettype checks, as will be deprecated in next PHPUnit version (#337)
Released Rector 1.1.1
[Performance] Fix huge performance hit by reverting children class detection (#5995) - fixes #8679, #8638, #8637
New Rules
- [TypeDeclaration] Add ReturnTypeFromReturnCastRector (#5905)
- [TypeDeclaration] Add ReturnTypeFromSymfonySerializerRector (#5908)
- [TypeDeclaration] Add TypedPropertyFromJMSSerializerAttributeTypeRector (#5909)
- [TypeDeclaration] Add AddTypeFromResourceDocblockRector (#5915)
- [Php74] Add HebrevcToNl2brHebrevRector (#5977)
- [Php74] Add RestoreIncludePathToIniRestoreRector (#5973)
- [Carbon] Init set to migrate DateTime to Carbon (#5868)
- [Carbon] Add immutable support to other rules (#5896)
- Convert DateTimeImmutable to CarbonImmutable (#5895)
- Convert time() to Carbon::now()->timestamp (#5901), Thanks @kylekatarnls!
New Features and DX improvements π₯³
- Add code quality levels (#5910), Thanks @carlos-granados!
- [DX] Introduce set providers, to enable package + version based set registration (#5976)
- [DX] Report rules that registered in withSkip() but never registered in withRules() (#5919)
- [Set] Add new rector-preset set to have opiniated rector rules that can be enabled in rector-src and its extension (#5924)
- [DeadCode] Add RemoveUnusedPublicMethodParameterRector (#5925)
- [TypeDeclaration] Handle double declare(strict_types=1) addition on DeclareStrictTypesRector + IncreaseDeclareStrictTypesRector (#5928)
- [CodingStyle][Php80] Add join func call support on ConsistentImplodeRector (#5958)
- [CodeQuality] Add support for (), {}, [], <> delimiter on RegexPatternDetector (#5957)
- [TypeDeclaration] Add Static Call support on AddMethodCallBasedStrictParamTypeRector (#5960)
- [Config] Add withPhpPolyfill() method to load php polyfill set on RectorConfigBuilder (#5983)
- [DX] Add ->withPhpXSets() for PHP 7.4 and lower, improve ->withPreparedSets() (#5984)
- [config] Disable parallel on --debug (#5904)
- [Php80] Skip mixed doc with description and valid doc on MixedTypeRector (#5906)
- [DX] Add
withPhpPolyfills()
method to add polyfill rules (#5981) rectorphp/rector-src#5983 - [DX] Ommit static functions/closure from coding-style, as often ignored and depends on personal preference (#5916)
- [DX] Ommit post-inc to pre-inc rule from coding-style as too opinionated (#5917)
- [DX] Remove UseIncrementAssignRector from coding-style set, as often ignored (#5920)
Bugfixes π
- [AutoImport] No need RenamedClassesDataCollector usage on UsesClassNameImportSkipVoter (#5921)
- [Php81] Skip private method from instantiated class on FirstClassCallableRector (#5929)
- [NodeTypeCorrector] Directly use StringType on Intersection of strings on AccessoryNonEmptyStringTypeCorrector (#5933)
- [CodeQuality] Allow check in current Class_ with multiple props on CompleteDynamicPropertiesRector (#5938)
- [Naming] Handle rename property with only comment, without @var doc on RenamePropertyToMatchTypeRector (#5945)
- Remove the renaming of apache_request_headers (#5943), Thanks @rhuijts!
- [Naming] Handle nullable object @var docblock on RenamePropertyToMatchTypeRector (#5946)
- [Php81] Skip param variable used in next stmt after coalesce on NewInInitializerRector (#5971)
- [Php71] Skip call abstract method on RemoveExtraParametersRector (#5930)
- [TypeDeclaration] Do not remove docblock with description on MergeDateTimePropertyTypeDeclarationRector (#5931)
- [DeadCode] Remove param docblock on RemoveUnusedPromotedPropertyRector when exists (#5936)
- [Cleanup] Remove deprecated AttributeKey::PARENT_NODE, remove deprecated NodeNameResolver::isCaseSensitiveName() (#5939)
- [NodeTypeResolver] Remove Property->type instanceof Node check on NodeTypeResolver->getType() (#5947)
- [BetterPhpDocParser] Remove unnecessary PrivatesAccessor usage on BetterTokenIterator and TokenIteratorFactory (#5950)
- [DeadCode] Skip dynamic variable on RemoveUnusedVariableAssignRector (#5964)
- [DeadCode] Reduce loop for used in next stmt on RemoveUnusedVariableAssignRector (#5969)
Removed and Deprecated π
Released Rector 1.1.0
New Features π₯³
- [PHPStan] Bump to PHPStan 1.11 (#5883)
Bugfixes π
- [CodeQuality] Skip increment variable on else on TernaryFalseExpressionToIfRector (#5867)
- [CodeQuality] Skip on property and class const on CallableThisArrayToAnonymousFunctionRector (#5869)
- [NodeTypeResolver] Using built int ->isArray()->yes() on ArrayTypeAnalyzer::isArrayType() (#5870)
- Fix "method x was not found in reflection of class" (#5871), Thanks @staabm!
- [NodeTypeResolver] Clean up array check on NameTypeResolver (#5872)
- [NodeTypeResolver] Clean up "this" from NameTypeResolver, as not from Name node (#5873)
- [TypeDeclaration] Skip array by doc with different assign on ReturnTypeFromStrictNewArrayRector (#5875)
- [TypeDeclaration] Skip possible array on StrictStringParamConcatRector (#5876)
- [Performance] Ensure call $reflector->reflectAllClasses() once on Worker take 3 (#5878)
- [Performance] Call cached class names collection on FamilyRelationsAnalyzer (#5879)
- [NodeTypeResolver] Clean up resolve cache class name key (#5880)
- [NodeTypeResolver] No need json_decode/json_encode for cache class name collection (#5881)
- [TypeDeclaration] Handle crash on interface Mixin on ReturnTypeFromStrictConstantReturnRector (#5884)
- [PHPStan] Handle PHPStan internal ShouldNotHappenException on FamilyRelationsAnalyzer and PHPStanNodeScopeResolver (#5885)
- [NodeTypeResolver] No need to resolve class name on anonymous classes (#5886)
- [PHPStan] Fix missingType.generics notice on phpstan.neon on PHPStan 1.11 (#5888)
- [TypeDeclaration] Skip unitialized property on EmptyOnNullableObjectToInstanceOfRector (#5889)
- [Php80] Skip remove non-mixed type doc on MixedTypeRector (#5874)
- [TypeDeclaration] Add test for nullable object usage on AddReturnTypeDeclarationRector (#5887)
- [Configuration] Add missing LevelSetList::UP_TO_PHP_84 on PhpLevelSetResolver::resolveFromPhpVersion() (#5890)