Skip to content

Commit b0a2647

Browse files
committed
Stop using non-static methods as static
1 parent b770ed3 commit b0a2647

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/Standards/PSR12/Sniffs/Classes/AnonClassDeclarationSniff.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ class AnonClassDeclarationSniff extends ClassDeclarationSniff
2525
*/
2626
public $indent = 4;
2727

28+
/**
29+
* The PSR2 MultiLineFunctionDeclarations sniff.
30+
*
31+
* @var MultiLineFunctionDeclarationSniff
32+
*/
33+
private $multiLineSniff = null;
34+
35+
/**
36+
* The Generic FunctionCallArgumentSpacing sniff.
37+
*
38+
* @var FunctionCallArgumentSpacingSniff
39+
*/
40+
private $functionCallSniff = null;
41+
2842

2943
/**
3044
* Returns an array of tokens this test wants to listen for.
@@ -54,18 +68,21 @@ public function process(File $phpcsFile, $stackPtr)
5468
return;
5569
}
5670

71+
$this->multiLineSniff = new MultiLineFunctionDeclarationSniff();
72+
$this->functionCallSniff = new FunctionCallArgumentSpacingSniff();
73+
5774
$this->processOpen($phpcsFile, $stackPtr);
5875
$this->processClose($phpcsFile, $stackPtr);
5976

6077
if (isset($tokens[$stackPtr]['parenthesis_opener']) === true) {
6178
$openBracket = $tokens[$stackPtr]['parenthesis_opener'];
62-
if (MultiLineFunctionDeclarationSniff::isMultiLineDeclaration($phpcsFile, $stackPtr, $openBracket, $tokens) === true) {
79+
if ($this->multiLineSniff->isMultiLineDeclaration($phpcsFile, $stackPtr, $openBracket, $tokens) === true) {
6380
$this->processMultiLineArgumentList($phpcsFile, $stackPtr);
6481
} else {
6582
$this->processSingleLineArgumentList($phpcsFile, $stackPtr);
6683
}
6784

68-
FunctionCallArgumentSpacingSniff::checkSpacing($phpcsFile, $stackPtr, $openBracket);
85+
$this->functionCallSniff->checkSpacing($phpcsFile, $stackPtr, $openBracket);
6986
}
7087

7188
$opener = $tokens[$stackPtr]['scope_opener'];
@@ -223,8 +240,8 @@ public function processMultiLineArgumentList(File $phpcsFile, $stackPtr)
223240

224241
$openBracket = $tokens[$stackPtr]['parenthesis_opener'];
225242

226-
MultiLineFunctionDeclarationSniff::processBracket($phpcsFile, $openBracket, $tokens, 'argument');
227-
MultiLineFunctionDeclarationSniff::processArgumentList($phpcsFile, $stackPtr, $this->indent, 'argument');
243+
$this->multiLineSniff->processBracket($phpcsFile, $openBracket, $tokens, 'argument');
244+
$this->multiLineSniff->processArgumentList($phpcsFile, $stackPtr, $this->indent, 'argument');
228245

229246
}//end processMultiLineArgumentList()
230247

0 commit comments

Comments
 (0)