Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency rector/rector to v0.17.0 #1110

Merged
merged 1 commit into from
Jun 6, 2023
Merged

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Jun 6, 2023

Mend Renovate

This PR contains the following updates:

Package Type Update Change
rector/rector (source) require minor 0.16.0 -> 0.17.0

Release Notes

rectorphp/rector

v0.17.0: Released Rector 0.17

Compare Source

Preparing for Rector 1.0

In this release, we focus on architecture improvements before reaching Rector 1.0. We want to lower the memory usage and make Rector run faster.

This include removing next/previous nodes - this will most likely not affect you, as Rector rules were upgraded, but if you do you use them, switch to StmtsAwareInterface instead

We follow PHPStan 1.6 move from April 2022, where you can learn more: https://phpstan.org/blog/preprocessing-ast-for-custom-rules

  • Replace NodeConnectingVisitor with ParentConnectingVisitor (#​3900)

To see how to refactor to StmtsAwareInterface, check these PRs:

  • Remove NEXT_NODE dependency in ChangeAndIfToEarlyReturnRector, narrow to only closed scope function likes (#​3913)
  • Remove NEXT_NODE from SimplifyIfReturnBoolRector (#​3915)
  • [DeadCode] Remove next attribute on RemoveUnusedVariableAssignRector ([#​3917](https://github.com/rectorphp/
  • [CodingStyle] Refactor CatchExceptionNameMatchingTypeRector to use StmtsAwareInterface (#​3788)

Add/remove nodes directly 👍

The next improvement focuses on explicit node adding/removal. Thanks to StmtsAwareInterface we can add nodes directly. This makes Rector refactor() method contain all the code you need.

  • Cleanup usage of NodesToAddCollector, return nodes directly instead (#​4003)
  • Cleanup removeNodeFromStatements(), removeArg(), removeParam(), removeStmt() methods and remove nodes directly (#​4012)
  • Remove unused addNodeAfterNode(), return nodes instead (#​4023)
  • Remove unused method addNodesBeforeNode() (#​4024)

New Features 🥳

  • [PHP 7.0] Add IfIssetToCoalescingRector (#​3878)
  • Support attributes in RemoveFinalFromEntityRector (#​3727), Thanks @​alexndlm!
  • Add SwapMethodCallArgumentsRector (#​3726), Thanks @​gaydamakha!
  • [CodeQuality] Add CleanupUnneededNullsafeOperatorRector (#​3767)
  • Make ReturnNeverTypeRector work with type declaration, add it to PHP 8.1 set (#​3852)
  • [TypeDeclaration] Add BoolReturnTypeFromStrictScalarReturnsRector (#​3898)
  • Make ChangeGlobalVariablesToPropertiesRector add properties directly, remove Nette inject methods (#​3957)
  • Utilize MinPhpVersionInterface in more rules (#​3752), Thanks @​staabm!
  • Dump dependency container and re-use it - 35% faster test-suite (#​3809), Thanks @​staabm!
  • Defer type-resolving in RemoveJustPropertyFetchRector (#​3761), Thanks @​staabm!

Bugfixes 🐛

  • [TypeDeclaration] Skip Arg unpack on AddMethodCallBasedStrictParamTypeRector (#​3787)
  • [CodeQuality] Add typed property support to IssetOnPropertyObjectToPropertyExistsRector (#​3876)
  • [CodeQuality] Skip non-array type on SimplifyForeachToArrayFilterRector (#​3738)
  • Fix ShortenedObjectType not resolving to correct class reflection (#​3397), Thanks @​jackbentley!
  • Extend code-quality set (#​3773)
  • Don't neon-decode phpstan configs over and over again (#​3796), Thanks @​staabm!
  • [Console] Allow https url instead of git:// on SetupCICommand (#​3799)
  • Fix integer range phpdoc types being treated as useless (#​3825), Thanks @​jlherren!
  • Fix nullable param in ClassPropertyAssignToConstructorPromotionRector (#​3842)
  • Fix PrivatesAccessor: use selectFromArgs() instead (#​3923), Thanks @​staabm!

Removed rules 💀

We've also remove bunch of rules, that were added in early days of Rector for demo purposes. They were not used as of any set for non-reliable cases. PHPStan and coding standards replace some of those.

  • [CodeQuality] Remove ForToForeachRector, as overly deatiled and not reliable (#​3747)
  • [CodeQuality] Remove SimplifyIfExactValueReturnValueRector, as overly defensive + InlineSimplePropertyAnnotationRector as purely coding standard area (#​3764)
  • [CodingStyle] Remove RemoveDoubleUnderscoreInMethodNameRector, as naming is not handled for breaking reasons (#​3765)
  • Remove RemoveUnusedVariableAssignRector, as could be breaking code in order of excution and hard to do reliable (#​3793)
  • [CodingStyle] Remove ConsistentPregDelimiterRector as not much practical, importance of regex is a testing it matches expectationg, area of static analysis (#​3797)
  • Remove ToStringToMethodCallRector as not practical and only for demo, FalseReturnClassMethodToNullableRector, as requires detailed custom refactoring (#​3854)
  • Remove ChangeOrIfReturnToEarlyReturnRector as makes code harder to read by duplication, rather use PHSPtan and extract method (#​3916)
  • [DeadCode] Remove RemoveDuplicatedIfReturnRector as can lead to unexpeced consequences, better use static analysis and contextual handling (#​3926)
  • [DeadCode] Remove RemoveDuplicatedInstanceOfRector as hardly practical (#​3936)
  • [CodeQuality] Remove ExplicitMethodCallOverMagicGetSetRector designed for nette smart object migration only, not useful for general projects (#​3948)
  • Remove GetAndSetToMethodCallRector, as not practical and used for single legacy job (#​3953)
  • Remove ChangeReadOnlyVariableWithDefaultValueToConstantRector overly complex and risky, better job for PHPStan (#​3954)
  • Remove IsObjectOnIncompleteClassRector as blindly turns all incomplete checks to negated, better examine manually (#​3969)
  • Remove ReservedObjectRector as requires explicit configuration and is handled by RenameClassRector already (#​3975)
  • Remove ChangeReadOnlyPropertyWithDefaultValueToConstantRector as overly detailed checks, better use PHPStan and refactor individually (#​4028)
  • Remove NewToMethodCallRector as unused core and no other extension, niche to use, better handle by PHPStorm (#​4029)
  • [CodingStyle] Remove AddFalseDefaultToBoolPropertyRector, as works with unrelaible docblocks (#​3856)
  • Remove UpdateFileNameByClassNameFileSystemRector niche rule that was added just for example sake (#​3849)
  • [Transform] Remove ArgumentFuncCallToMethodCallRector as never used (#​3774)
  • [Transform] Remove DimFetchAssignToMethodCallRector as unused (#​3775)
  • [Transform] Remove FileGetContentsAndJsonDecodeToStaticCallRector as only for demo purposes (#​3776)
  • [Transform] Remove MethodCallToAnotherMethodCallWithArgumentsRector as unused (#​3777)
  • [CodeQuality] Remove SimplifyUselessLastVariableAssignRector as overly complex and should be handled individually (#​3784)
  • Remove AddPregQuoteDelimiterRector as very narrow area and has not context awareness, better handle manually (#​3927)
  • Remove TokenGetAllToObjectRector, as rare to use and leaky to handle, better handle in controller manual way (#​4001)
  • Remove ChangeReflectionTypeToStringToGetNameRector as niche and overly detailed, better refactor reflectio na as a whole (#​3976)
  • Remove RenameNamespaceRector, better handle by IDE or explicit RenameClassRector (#​3979)
  • [CodeQuality] Deprecate NarrowUnionTypeDocRector as focused on docblocks, and moving to type declarations (#​3848)
  • Remove MakeTypedPropertyNullableIfCheckedRector as old fix of TypedPropertyRector rule, removed months ago (#​3851)
  • [PHP 8.0] Deprecate old UnionTypesRector that is dangerously moving docblocks, use type declaration rules instead (#​3846)
  • [CodingStyle] Remove OrderAttributesRector, as rather coding standard and does not have specific PSR example (#​3838)
  • Remove unused PregMatchTypeCorrector, the 3rd param in preg_match_* is now handled natively by PHPStan (#​3824)
  • [Restoration] Remove RemoveFinalFromEntityRector as used only to revert very old Rector bug (#​3847)

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the dependencies Add or update dependencies label Jun 6, 2023
@aerrasti aerrasti merged commit e8cf1aa into main Jun 6, 2023
11 checks passed
@aerrasti aerrasti deleted the deps-rector-rector-0.x branch June 6, 2023 07:53
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependencies Add or update dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant