Skip to content

Commit a66c097

Browse files
committed
more minor optimizations
1 parent ccf1c29 commit a66c097

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

MO4/Sniffs/Arrays/ArrayDoubleArrowAlignmentSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function process(File $phpcsFile, $stackPtr)
9191
$previous = $tokens[($i - 1)];
9292

9393
// Skip nested arrays.
94-
if ((in_array($current['code'], $this->arrayTokens)) === true) {
94+
if (in_array($current['code'], $this->arrayTokens, true) === true) {
9595
if ($current['code'] === T_ARRAY) {
9696
$i = ($current['parenthesis_closer'] + 1);
9797
} else {

MO4/Sniffs/Formatting/AlphabeticalUseStatementsSniff.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
3939
{
4040

41-
const NAMESPACE_SEPRATOR_STRING = '\\';
41+
const NAMESPACE_SEPARATOR_STRING = '\\';
4242

4343
/**
4444
* Sorting order, can be one of:
@@ -50,7 +50,6 @@ class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
5050
*/
5151
public $order = 'dictionary';
5252

53-
5453
/**
5554
* Supported ordering methods
5655
*
@@ -83,7 +82,7 @@ class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
8382
*
8483
* @var string
8584
*/
86-
private $currentFile = null;
85+
private $currentFile;
8786

8887

8988
/**
@@ -239,9 +238,7 @@ private function getUseStatementAsString(
239238
$useLength++;
240239
}
241240

242-
$useStr = $phpcsFile->getTokensAsString($stackPtr, $useLength);
243-
244-
return $useStr;
241+
return $phpcsFile->getTokensAsString($stackPtr, $useLength);
245242

246243
}//end getUseStatementAsString()
247244

@@ -398,11 +395,11 @@ private function dictionaryCompare($a, $b)
398395
continue;
399396
}
400397

401-
if ($a[$i] === self::NAMESPACE_SEPRATOR_STRING) {
398+
if ($a[$i] === self::NAMESPACE_SEPARATOR_STRING) {
402399
return -1;
403400
}
404401

405-
if ($b[$i] === self::NAMESPACE_SEPRATOR_STRING) {
402+
if ($b[$i] === self::NAMESPACE_SEPARATOR_STRING) {
406403
return 1;
407404
}
408405

MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ public function process(File $phpcsFile, $stackPtr)
117117
$className,
118118
$namespace,
119119
$nsSep,
120-
($classNameEnd - 1),
121-
false
120+
($classNameEnd - 1)
122121
);
123122
} else {
124123
// Doc comment block.
@@ -171,7 +170,7 @@ public function process(File $phpcsFile, $stackPtr)
171170
PREG_SPLIT_NO_EMPTY
172171
);
173172
foreach ($typeTokens as $typeToken) {
174-
if (true === in_array($typeToken, $useStatements)) {
173+
if (true === in_array($typeToken, $useStatements, true)) {
175174
continue;
176175
}
177176

MO4/Sniffs/Strings/VariableInDoubleQuotedStringSniff.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ class VariableInDoubleQuotedStringSniff implements Sniff
3737
*
3838
* @var File
3939
*/
40-
private $phpCsFile = null;
40+
private $phpCsFile;
4141

4242

4343
/**
4444
* Registers the tokens that this sniff wants to listen for.
4545
*
4646
* @return array(int)
47-
* @see Tokens.php
47+
*
48+
* @see Tokens.php
4849
*/
4950
public function register()
5051
{

0 commit comments

Comments
 (0)