Skip to content

Allow enum suffix omission when in Enum namespace#428

Merged
LordSimal merged 1 commit into6.xfrom
relax-enum-suffix-in-enum-namespace
Mar 14, 2026
Merged

Allow enum suffix omission when in Enum namespace#428
LordSimal merged 1 commit into6.xfrom
relax-enum-suffix-in-enum-namespace

Conversation

@dereuromark
Copy link
Member

Summary

  • Allow omitting the "Enum" suffix when the enum is in a namespace containing "Enum" as a segment

This avoids redundant naming like:

  • App\Model\Enum\FooBarEnum → can now be App\Model\Enum\FooBar

Both are still valid:

  • App\Model\Enum\Status ✓ (in Enum namespace)
  • App\Model\Enum\StatusEnum ✓ (explicit suffix)
  • App\Model\StatusEnum ✓ (has suffix)
  • App\Model\Status ✗ (neither in Enum namespace nor has suffix)

Refs #425
Refs cakephp/cakephp#19329 (comment)

Relax the ValidEnumNameSniff to allow omitting the "Enum" suffix when
the enum is in a namespace containing "Enum" as a segment (e.g.,
`App\Model\Enum\Status` is now valid without the suffix).

This avoids redundant naming like `App\Model\Enum\FooBarEnum`.

Refs #425
@LordSimal LordSimal merged commit 1950643 into 6.x Mar 14, 2026
6 checks passed
@LordSimal LordSimal deleted the relax-enum-suffix-in-enum-namespace branch March 14, 2026 13:56
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