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)