Skip to content

Commit

Permalink
Not all PHP versions support array constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltertamboer committed Aug 11, 2015
1 parent afb34fb commit c4e5611
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions PolderKnowledge/Sniffs/Naming/VariableNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

class PolderKnowledge_Sniffs_Naming_VariableNameSniff implements PHP_CodeSniffer_Sniff
{
const VALID_VARIABLES = array(
// Should be a constant but this is not supported in all PHP versions.
private $validVariables = array(
'$_COOKIE',
'$_GET',
'$_POST',
Expand All @@ -16,7 +17,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$tokens = $phpcsFile->getTokens();
$variableName = $tokens[$stackPtr]['content'];

if (in_array($variableName, self::VALID_VARIABLES)) {
if (in_array($variableName, $this->validVariables)) {
return;
}

Expand Down

0 comments on commit c4e5611

Please sign in to comment.