Skip to content
Snippets Groups Projects
Unverified Commit ba30df56 authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

fix(ValidClassName): Allow upper case with number (#3497580)

parent 04a4563b
Branches
Tags
No related merge requests found
......@@ -74,9 +74,9 @@ class ValidClassNameSniff implements Sniff
// Ensure the name is not all uppercase.
// @todo We could make this more strict to check if there are more than
// 2 upper case characters in a row, but not decided yet.
// 2 upper case characters in a row anywhere, but not decided yet.
// See https://www.drupal.org/project/coder/issues/3497433
if (strtoupper($name) === $name) {
if (preg_match('|^[A-Z]{3}[^a-z]*$|', $name) === 1) {
$error = '%s name must use UpperCamel naming and not contain multiple upper case letters in a row';
$phpcsFile->addError($error, $stackPtr, 'NoUpperAcronyms', $errorData);
}
......
......@@ -10,4 +10,19 @@ enum Test: int {
// Upper case parts are allowed for now.
case FourJSONCase = 4;
case FiveAndAHorseCorrect = 5;
case UIExample = 6;
}
// Those are all ok.
enum FiscalQuarter {
case Q1;
case Q2;
case Q3;
case Q4;
}
enum Plan {
case A;
case B;
case C;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment