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

Enum case casing sniff #1649

Open
dereuromark opened this issue Jan 2, 2024 · 0 comments
Open

Enum case casing sniff #1649

dereuromark opened this issue Jan 2, 2024 · 0 comments

Comments

@dereuromark
Copy link
Contributor

dereuromark commented Jan 2, 2024

I saw the following sniffs around enums

    <rule ref="SlevomatCodingStandard.Classes.BackedEnumTypeSpacing"/>
    <rule ref="SlevomatCodingStandard.Classes.EnumCaseSpacing"/>

But I think it would also be a good idea to have the recommended casing for enum cases to be added
Refs https://www.php.net/manual/en/language.enumerations.backed.php

See also

enum Suit: string
{
    case Hearts = 'H';
    case SOME_SPADES = 'S';
}

should be fixed to

enum Suit: string
{
    case Hearts = 'H';
    case SomeSpades = 'S';
}

with a warning as this would probably be not safe to change.

We could also just issue an error instead of fixable error for existing underscored ones.

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

No branches or pull requests

2 participants