From 815cd08e1a52e2e60dacf398105fed577e1e1a61 Mon Sep 17 00:00:00 2001 From: Johan Oskarsson Date: Mon, 18 Dec 2017 13:34:59 -0800 Subject: [PATCH] Suppress Linter error: Remove ReturnStatement from the list of statements 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 dc64a8dc542899c8f33dcb791f0defb8e5ea50b9. * Revert back to beck statement first --- src/Linters/suppress_ast_linter_error.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Linters/suppress_ast_linter_error.php b/src/Linters/suppress_ast_linter_error.php index 1a3c5ad5b..a5bff3ef4 100644 --- a/src/Linters/suppress_ast_linter_error.php +++ b/src/Linters/suppress_ast_linter_error.php @@ -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;