Skip to content

[CodeQuality][Php70] Handle LocallyCalledStaticMethodToNonStaticRector + ThisCallOnStaticMethodToStaticCallRector must change both method and caller#5196

Merged
samsonasik merged 10 commits intomainfrom
locally-this
Oct 26, 2023
Merged

[CodeQuality][Php70] Handle LocallyCalledStaticMethodToNonStaticRector + ThisCallOnStaticMethodToStaticCallRector must change both method and caller#5196
samsonasik merged 10 commits intomainfrom
locally-this

Conversation

@samsonasik
Copy link
Copy Markdown
Member

No description provided.

…r + ThisCallOnStaticMethodToStaticCallRector must change both method and caller
@samsonasik samsonasik marked this pull request as draft October 25, 2023 15:04
@samsonasik
Copy link
Copy Markdown
Member Author

samsonasik commented Oct 26, 2023

It seems ClassReflection is not refreshed (cached) on apply Class_ node:

$isStaticMethod = $this->staticAnalyzer->isStaticMethod($classReflection, $methodName);

the method target still detected as static while already changed as non-static.

@samsonasik samsonasik marked this pull request as ready for review October 26, 2023 05:30
@samsonasik
Copy link
Copy Markdown
Member Author

Fixed 🎉 not ideal solution, set attribute flag is the simplest solution i found ensuring no flip flop change.

@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba I think it is ready.

@samsonasik
Copy link
Copy Markdown
Member Author

Ok, I got better solution to use Class_ node to verify target ClassMethod already static 👍

@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants