Releases: rectorphp/rector
Releases · rectorphp/rector
Released Rector 0.13.7
New Features 🎉
- Decouple new Downgrade PHP package: https://github.com/rectorphp/rector-downgrade-php
- [TypeDeclaration] Add ReturnTypeFromStrictReturnExprRector (#2563)
- [TypeDeclaration] Add ReturnTypeFromStrictNativeFuncCallRector (#2570)
- [TypeDeclaration] Add ReturnTypeFromStrictNewArrayRector (#2572)
- [DowngradePhp80] Add DowngradeMixedTypeTypedPropertyRector (#2579)
- [Parallel] Display stack trace on --debug on parallel (#2561)
- Bump PHPStan to 1.8 (#2588)
Bugixes 🐛
- [PSR4] Do not remove declare(strict_types=1) on NormalizeNamespaceByPSR4ComposerAutoloadRector (#2551)
- [Php54] Add MethodCall and StaticCall support on RemoveReferenceFromCallRector (#2553)
- Clean MethodToMethodCallRector (#2554) , Thanks @SelrahcD!
- [DowngradePhp80] Do not change correct Union array docblock to mixed[] on DowngradeUnionTypeDeclarationRector (#2555)
- [CodeQuality] Drop ArrayThisCallToThisMethodCallRector as changes behavior and better handled by FirstClassCallableRector (#2571)
Released Rector 0.13.6
New Features 🎉
- [Core] AbstractScopeAwareRector is ready to be used in custom rules (#2537)
- [PHP 8.1] Add FirstClassCallableRector (#2544)
- [Php81] NullToStrictStringFuncCallArgRector - Register more functions (#2543), Thanks @hungtrinh!
- Improve RectorConfig import methods (#2526), Thanks @alexndlm!
Bugfixes 🐛
- [Renaming] Do not rename docblock same name not found in use inside namespace (#2471)
- [TypeDeclaration] Skip generic on ReturnTypeDeclarationRector (#2469)
- [DeadCode] Skip using coealesce assign operator on return on RemoveUnusedPrivatePropertyRector (#2476)
- [DeadCode] Skip has return reassign Coalesce Op on RemoveUnusedPrivatePropertyRector (#2477)
- [Php55] Handle crash on concat variable single quote on PregReplaceEModifierRector (#2483)
- [PSR4] Handle invalid missing ; on NormalizeNamespaceByPSR4ComposerAutoloadRector with GroupUse (#2488)
- [Php70] Refactor MultiDirnameRector by moving nestingLevel check to separate method (#2492)
- [Php81] Fix crash on redis->set() on ReadOnlyPropertyRector (#2494)
- [TypeDeclaration] Skip implements mixed, and already has typed return on AddReturnTypeDeclarationRector (#2509)
- [Php81] Skip param reassign on ReadOnlyPropertyRector (#2498)
- [CodeQuality] Fix default array param in CallableThisArrayToAnonymousFunctionRector (#2527)
- [Transform] Handle with this->method() from current class on MethodCallToMethodCallRector (#2531)
- [PHP 7.0] skip non-existing method in StaticCallOnNonStaticToInstanceCallRector (#2532)
- [PHP 7.4] Skip default expr type on property, if there is mixed assign (#2534)
- [Php56] Skip multiple catch with same variable on AddDefaultValueForUndefinedVariableRector (#2533)
- [Php80] Skip Assign on its var not directly used in next return on ChangeSwitchToMatchRector (#2535), #7247
- [Php81] Skip str_replace() pass array subject on NullToStrictStringFuncCallArgRector (#2541)
Released Rector 0.13.5
New Features 🎉
- [DeadCode] Add RemoveJustPropertyFetchRector (#2433)
- [DX] Make ClassAnnotationMatcher differentiate between known and unknown classes (#2319), Thanks @dritter!
- [CS] Fix dynamic and broken indent detection, allow to configure spacing via RectorConfig::indent() method (#2442)
- [DX] Add deprecation exception about old ContainerConfigurator, to prepare for removal even in CI (#2463)
- use PHPStan 1.7.12, with phpdoc-parser 1.6.0 to fix endline issue (rectorphp/rector-src@56651d0)
- [DX] Detach typo3 from core to allow stable growth of both packages (#2446)
- [scoped] Build with Scoper 0.17.2 (#2445)
Bugfixes 🐛
- [DX] Remove too detailed --type in init command, use fw documentation instead (#2430)
- [Renaming] Keep comment on RenameClassRector (#2439)
- [Renaming] Do not Rename Docblock inner Namespace on RenameClassRector (#2441)
- [Renaming] Handle crash on FuncCall with Arg class name conflict with use statement or namespace on RenameClassRector with auto import enabled (#2431)
- [DX] Remove symlinks option to require safe way of providing explicit paths (#2443)
- [Php74] Remove ReservedFnFunctionRector (#2447)
- [Renaming] Skip rename docblock on conflict with alias on RenameClassRector (#2450)
- [DeadCode][PHPUnit] handle crash on RemoveJustPropertyFetchForAssignRector+SimplifyForeachInstanceOfRector (#2453)
- [CodingStyle] Skip non-empty-string on VarConstantCommentRector (#2451)
- [Renaming] Do not rename class with same name inside different namespace on RenameClassRector (#2455)
- [Php72] Handle crash on PreInc usage on CreateFunctionToAnonymousFunctionRector (#2456)
- [Php70] Handle crash on EregToPregMatchRector (#2460)
Released Rector 0.13.4
New Features 🎉
- Update to php-parser 4.14.0 to work with literal _ number separator (#2321)
- Update to PHPStan 1.7.10 (#2424)
- [DowngradePhp82] Add DowngradeReadonlyClassRector to downgrade readonly class (#2322)
- [PHP 8.0] Add ConstantListClassToEnumRector (#2404)
- [DowngradePhp80] Add DowngradeEnumToConstantListClassRector (#2416)
- [DeadCode] Add RemoveJustPropertyFetchForAssignRector (#2423)
Bugfixes 🐛
- [PHP 8.0] Fix double annotation change on annotation to attribute (#2403)
- [Attribute] Fix UseAliasNameMatcher for the last part of use import rename (#2402)
- [Core] Fix bootstrap stubs load on PHP 7.2 when vendor/ excluded via skip() (#2394)
- [Php74] Skip nullable mixed on Php 8.0 feature enabled on TypedPropertyRector (#2414)
- [Php80] Mirror additional docblock on importNames() on ClassPropertyAssignToConstructorPromotionRector (#2410)
- [Renaming] Skip docblock rename different namespace on RenameClassRector (#2419)
Released Rector 0.13.3
Rector release downgrade is now handled in single run and with parallel run ⚡ It's faster and vendor includes only the packages it really uses.
New Features 🎉
- [Laravel] Add set for Laravel 9.x (#49), Thanks @hirenkeraliya
- [Attribures] Add annotation to attribute core rename in AnnotationToAttributeRector (#2384)
This now allows annotation to attribute rename with change in the namespace:
-use Project\Annotation\Security as SC;
+use Project\Attribute\Security as SC;
-/**
- * @SC\LoggedIn
- */
+#[SC\LoggedIn]
final class PrivateController
{
}
Bugfixes 🐛
- [Transform] Skip different method on CallableInMethodCallToVariableRector (#2395)
- [CodeQuality] Add empty array support to InlineArrayReturnAssignRector (#2397)
- [PHP 8.2] Skip readonly class on property without type in ReadOnlyClassRector (#2398)
- Add annotation to attribute core rename in AnnotationToAttributeRector (#2380)
- [DowngradePhp81] Handle crash parent Arg is missing scope on DowngradeFirstClassCallableSyntaxRector (#2387)
Changes 📆
- remove
working-dir
option as not compatible with parallel run, better handle via CI working-dir options (#2387)
Released Rector 0.13.2
Bugfixes 🐛
- Fix missing
ReflectionUnionType
class by moving stub loader to RectorContainerFactory (#2382)
Released Rector 0.13.1
New Features 🎉
- [CodeQuality] Add InlineIsAInstanceOfRector (#2364)
- [DX] Move configure to direct call in RectorConfig (#2367)
- [DX] Various config merge, improve RectorConfig methods (#2371)
- [DX] Remove non-PHP file formatting based on editorconfig, rather let external coding standard tools handle the file format (#2378)
Bugfixes 🐛
- [Php73] Skip Encapsed on StringifyStrNeedlesRector (#2352), Thanks @samsonasik!
- [TypeDeclaration] Skip curly {@inheritdoc} on AddArrayReturnDocTypeRector (#2359), Thanks @samsonasik!
- Allow to rename method if in interface (#2362)
- [Php81] Skip ArrayDimFetch from ArrayObject in Assign var on ReadOnlyPropertyRector (#2363), Thanks @samsonasik!
- [PhpDocInfo] Fixes Partial value update got duplicated on DoctrineAnnotationTagValueNode change (#1862), Thanks @samsonasik!
Released Rector 0.13 with Scope Refresh and StmtsAwareInterface
New Features 🎉
- [Php82] Add ReadOnlyClassRector (#2296), Thanks @samsonasik!
- [Order] Add a-z ordering feature to OrderAttributesRector (#2243), Thanks @Lenny4!
- [Symfony] Add CommandPropertyToAttributeRector (#163), Thanks @stephanvierkant
- [Experimental] Add refactorWithScope() method to get typed Scope easily and required (#2227)
- Add Scope refresh for changed or new nodes (#2292)
From YAML routes to Annotations 🚀
- [Symfony] Add new rule to add annotations from router configuration to symfony controllers (#169), Thanks @malteschlueter
-foo_baz:
- path: /foo/{baz}
- defaults: { _controller: FooBundle:Bar:baz, _format: json }
- methods: [ GET, POST ]
+/**
+ * @Route(name="foo_baz", path="/foo/{baz}", methods={"GET","POST"}, defaults={_format="json"})
+ */
public function bazAction(string $baz)
New StmtsAwareInterface
node
- [DX] Add StmtsAwareInterface to catch node by type (#2269)
Do you need to iterface all rules with stmts in them? Hook in one node type:
/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [StmtsAwareInterface::class];
}
Bugfixes 🐛
- [CodeQuality] Skip CallableThisArrayToAnonymousFunctionRector when inside of Attribute (#2212), #6910, Thanks @samsonasik!
- Added new functions to NullToStrictStringFuncCallArgRector (#2217), Thanks @FlorinProfeanu!
- [Parallel] Fix --debug not working in parallel (#2307), Thanks @samsonasik!
- [DowngradePhp80] Handle match inside ArrowFunction on DowngradeMatchToSwitchRector (#2330), Thanks @samsonasik!
- [DowngradePhp80] Add in arrow function in return support on DowngradeMatchToSwitchRector (#2331), Thanks @samsonasik!
- [DowngradePhp80] Apply PHPStan 1.7.x-dev compatible for PhpParameterReflection (#2336), Thanks @samsonasik!
- [DeadCode] Skip used in Closure use on RemoveUnusedConstructorParamRector (#2341), Thanks @samsonasik!
- [Naming] Move collecting param names method to FunctionLikeManipulator (#2347), Thanks @samsonasik!
- [Naming] Handle Grouped use import on UseImportsResolver (#2348), Thanks @samsonasik!
Released Rector 0.12.23
This release fixes major slowdown on find parents node rules in stmts: #7144, thanks for report and provided detailed info @bobvandevijver and @jrmcpeek 🙇
Update as soon as possible to enjoy the speed again 👍
- [Code] Improve BetterNodeFinder::findFirstPrevious() to only locate previous of parent if no previous of Node (#2209), Thanks @samsonasik!
New Features 🎉
- [CodeQuality] Add InlineArrayReturnAssignRector (#2183)
- Add RectorConfigProvider to ask for configuration behave for 3rd party packages (#2187)
- [Core] Add $seconds, $maxNumberOfProcess, and $jobSize parameters to RectorConfig::parallel() method (#2188), Thanks @samsonasik!
- [DX] Move PhpVersionProvider from AbstractRector to particular services (#2189)
- [DowngradePhp80] Support match as array item in DowngradeMatchToSwitchRector (#2178), Thanks @jrstanley!
Bugfixes 🐛
- [DeadCode] Improve RemoveUnreachableStatementRector performance by return after array_splice early (#2193), Thanks @samsonasik!
- [DeadCode] Register array_splice into impure functions on PureFunctionDetector (#2194), Thanks @samsonasik!
- [CodingStyle] Skip readonly type property on AddArrayDefaultToArrayPropertyRector (#2196), Thanks @samsonasik!
- [DeadCode] Remove RemoveCodeAfterReturnRector, already handled at RemoveUnreachableStatementRector (#2199), Thanks @samsonasik!
Released Rector 0.12.22
This release slowly moves towards RectorConfig
to improve Rector isolation from your project and ease to configuration. You can read more about it here: https://getrector.org/blog/new-in-rector-012-introducing-rector-config-with-autocomplete
New Features 🎉
- [DX] Update super old configure to RectorConfig (#2121)
- [DX] Add RectorConfig upgrade rule to make upgrade easier :) (#2098)
- Improve BetterNodeFinder::findFirstPrevious() to work without statements (#2136)
- Invalidate errored files in cache, to avoid hiding errors (#2138)
- [NodeCollector] Remove CurrentStmtResolver service (#2143), Thanks @samsonasik!
- [DX] Add note warning about using old config (#2177), Thanks @dritter!
- DowngradeMatchToSwitchRector adds Method and Function call support (#2173), Thanks @jrstanley!
Bugfixes 🐛
- [Fix][InlineSimplePropertyAnnotationRector] Add test case and minor fix (#2096), Thanks @dorrogeray!
- [TypeDeclaration] Skip union param type on AddArrayParamDocTypeRector (#2119), Thanks @samsonasik!
- [TypeDeclaration] Skip return property not exists by ClassReflection on ReturnTypeDeclarationRector (#2134), Thanks @samsonasik!
- [Php80] Handle named type on JMS\AccessType on AnnotationToAttributeRector (#2141), Thanks @samsonasik!
- [DeadCode] Skip remove variable on switch use return after break on RemoveUnusedVariableAssignRector (#2145), Thanks @samsonasik!
- [Php80] Skip different type cases cond on ChangeSwitchToMatchRector (#2147), Thanks @samsonasik!
- Remove PREVIOUS_STATEMENT from StatementNodeVisitor (#2146)
- Remove CURRENT_STATEMENT where not needed (#2149)
- [Php74] Allow change protected property of final class when property only in current class on TypedPropertyRector (#2153), Thanks @samsonasik!
- Remove uses nodes attribute - part #1 (#2155)
- Disable StatementNodeVisitor (#2154)
- Remove NamespaceNodeVisitor (#2167)
- Decouple aliased object type specifier + updgrade to PHPStan 1.6 (#2170)
- [DowngradePhp80] Add Static Call Support on DowngradeMatchToSwitchRector (#2175), Thanks @samsonasik!
- Adds test for DowngradeMatchToSwitchRector match having true subject expression (#2176), Thanks @jrstanley!
- [TypeDeclaration] Skip return type defined Closure on ReturnTypeDeclarationRector (#2179), Thanks @samsonasik!
- [Doc] Document deprecated USE_NODES and CURRENT_STATEMENT constant to use existing method call when needed (#2181), Thanks @samsonasik!
- [Doctrine][Nette][TypeDeclaration] Handle add __construct with no Scope on InitializeDefaultEntityCollectionRector+RenderMethodParamToTypeDeclarationRector (#2180), Thanks @samsonasik!