Skip to content

Commit

Permalink
Merge pull request #2364 from WordPress/feature/sniff-remove-init-method
Browse files Browse the repository at this point in the history
Sniff: remove `init()` method
  • Loading branch information
dingo-d authored Aug 20, 2023
2 parents afbd469 + 977e3f2 commit 185308a
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions WordPress/Sniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ abstract class Sniff implements PHPCS_Sniff {
* normal file processing.
*/
public function process( File $phpcsFile, $stackPtr ) {
$this->init( $phpcsFile );
$this->phpcsFile = $phpcsFile;
$this->tokens = $phpcsFile->getTokens();

return $this->process_token( $stackPtr );
}

Expand All @@ -67,21 +69,4 @@ public function process( File $phpcsFile, $stackPtr ) {
* normal file processing.
*/
abstract public function process_token( $stackPtr );

/**
* Initialize the class for the current process.
*
* This method must be called by child classes before using many of the methods
* below.
*
* @since 0.4.0
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file currently being processed.
*
* @return void
*/
protected function init( File $phpcsFile ) {
$this->phpcsFile = $phpcsFile;
$this->tokens = $phpcsFile->getTokens();
}
}

0 comments on commit 185308a

Please sign in to comment.