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

Generate methods on enum #2416

Merged
merged 9 commits into from
Nov 3, 2023
Merged

Conversation

mamazu
Copy link
Contributor

@mamazu mamazu commented Oct 31, 2023

Fixes: #2409

Adds the ability to generate methods on enum classes if they don't exist. In the process of implementing the feature I found out that phpactor doesn't have a code builder for enum classes which I added. However, the code builder only supports non-backed enums and might break enums that are backed. I'm not sure this is a requirement though or if I should just throw an error if the enum is backed and don't do anything.

@dantleech
Copy link
Collaborator

nice 🙂 can you add a test to see if it breaks backed enums?

@mamazu
Copy link
Contributor Author

mamazu commented Oct 31, 2023

Added a test of breaking enums. It breaks different than I expected it to break. And as for the 8.0 phpunit. I don't know why they work differently than the other ones. Does it have anything to do with the enums not being fully supported yet in that version?

@dantleech
Copy link
Collaborator

probably, you need to skip enum support for 8.0

@dantleech dantleech merged commit b3b3a77 into phpactor:master Nov 3, 2023
10 checks passed
@dantleech
Copy link
Collaborator

nice!

@mamazu mamazu deleted the generate_methods_on_enum branch November 3, 2023 16:59
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.

bug: Cannot generate method on enum
2 participants