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

Allows to convert Spatie enum names to snake upper case #5435

Conversation

JoolsMcFly
Copy link
Contributor

Hi.

This PR addresses issue rectorphp/rector#8364 and lets you convert Spatie enum names to upper snake case.

@JoolsMcFly
Copy link
Contributor Author

JoolsMcFly commented Jan 5, 2024

Could you tell me what the best way to test the rule with toUpperSnakeCase configuration set to true would be pls?

If I understand correctly naming convention makes it so that we can have only one test class for SpatieEnumClassToEnumRector and that is SpatieEnumClassToEnumRectorTest.
And since tests have only one configuration file loaded via provideConfigFilePath I have to pick one value of toUpperSnakeCase to test.

Ideas?

Thanks!

@TomasVotruba TomasVotruba marked this pull request as ready for review January 5, 2024 16:34
@TomasVotruba
Copy link
Member

Only "ready" PRs trigger the CI, not drafts. So I took the liberty and triggered CI so we have more feedback

@TomasVotruba
Copy link
Member

Could you also rebase on the main? There are some conflicts now

@JoolsMcFly JoolsMcFly force-pushed the feature/spatie-enum-name-to-snake-upper-case branch from a0aad71 to 222c8bc Compare January 6, 2024 11:10
@JoolsMcFly
Copy link
Contributor Author

JoolsMcFly commented Jan 6, 2024

Alright, merge conflicts are fixed and I moved upper case names to a new test fixture.

Original tests are green so BC is ensured.
What is the preferred way of adding a test that sets toUpperSnakeCase to true?

ps:
When I run composer complete-check it reports cs errors on files I haven't touched. I ran checks on an up-to-date main branch and there are errors there too. Should they be fixed in a separate PR?

@TomasVotruba
Copy link
Member

Looks good, thank you 👍

@TomasVotruba TomasVotruba merged commit 86e7402 into rectorphp:main Jan 6, 2024
38 checks passed
@JoolsMcFly JoolsMcFly deleted the feature/spatie-enum-name-to-snake-upper-case branch January 8, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants