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

[PHP 8.0] Add SetStateToStaticRector #4792

Merged
merged 3 commits into from
Dec 5, 2020
Merged

[PHP 8.0] Add SetStateToStaticRector #4792

merged 3 commits into from
Dec 5, 2020

Conversation

simivar
Copy link
Contributor

@simivar simivar commented Dec 5, 2020

Part of #4765. I didn't use ChangeMethodVisibilityRector as it required a class name to be specified and this one should be a generic one.

A way to use generic ChangeMethodVisibilityRector could be to refactor it to not require class name but I don't know if that's a visible solution for you.

@simivar
Copy link
Contributor Author

simivar commented Dec 5, 2020

@TomasVotruba I might need some guidance on how to make it work with PHP 8 tests.

@TomasVotruba
Copy link
Member

I'd skip the test on PHP 8, as the code is not PHP 8 compatible.

Something like:

@requires PHP < 8

@TomasVotruba
Copy link
Member

TomasVotruba commented Dec 5, 2020

I didn't use ChangeMethodVisibilityRector as it required a class name to be specified and this one should be a generic one.

That's probably a good choice... I wonder, would this doo?

[stdClass::class, '__set_state', 'static']

AFAIK, stdClass is implicit parent of any class.

@TomasVotruba
Copy link
Member

Ah, it doesn't seem to work: https://3v4l.org/7RJ0X

@TomasVotruba TomasVotruba changed the title Add SetStateToStaticRector [PHP 8.0] Add SetStateToStaticRector Dec 5, 2020
@TomasVotruba TomasVotruba merged commit 49dceea into rectorphp:master Dec 5, 2020
@TomasVotruba
Copy link
Member

Thank you 👍

@simivar simivar deleted the feature/setstate-to-static branch December 5, 2020 21:07
TomasVotruba added a commit that referenced this pull request Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants