Skip to content

Enum method rename doesn't work #8610

@er1z

Description

@er1z

Bug Report

Subject Details
Rector version 1.0.4

As I'm part of developer experience team, sometimes we extract pieces of logic into shared libraries. In order to maximize adoption of newly created parts, we want to create as much of automation as possible. The obstacle I'm currently struggling is a problem with renaming enum methods. I recall that some of you mentioned should the methods of IDE used for such of refactoring but we deal of plenty of libraries/projects and want to have simple methods rename.

I did some investigation what happens internally and it turns out that it's got stuck around StaticCall and the problem is around a thing a returned type is MixedType (of enum) parsed into ErrorType before. Hope this gonna at least to narrow the hunting. Tried to debug it within a project but got major version packages collision and usage of phpstan-src was impossible up there. Will try to find something further but will really appreciate your advice if my understanding is not well or anything like that.

Extracted the problem to be posted into demo app below.

Thank you!

Minimal PHP Code Causing Issue

https://getrector.com/demo/d80e9a34-5f7c-4ecc-8f9d-ae2b8abcf7eb

Expected Behaviour

It should behave similar to class method rename.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions