Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
coder
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
coder
Commits
ba30df56
Unverified
Commit
ba30df56
authored
4 months ago
by
Klaus Purer
Committed by
GitHub
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(ValidClassName): Allow upper case with number (
#3497580
)
parent
04a4563b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php
+2
-2
2 additions, 2 deletions
...r/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php
tests/Drupal/NamingConventions/ValidEnumCaseUnitTest.inc
+15
-0
15 additions, 0 deletions
tests/Drupal/NamingConventions/ValidEnumCaseUnitTest.inc
with
17 additions
and
2 deletions
coder_sniffer/Drupal/Sniffs/NamingConventions/ValidClassNameSniff.php
+
2
−
2
View file @
ba30df56
...
...
@@ -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
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/Drupal/NamingConventions/ValidEnumCaseUnitTest.inc
+
15
−
0
View file @
ba30df56
...
...
@@ -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
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment