Could Be A Constant

Those literals are assigned then compared somewhere else in the code. When those literals are carrying a state, it is recommended to assign them to a constant, to ensure that both parts of the application use the same values..

LiteralAssignationsComparisons
4
  • $config->tabWidth = 4
  • $contextLength = 4
  • $errors[729] = 4
  • $percentWidth = 4
  • $this->tabWidth = 4
  • $retval === 4
  • $value == 4
10
  • $i = 10
  • $this->wizardid = 10
  • $var1 = 10
  • $x = 10
  • $i < 10
  • $i <= 10
  • $j < 10
  • $n > 10
  • $n < 10
  • $var < 10
  • $var2 === 10
  • 10 === $y
2
  • $errors[130] = 2
  • $errors[161] = 2
  • $errors[170] = 2
  • $errors[190] = 2
  • $errors[191] = 2
  • $errors[239] = 2
  • $errors[243] = 2
  • $errors[244] = 2
  • $errors[575] = 2
  • $errors[627] = 2
  • $errors[740] = 2
  • $errors[752] = 2
  • $errors[992] = 2
  • $i = 2
  • $percentPrefixWidth = 2
  • $surroundingLines = 2
  • $y = 2
  • $error->severity === 2
  • $i == 2
  • $num < 2
  • $num === 2
  • $numNonWhitespace <= 2
  • $partsCount <= 2
  • $retval === 2
  • $semicolonCount !== 2
  • $semicolonCount < 2
  • $semicolons === 2
  • $value == 2
  • 2 > $value
70
  • $width = 70
  • $width < 70
5
  • $severity = 5
  • $this->errorSeverity = 5
  • $this->ruleset[(string) $rule['ref']]['severity'] = 5
  • $this->warningSeverity = 5
  • $typeLength = 5
  • $i < 5
  • $j < 5
  • $value == 5
  • $value === 5
  • $x < 5
  • 5 == $num
  • 5 == $value
  • 5 === $value
50
  • $j = 50
  • $depth > 50
  • $this->loops < 50
3
  • $errors[1089] = 3
  • $errors[1129] = 3
  • $errors[143] = 3
  • $errors[17] = 3
  • $errors[306] = 3
  • $errors[363] = 3
  • $errors[893] = 3
  • $k > 3
  • $num === 3
  • $value == 3
  • 3 < $var
newline
  • $after = 'newline'
  • $before = 'newline'
  • $found = 'newline'
  • $gap = 'newline'
  • $inside = 'newline'
  • $length = 'newline'
  • $spaceAfterOpen = 'newline'
  • $spaceBeforeClose = 'newline'
  • $spaceLength = 'newline'
  • $spaces = 'newline'
  • $spacing = 'newline'
  • $after !== 'newline'
  • $after === 'newline'
  • $before !== 'newline'
  • $before === 'newline'
  • $found !== 'newline'
  • $found === 'newline'
  • $inside !== 'newline'
  • $inside === 'newline'
  • $pattern[($i - 1)]['type'] !== 'newline'
  • $pattern[$i]['type'] === 'newline'
  • $spaceAfterOpen !== 'newline'
  • $spaceAfterOpen === 'newline'
  • $spaceBeforeClose !== 'newline'
  • $spaceBeforeClose === 'newline'
  • $spaces !== 'newline'
firstincorrect
  • $errorCode = 'FirstIncorrect'
  • $errorCode === 'FirstIncorrect'
line
  • $commentStyle = 'line'
  • $commentStyle === 'line'
\\
  • $namespace = '\\'
  • $newToken['content'] = '\\'
  • $chars[($i - 1)] !== '\\'
  • $chars[($i - 2)] === '\\'
  • $chars[($next - 1)] !== '\\'
  • $chars[($next - 2)] === '\\'
  • $chars[$x] !== '\\'
  • $fullQualifiedClassName === '\\'
+
  • $operator = '+'
  • $operator === '+'
  • $tokens[($i + 1)] === '+'
-
  • $operator = '-'
  • $arg === '-'
  • $arg[0] === '-'
  • $arg[1] === '-'
  • $arg[6] === '-'
  • $commentTokens[1]['content'] !== '-'
  • $content[0] === '-'
  • $finalTokens[$stackPtr]['content'][0] === '-'
  • $matches[3] !== '-'
  • $switch === '-'
  • $tokens[($i + 1)] === '-'
hello
  • $GLOBALS['var'] = 'hello'
  • $string = 'hello'
  • $var = 'hello'
  • $var2 = 'hello'
  • $variable = 'hello'
  • $variable === 'hello'
string
  • $suggestedTypeHint = 'string'
  • $var = 'string'
  • $variable = 'string'
  • $pattern[$i]['type'] === 'string'
  • $suggestedName === 'string'
  • $suggestedTypeHint === 'string'
  • $value == 'string'
  • $value === 'string'
  • 'string' == $value
  • 'string' === $value
\t
  • $indent = "\t"
  • $length = '\t'
  • $comment[$i] === "\t"
  • $length === '\t'
  • $spacing === "\t"
  • $string[$start] !== "\t"
  • $tokens[($openingBrace - 1)]['content'] === "\t"
  • $tokens[($use + 1)]['content'] === "\t"
  • $tokens[($use - 1)]['content'] === "\t"
  • $tokens[$commentLines[1]]['orig_content'][0] === "\t"
  • $tokens[$line]['orig_content'][0] === "\t"
auto
  • $this->reportWidth = 'auto'
  • $value === 'auto'
php
  • $newExtensions[$ext] = 'PHP'
  • $this->tokenizerType = 'PHP'
  • $name === "php"
  • $phpcsFile->tokenizerType !== 'PHP'
  • $phpcsFile->tokenizerType === 'PHP'
  • $role !== 'php'
  • $this->tokenizerType === 'PHP'
sniff
  • $propertyScope = 'sniff'
  • $settings['scope'] === 'sniff'
utf-8
  • $this->encoding = 'utf-8'
  • $phpcsFile->config->encoding !== 'utf-8'
first
  • $humanReadableCount = 'first'
  • $position = 'first'
  • $position !== 'first'
  • $this->allowOnly === 'first'
true
  • $value = 'true'
  • $value === 'true'
standard
  • $propertyScope = 'standard'
  • $node->nodeName === 'standard'
t_string
  • $finalTokens[$newStackPtr]['type'] = 'T_STRING'
  • $newToken['type'] = 'T_STRING'
  • $this->tokens[$i]['type'] = 'T_STRING'
  • $token['type'] = 'T_STRING'
  • $tokens[$i]['type'] = 'T_STRING'
  • $type = 'T_STRING'
  • $value = 'T_STRING'
  • $tokens[($parenthesis + 1)]['type'] !== 'T_STRING'
  • $tokens[$string]['type'] === 'T_STRING'
use
  • $baseUse = 'use'
  • $errorPrefix = 'Use'
  • $type = 'use'
  • $type === 'use'
t_lnumber
  • $finalTokens[($newStackPtr - 1)]['type'] = 'T_LNUMBER'
  • $type = 'T_LNUMBER'
  • $tokens[($equals + 1)]['type'] !== 'T_LNUMBER'
  • $tokens[$value]['type'] === 'T_LNUMBER'
t_function
  • $this->tokens[$name]['type'] = 'T_FUNCTION'
  • $value === 'T_FUNCTION'
function
  • $metricType = 'Function'
  • $buffer !== 'function'
  • $content === 'function'
  • $tokens[$next]['content'] === 'function'
  • $tokens[$prev]['content'] === 'function'
\n
  • $eolChar = "\n"
  • $char === "\n"
  • $found === '\n'
  • $nextToken[1] === "\n"
  • $tokens[($i + 3)]['content'] === "\n"
  • $tokens[($stackPtr + 1)][1] === "\n"
  • $tokens[($stackPtr + 1)][1][0] === "\n"
  • $tokens[$lastToken]['content'] !== "\n"
\r\n
  • $eolChar = "\r\n"
  • $nextToken[1] === "\r\n"
false
  • $value = 'false'
  • $value === 'false'
unknown
  • $author = 'Unknown'
  • $skip['to'] = 'unknown'
  • $pattern[$i]['to'] === 'unknown'
  • $specialPattern['to'] !== 'unknown'
parenthesis_opener
  • $to = 'parenthesis_opener'
  • $to === 'parenthesis_opener'
stdin
  • $path = 'STDIN'
  • $filename !== 'STDIN'
  • $filename === 'STDIN'
  • $path === 'STDIN'
  • $this->path !== 'STDIN'
parenthesis_closer
  • $skip['to'] = 'parenthesis_closer'
  • $pattern[$i]['to'] === 'parenthesis_closer'
private
  • $scope = 'private'
  • $memberProps['scope'] !== 'private'
  • $memberProps['scope'] === 'private'
  • $methodProps['scope'] === 'private'
  • $scopeModifier === 'private'
protected
  • $scope = 'protected'
  • $scopeModifier === 'protected'
  • $this->minimumVisibility === 'protected'
public
  • $scope = 'public'
  • $vars[$paramCount]['property_visibility'] = 'public'
  • $foundFunctions[$funcData['name']] === 'public'
  • $memberProps['scope'] === 'public'
  • $this->minimumVisibility === 'public'
case
  • $type = 'Case'
  • $type = 'case'
  • $type !== 'case'
  • $type === 'Case'
  • $type === 'case'
default
  • $type = 'Default'
  • $type = 'default'
  • $type === 'Default'
)
  • $closingContent = ')'
  • $tokens[$i] === ')'
  • $tokens[$x] === ')'
file
  • $docBlock = 'file'
  • $key === 'file'
?
  • $newToken['content'] = '?'
  • $token[0] === '?'
  • $tokens[($stackPtr + 1)][0] === '?'
  • $tokens[$x] === '?'
  • $typeName[0] === '?'
property or parameter
  • $suspectedType = 'property or parameter'
  • $suspectedType === 'property or parameter'
return
  • $suspectedType = 'return'
  • $suspectedType === 'return'
"
  • $tokenContent = '"'
  • $subToken[0] === '"'
  • $token[0] === '"'
  • $workingString[0] !== '"'
t_equal
  • $newToken['type'] = 'T_EQUAL'
  • $tokens[($string + 1)]['type'] !== 'T_EQUAL'
  • $tokens[$equals]['type'] === 'T_EQUAL'
t_semicolon
  • $newToken['type'] = 'T_SEMICOLON'
  • $tokens[($parenthesis + 1)]['type'] !== 'T_SEMICOLON'
  • $tokens[$token]['type'] === 'T_SEMICOLON'
.
  • $path = '.'
  • $currentDir !== '.'
  • $dir === '.'
  • $lastChar !== '.'
  • $newContent !== '.'
  • $token[0] === '.'
  • $tokens[($stackPtr + 1)] === '.'
  • $tokens[($stackPtr + 2)] === '.'
  • $value[0] === '.'
warning
  • $oppositeType = 'warning'
  • $type !== 'warning'
error
  • $oppositeType = 'error'
  • $error['type'] === 'ERROR'
  • $type !== 'error'
t_open_curly_bracket
  • $newToken['type'] = 'T_OPEN_CURLY_BRACKET'
  • $tokens[$token]['type'] === 'T_OPEN_CURLY_BRACKET'
t_close_parenthesis
  • $newToken['type'] = 'T_CLOSE_PARENTHESIS'
  • $tokens[($value + 1)]['type'] !== 'T_CLOSE_PARENTHESIS'
  • $tokens[$parenthesis]['type'] === 'T_CLOSE_PARENTHESIS'
  • $tokens[$prevToken]['type'] !== 'T_CLOSE_PARENTHESIS'
t_open_parenthesis
  • $newToken['type'] = 'T_OPEN_PARENTHESIS'
  • $tokens[($stackPtr + 1)]['type'] !== 'T_OPEN_PARENTHESIS'
  • $tokens[$parenthesis]['type'] === 'T_OPEN_PARENTHESIS'
tag
  • $prevValidType = 'tag'
  • $type === 'tag'
last
  • $position = 'last'
  • $position !== 'last'
  • $position === 'last'
  • $this->allowOnly === 'last'
squiz pty ltd
  • $expected = 'Squiz Pty Ltd <products@squiz.net>'
  • $tokens[$string]['content'] !== 'Squiz Pty Ltd <products@squiz.net>'
object
  • $suggestedTypeHint = 'object'
  • $suggestedName === 'object'
bool
  • $suggestedTypeHint = 'bool'
  • $suggestedName === 'bool'
  • $suggestedTypeHint === 'bool'
  • $typecastLc === 'bool'
float
  • $suggestedTypeHint = 'float'
  • $suggestedName === 'float'
  • $suggestedTypeHint === 'float'
int
  • $suggestedTypeHint = 'int'
  • $suggestedName === 'int'
  • $suggestedTypeHint === 'int'
  • $typecastLc === 'int'
mixed
  • $suggestedTypeHint = 'mixed'
  • $returnType !== 'mixed'
  • $suggestedName === 'mixed'