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
4848 'wp ' ,
4949 ];
5050
51+ /**
52+ * @var string[]
53+ */
54+ public $ additionalAllowedNames = [];
55+
5156 /**
5257 * @return int[]
5358 */
@@ -108,10 +113,20 @@ private function shouldBeSkipped(
108113 */
109114 private function isShortNameAllowed (string $ variableName ): bool
110115 {
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 ;
116131 }
117132}
You can’t perform that action at this time.
0 commit comments