Skip to content

Commit a615540

Browse files
authored
Merge pull request #2506 from WordPress/feature/minor-simplification
2 parents e965fdd + 382448c commit a615540

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

WordPress/Sniffs/Files/FileNameSniff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function process_token( $stackPtr ) {
154154
// Usage of `stripQuotes` is to ensure `stdin_path` passed by IDEs does not include quotes.
155155
$file = TextStrings::stripQuotes( $this->phpcsFile->getFileName() );
156156
if ( 'STDIN' === $file ) {
157-
return;
157+
return $this->phpcsFile->numTokens;
158158
}
159159

160160
$class_ptr = $this->phpcsFile->findNext( \T_CLASS, $stackPtr );
@@ -163,7 +163,7 @@ public function process_token( $stackPtr ) {
163163
* This rule should not be applied to test classes (at all).
164164
* @link https://github.com/WordPress/WordPress-Coding-Standards/issues/1995
165165
*/
166-
return;
166+
return $this->phpcsFile->numTokens;
167167
}
168168

169169
// Respect phpcs:disable comments as long as they are not accompanied by an enable.
@@ -184,7 +184,7 @@ public function process_token( $stackPtr ) {
184184

185185
if ( false === $i ) {
186186
// The entire (rest of the) file is disabled.
187-
return;
187+
return $this->phpcsFile->numTokens;
188188
}
189189
}
190190
}
@@ -204,7 +204,7 @@ public function process_token( $stackPtr ) {
204204
}
205205

206206
// Only run this sniff once per file, no need to run it again.
207-
return ( $this->phpcsFile->numTokens + 1 );
207+
return $this->phpcsFile->numTokens;
208208
}
209209

210210
/**

WordPress/Sniffs/Utils/I18nTextDomainFixerSniff.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ public function process_token( $stackPtr ) {
394394
if ( ! is_string( $this->new_text_domain )
395395
|| '' === $this->new_text_domain
396396
) {
397-
return ( $this->phpcsFile->numTokens + 1 );
397+
return $this->phpcsFile->numTokens;
398398
}
399399

400400
if ( isset( $this->old_text_domain ) ) {
@@ -403,7 +403,7 @@ public function process_token( $stackPtr ) {
403403
if ( ! is_array( $this->old_text_domain )
404404
|| array() === $this->old_text_domain
405405
) {
406-
return ( $this->phpcsFile->numTokens + 1 );
406+
return $this->phpcsFile->numTokens;
407407
}
408408
}
409409

@@ -421,7 +421,7 @@ public function process_token( $stackPtr ) {
421421
array( $this->new_text_domain )
422422
);
423423

424-
return ( $this->phpcsFile->numTokens + 1 );
424+
return $this->phpcsFile->numTokens;
425425
}
426426

427427
if ( preg_match( '`^[a-z0-9-]+$`', $this->new_text_domain ) !== 1 ) {
@@ -432,14 +432,14 @@ public function process_token( $stackPtr ) {
432432
array( $this->new_text_domain )
433433
);
434434

435-
return ( $this->phpcsFile->numTokens + 1 );
435+
return $this->phpcsFile->numTokens;
436436
}
437437

438438
// If the text domain passed both validations, it should be considered valid.
439439
$this->is_valid = true;
440440

441441
} elseif ( false === $this->is_valid ) {
442-
return ( $this->phpcsFile->numTokens + 1 );
442+
return $this->phpcsFile->numTokens;
443443
}
444444

445445
if ( isset( $this->tab_width ) === false ) {
@@ -685,7 +685,7 @@ public function process_comments( $stackPtr ) {
685685
if ( isset( $this->phpcsFile->tokenizerType ) && 'CSS' === $this->phpcsFile->tokenizerType ) {
686686
if ( 'style.css' !== $file_name && ! defined( 'PHP_CODESNIFFER_IN_TESTS' ) ) {
687687
// CSS files only need to be examined for the file header.
688-
return ( $this->phpcsFile->numTokens + 1 );
688+
return $this->phpcsFile->numTokens;
689689
}
690690

691691
$regex = $this->theme_header_regex;

0 commit comments

Comments
 (0)