Skip to content

Commit 4e889a5

Browse files
author
f.schmitt
committed
Ignore super globals from lower camel case check
1 parent 22cc1c3 commit 4e889a5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

custom-standards/Flyeralarm/Sniffs/Variable/LowerCamelCaseSniff.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@
88

99
class LowerCamelCaseSniff implements Sniff
1010
{
11+
/**
12+
* @var array
13+
*/
14+
protected $superGlobals = [
15+
'$GLOBALS',
16+
'$_SERVER',
17+
'$_GET',
18+
'$_POST',
19+
'$_FILES',
20+
'$_COOKIE',
21+
'$_SESSION',
22+
'$_REQUEST',
23+
'$_ENV',
24+
];
25+
1126
/**
1227
* @return array
1328
*/
@@ -32,6 +47,10 @@ public function process(File $phpcsFile, $stackPtr)
3247
$variableName = $tokens[$variablePtr]['content'];
3348
$variableName = substr($variableName, 1);
3449

50+
if (in_array($variableName, $this->superGlobals)) {
51+
continue;
52+
}
53+
3554
$isLowerCamelCase = Common::isCamelCaps($variableName, false, true, true);
3655
if ($isLowerCamelCase) {
3756
continue;

0 commit comments

Comments
 (0)