Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ class DeclarationCompatibilitySniff extends AbstractScopeSniff {
*/
private $currentClass = '';

/**
* A list of functions in the current class.
*
* @var string[]
*/
private $functionList = [];

/**
* A list of classes and methods to check.
*
Expand Down Expand Up @@ -211,7 +204,6 @@ protected function processTokenWithinScope( File $phpcsFile, $stackPtr, $currSco
$className = $phpcsFile->getDeclarationName( $currScope );

if ( $className !== $this->currentClass ) {
$this->loadFunctionNamesInScope( $phpcsFile, $currScope );
$this->currentClass = $className;
}

Expand Down Expand Up @@ -358,28 +350,6 @@ private function generateParamList( $methodSignature ) {
return $paramList;
}

/**
* Extracts all the function names found in the given scope.
*
* @param File $phpcsFile The current file being scanned.
* @param int $currScope A pointer to the start of the scope.
*
* @return void
*/
protected function loadFunctionNamesInScope( File $phpcsFile, $currScope ) {
$this->functionList = [];
$tokens = $phpcsFile->getTokens();

for ( $i = ( $tokens[ $currScope ]['scope_opener'] + 1 ); $i < $tokens[ $currScope ]['scope_closer']; $i++ ) {
if ( $tokens[ $i ]['code'] !== T_FUNCTION ) {
continue;
}

$next = $phpcsFile->findNext( T_STRING, $i );
$this->functionList[] = trim( $tokens[ $next ]['content'] );
}
}

/**
* Do nothing outside the scope. Has to be implemented accordingly to parent abstract class.
*
Expand Down