File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed
Inpsyde/Sniffs/CodeQuality Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,11 @@ final class ElementNameMinimalLengthSniff implements Sniff
48
48
'wp ' ,
49
49
];
50
50
51
+ /**
52
+ * @var string[]
53
+ */
54
+ public $ additionalAllowedNames = [];
55
+
51
56
/**
52
57
* @return int[]
53
58
*/
@@ -108,10 +113,20 @@ private function shouldBeSkipped(
108
113
*/
109
114
private function isShortNameAllowed (string $ variableName ): bool
110
115
{
111
- return in_array (
112
- strtolower ($ variableName ),
113
- $ this ->allowedShortNames ,
114
- true
115
- );
116
+ $ target = strtolower ($ variableName );
117
+
118
+ foreach ($ this ->allowedShortNames as $ allowed ) {
119
+ if (strtolower ($ allowed ) === $ target ) {
120
+ return true ;
121
+ }
122
+ }
123
+
124
+ foreach ($ this ->additionalAllowedNames as $ allowed ) {
125
+ if (strtolower ($ allowed ) === $ target ) {
126
+ return true ;
127
+ }
128
+ }
129
+
130
+ return false ;
116
131
}
117
132
}
You can’t perform that action at this time.
0 commit comments