github rectorphp/rector 0.19.0
Released Rector 0.19.0

latest releases: 1.2.5, 1.2.4, 1.2.3...
8 months ago

In this release we merged 2 directories into /src to speed up class loading and make work with code easier. This leads to BC change in namespace for your custom rules:

-use Rector\Core\
+use Rector\

That's it!

New Features 🥳

  • [psr-4] Move /packages directory to /src under single Rector\ namespace (#5414)
  • [Arguments] Allow no default value on ArgumentAdderRector (#5382)
  • Add related polyfill interface to other PHP 8.0/7.3 rules (#5389)
  • [CodingStyle] Add RemoveUselessAliasInUseStatementRector (#5394)
  • [Php83] Add CombineHostPortLdapUriRector (#5397)
  • [TypeDeclaration] optionally only add types for hard coded return values in ReturnTypeFromStrictScalarReturnExprRector (#5364), Thanks @RobertMe!
  • Add phpstan native cond types for getName() for nodes that always return a string (#5413)
  • [Strict] Add StaticProperty supporton may be unitialized static property on DisallowedEmptyRuleFixerRector (#5428)
  • [Php83] Add implements interface support on AddOverrideAttributeToOverriddenMethodsRector (#5429)
  • [cs] Make use of new ECS config (#5445)

Bugfixes 🐛

  • [TypeDeclaration] Add false and true in union support on ReturnUnionTypeRector (#5355)
  • Skip classes without final and exception as possibly invoke child implement in AddVoidReturnTypeWhereNoReturnRector (#5381)
  • Skip non-final class method with no content in AddVoidReturnTypeWhereNoReturnRector (#5386)
  • [TypeDeclaration] Allow add void return type on magic __invoke() method on AddVoidReturnTypeWhereNoReturnRector (#5376)
  • Add ReturnTypeFromStrictBoolReturnExprRector support for if/else returns (#5384)
  • Skip void without final keyword in ReturnNeverTypeRector as could be implemented with more precise children (#5379)
  • Fix StrictArrayParamDimFetchRector for string access (#5383)
  • Fix variable to property fetch update in ClassPropertyAssignToConstructorPromotionRector (#5385)
  • [Php] Fix filter cache on PolyfillPackagesProvider (#5390)
  • [Parallel] Fix missing --xdebug in WorkerCommand line on WorkerCommandLineFactory when --xdebug provided (#5398)
  • Bump phpstan to 1.10.50 (#5399)
  • [Php83] Handle dynamic host and port values on CombineHostPortLdapUriRector (#5401)
  • [config] Extract RectorConfigValidator and handle config validation there (#5404)
  • [psr-4] Update Rector core test reference (#5410)
  • [cleanup] Decouple changelog generator (#5412)
  • [Strict] Handle may be unitialized property on DisallowedEmptyRuleFixerRector (#5409)
  • Bump min. version to PHP 8.2 - readonly classes (#5415)
  • Decouple LongAndDependentComplexRectorRule to cognitive-complexity package (#5427)
  • [TypeDeclaration] Skip with empty() check on StrictArrayParamDimFetchRector (#5432)
  • [TypeDeclaration] Allow both integer and string index array on StrictArrayParamDimFetchRector (#5433)
  • [TypeDeclaration] Skip re-assign with call and use as arg on StrictArrayParamDimFetchRector (#5434)
  • [CodeQuality] Handle crash with call inside loop on SimplifyForeachToCoalescingRector (#5436)
  • [TypeDeclaration] Handle with default null on ParamTypeByMethodCallTypeRector (#5437)
  • [NodeTypeResolver] Handle crash PHPStan\File\CouldNotReadFileException: Could not read file on IntermediateSourceLocator (#5438)
  • Allows to convert Spatie enum names to snake upper case (#5435), Thanks @JoolsMcFly!
  • fix: RenameMethodRector should handle NullsafeMethodCall (#5444), Thanks @nikophil!
  • [Php80][CodeQuality] Handle crash on ChangeSwitchToMatchRector + TernaryFalseExpressionToIfRector on under if else (#5446)
  • Skip cond with side effect in RemoveDeadConditionAboveReturnRector (#5424)
  • [DeadCode] Skip nullable array on RemoveUnusedNonEmptyArrayBeforeForeachRector (#5375)
  • Keep called method in RemoveEmptyClassMethodRector (#5425)

Removed 💀

  • [DeadCode] Remove RemoveJustPropertyFetchForAssignRector as tailored for single case of private project, not practical for generic use (#5418)
  • remove array spread from coding style, as often part of personal preference (rectorphp/rector-src@a326b85)

Don't miss a new rector release

NewReleases is sending notifications on new releases.