Skip to content

Commit

Permalink
Tools/BrainMonkeyRaceCondition: minor tweak
Browse files Browse the repository at this point in the history
As we're only looking for a _method_ in a _class_, this condition will never happen under normal circumstances, not even in case of live coding as the function declaration would not be recognized as a _method_ in that case, so the sniff would bow out before reaching this condition.

All the same, there's always to possibility that this could happen if PHP adds some new syntax and the PHPCS tokenizer does not support it yet or if there is another Tokenizer issue, so I'm keeping the condition, but marking it as fine to ignore for code coverage.
  • Loading branch information
jrfnl committed Nov 4, 2023
1 parent 01aba49 commit dc0ffd2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Yoast/Sniffs/Tools/BrainMonkeyRaceConditionSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public function process( File $phpcsFile, $stackPtr ) {

// Now walk the contents of the function declaration to see if we can find the other function call.
if ( isset( $tokens[ $functionToken ]['scope_opener'], $tokens[ $functionToken ]['scope_closer'] ) === false ) {
// We don't know the start or end of the function.
return;
// We don't know the start or end of the function. Edge case which can't happen under normal circumstances.
return; // @codeCoverageIgnore
}

$targetContent = 'expectdone';
Expand Down

0 comments on commit dc0ffd2

Please sign in to comment.