Skip to content

Commit c06cbc2

Browse files
committed
AC-662: Create phpcs static check for AutogeneratedClassNotInConstructorTest
1 parent f7b3bcc commit c06cbc2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Magento2/Sniffs/PHP/AutogeneratedClassNotInConstructorSniff.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function process(File $phpcsFile, $stackPtr)
6363
if ($variable = $phpcsFile->findNext(T_VARIABLE, $equalsPtr, $statementEnd)) {
6464
$variableName = $phpcsFile->getTokens()[$variable]['content'];
6565
if ($variableName === '$this') {
66-
$variableName = $this->getNext($phpcsFile, $variable, $statementEnd, T_STRING)['content'];
66+
$variableName = $this->getNext($phpcsFile, $variable, $statementEnd, T_STRING)['content'];
6767
}
6868
foreach ($this->constructorParameters as $parameter) {
6969
$parameterName = $parameter['name'];
@@ -188,10 +188,12 @@ private function getPrevious(File $phpcsFile, int $from, $types)
188188
}
189189

190190
/**
191-
* @param $parameterName
192-
* @return array|string|string[]
191+
* Get name of the variable without $
192+
*
193+
* @param string $parameterName
194+
* @return string
193195
*/
194-
protected function variableName($parameterName)
196+
protected function variableName(string $parameterName): string
195197
{
196198
return str_replace('$', '', $parameterName);
197199
}

0 commit comments

Comments
 (0)