Skip to content

Commit 3602735

Browse files
authored
CS/QA: use camelCase variable names (sirbrillig#255)
This fixes up the two places/three variables in the code base which didn't comply. Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
1 parent e048c90 commit 3602735

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

VariableAnalysis/Lib/Helpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ private static function getStartOfTokenScope(File $phpcsFile, $stackPtr) {
447447
$tokens = $phpcsFile->getTokens();
448448
$token = $tokens[$stackPtr];
449449

450-
$in_class = false;
450+
$inClass = false;
451451
$conditions = isset($token['conditions']) ? $token['conditions'] : [];
452452
$functionTokenTypes = [
453453
T_FUNCTION,
@@ -458,11 +458,11 @@ private static function getStartOfTokenScope(File $phpcsFile, $stackPtr) {
458458
return $scopePtr;
459459
}
460460
if (isset(Tokens::$ooScopeTokens[$scopeCode]) === true) {
461-
$in_class = true;
461+
$inClass = true;
462462
}
463463
}
464464

465-
if ($in_class) {
465+
if ($inClass) {
466466
// If this is inside a class and not inside a function, this is either a
467467
// class member variable definition, or a function argument. If it is a
468468
// variable definition, it has no scope on its own (it can only be used

VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,32 +1597,32 @@ protected function processCompactArguments(File $phpcsFile, $stackPtr, $argument
15971597
if (!isset($tokens[$argumentPtrs[0]])) {
15981598
continue;
15991599
}
1600-
$argument_first_token = $tokens[$argumentPtrs[0]];
1601-
if ($argument_first_token['code'] === T_ARRAY) {
1600+
$argumentFirstToken = $tokens[$argumentPtrs[0]];
1601+
if ($argumentFirstToken['code'] === T_ARRAY) {
16021602
// It's an array argument, recurse.
1603-
$array_arguments = Helpers::findFunctionCallArguments($phpcsFile, $argumentPtrs[0]);
1604-
$this->processCompactArguments($phpcsFile, $stackPtr, $array_arguments, $currScope);
1603+
$arrayArguments = Helpers::findFunctionCallArguments($phpcsFile, $argumentPtrs[0]);
1604+
$this->processCompactArguments($phpcsFile, $stackPtr, $arrayArguments, $currScope);
16051605
continue;
16061606
}
16071607
if (count($argumentPtrs) > 1) {
16081608
// Complex argument, we can't handle it, ignore.
16091609
continue;
16101610
}
1611-
if ($argument_first_token['code'] === T_CONSTANT_ENCAPSED_STRING) {
1611+
if ($argumentFirstToken['code'] === T_CONSTANT_ENCAPSED_STRING) {
16121612
// Single-quoted string literal, ie compact('whatever').
16131613
// Substr is to strip the enclosing single-quotes.
1614-
$varName = substr($argument_first_token['content'], 1, -1);
1614+
$varName = substr($argumentFirstToken['content'], 1, -1);
16151615
$this->markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $argumentPtrs[0], $currScope);
16161616
continue;
16171617
}
1618-
if ($argument_first_token['code'] === T_DOUBLE_QUOTED_STRING) {
1618+
if ($argumentFirstToken['code'] === T_DOUBLE_QUOTED_STRING) {
16191619
// Double-quoted string literal.
1620-
if (preg_match(Constants::getDoubleQuotedVarRegexp(), $argument_first_token['content'])) {
1620+
if (preg_match(Constants::getDoubleQuotedVarRegexp(), $argumentFirstToken['content'])) {
16211621
// Bail if the string needs variable expansion, that's runtime stuff.
16221622
continue;
16231623
}
16241624
// Substr is to strip the enclosing double-quotes.
1625-
$varName = substr($argument_first_token['content'], 1, -1);
1625+
$varName = substr($argumentFirstToken['content'], 1, -1);
16261626
$this->markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $argumentPtrs[0], $currScope);
16271627
continue;
16281628
}

0 commit comments

Comments
 (0)