Skip to content

Commit

Permalink
Fix Regex
Browse files Browse the repository at this point in the history
  • Loading branch information
windaishi committed Jan 29, 2024
1 parent dd81dc1 commit f27b81d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function process(File $phpcsFile, $stackPtr)
$enumName = $tokens[$enumNamePosition]['content'];

// Check whether the enum case is written in UpperCamelCase
if (!preg_match('/^[A-Z][a-zA-Z0-9]*$/', $enumName)) {
if (!preg_match('/^((([A-Z][a-z0-9]+)((\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?)|[A-Z])$/', $enumName)) {
$error = 'Enum cases should be written in UpperCamelCase';
$phpcsFile->addError($error, $stackPtr, 'NotUpperCamelCase');
}
Expand Down

0 comments on commit f27b81d

Please sign in to comment.