Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

Commit

Permalink
Suppress Linter error: Remove ReturnStatement from the list of statem…
Browse files Browse the repository at this point in the history
…ents to stop at (#36)

* Remove ReturnStatement from the list of statements to stop at when looking if we should suppress a linting error.

* Turns out I was not checking the leading for siblings

* Always check the current node

* Update test to match new behavior

* Revert "Update test to match new behavior"

This reverts commit dc64a8d.

* Revert back to beck statement first
  • Loading branch information
johanoskarsson authored and fredemmott committed Dec 18, 2017
1 parent a5fc002 commit 815cd08
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Linters/suppress_ast_linter_error.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@ function is_linter_suppressed_in_sibling_node(
$token = $sibling->getLastToken();
if ($token !== null) {
$trailing = $token->getTrailing()->getCode();

if (Str\contains($trailing, $fixme) || Str\contains($trailing, $ignore)) {
return true;
}

$leading = $token->getLeading()->getCode();
if (Str\contains($leading, $fixme) || Str\contains($leading, $ignore)) {
return true;
}
}

return false;
Expand Down

0 comments on commit 815cd08

Please sign in to comment.