Skip to content

Commit 977e3f2

Browse files
committed
Sniff: remove init() method
As pointed out by GaryJones, as all utility methods have now been made self-contained, it is no longer necessary to have a separate `initi()` method in the `Sniff` class.
1 parent 1eb217b commit 977e3f2

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

WordPress/Sniff.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ abstract class Sniff implements PHPCS_Sniff {
5252
* normal file processing.
5353
*/
5454
public function process( File $phpcsFile, $stackPtr ) {
55-
$this->init( $phpcsFile );
55+
$this->phpcsFile = $phpcsFile;
56+
$this->tokens = $phpcsFile->getTokens();
57+
5658
return $this->process_token( $stackPtr );
5759
}
5860

@@ -67,21 +69,4 @@ public function process( File $phpcsFile, $stackPtr ) {
6769
* normal file processing.
6870
*/
6971
abstract public function process_token( $stackPtr );
70-
71-
/**
72-
* Initialize the class for the current process.
73-
*
74-
* This method must be called by child classes before using many of the methods
75-
* below.
76-
*
77-
* @since 0.4.0
78-
*
79-
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file currently being processed.
80-
*
81-
* @return void
82-
*/
83-
protected function init( File $phpcsFile ) {
84-
$this->phpcsFile = $phpcsFile;
85-
$this->tokens = $phpcsFile->getTokens();
86-
}
8772
}

0 commit comments

Comments
 (0)