Skip to content

Commit

Permalink
Merge pull request #2506 from WordPress/feature/minor-simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryJones authored Nov 8, 2024
2 parents e965fdd + 382448c commit a615540
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions WordPress/Sniffs/Files/FileNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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.
Expand All @@ -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;
}
}
}
Expand All @@ -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;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) ) {
Expand All @@ -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;
}
}

Expand All @@ -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 ) {
Expand All @@ -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 ) {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a615540

Please sign in to comment.