diff --git a/WordPress/Sniffs/Files/FileNameSniff.php b/WordPress/Sniffs/Files/FileNameSniff.php index 63fc917440..72c3e3d44d 100644 --- a/WordPress/Sniffs/Files/FileNameSniff.php +++ b/WordPress/Sniffs/Files/FileNameSniff.php @@ -154,7 +154,7 @@ public function process_token( $stackPtr ) { // Usage of `stripQuotes` is to ensure `stdin_path` passed by IDEs does not include quotes. $file = TextStrings::stripQuotes( $this->phpcsFile->getFileName() ); if ( 'STDIN' === $file ) { - return; + return $this->phpcsFile->numTokens; } $class_ptr = $this->phpcsFile->findNext( \T_CLASS, $stackPtr ); @@ -163,7 +163,7 @@ public function process_token( $stackPtr ) { * This rule should not be applied to test classes (at all). * @link https://github.com/WordPress/WordPress-Coding-Standards/issues/1995 */ - return; + return $this->phpcsFile->numTokens; } // Respect phpcs:disable comments as long as they are not accompanied by an enable. @@ -184,7 +184,7 @@ public function process_token( $stackPtr ) { if ( false === $i ) { // The entire (rest of the) file is disabled. - return; + return $this->phpcsFile->numTokens; } } } @@ -204,7 +204,7 @@ public function process_token( $stackPtr ) { } // Only run this sniff once per file, no need to run it again. - return ( $this->phpcsFile->numTokens + 1 ); + return $this->phpcsFile->numTokens; } /** diff --git a/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php b/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php index 5c26c71258..3d3ef9d425 100644 --- a/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php +++ b/WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php @@ -394,7 +394,7 @@ public function process_token( $stackPtr ) { if ( ! is_string( $this->new_text_domain ) || '' === $this->new_text_domain ) { - return ( $this->phpcsFile->numTokens + 1 ); + return $this->phpcsFile->numTokens; } if ( isset( $this->old_text_domain ) ) { @@ -403,7 +403,7 @@ public function process_token( $stackPtr ) { if ( ! is_array( $this->old_text_domain ) || array() === $this->old_text_domain ) { - return ( $this->phpcsFile->numTokens + 1 ); + return $this->phpcsFile->numTokens; } } @@ -421,7 +421,7 @@ public function process_token( $stackPtr ) { array( $this->new_text_domain ) ); - return ( $this->phpcsFile->numTokens + 1 ); + return $this->phpcsFile->numTokens; } if ( preg_match( '`^[a-z0-9-]+$`', $this->new_text_domain ) !== 1 ) { @@ -432,14 +432,14 @@ public function process_token( $stackPtr ) { array( $this->new_text_domain ) ); - return ( $this->phpcsFile->numTokens + 1 ); + return $this->phpcsFile->numTokens; } // If the text domain passed both validations, it should be considered valid. $this->is_valid = true; } elseif ( false === $this->is_valid ) { - return ( $this->phpcsFile->numTokens + 1 ); + return $this->phpcsFile->numTokens; } if ( isset( $this->tab_width ) === false ) { @@ -685,7 +685,7 @@ public function process_comments( $stackPtr ) { if ( isset( $this->phpcsFile->tokenizerType ) && 'CSS' === $this->phpcsFile->tokenizerType ) { if ( 'style.css' !== $file_name && ! defined( 'PHP_CODESNIFFER_IN_TESTS' ) ) { // CSS files only need to be examined for the file header. - return ( $this->phpcsFile->numTokens + 1 ); + return $this->phpcsFile->numTokens; } $regex = $this->theme_header_regex;