From 523ad144a2012a7ca6481b516af1bde76ea2e3ad Mon Sep 17 00:00:00 2001 From: Brown Date: Mon, 3 Jun 2019 15:02:28 -0400 Subject: [PATCH] Fix @psalm-suppress with newline --- src/Psalm/Internal/Analyzer/StatementsAnalyzer.php | 2 +- tests/IssueSuppressionTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php index 6af4e26d7..48da3343f 100644 --- a/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php @@ -229,7 +229,7 @@ class StatementsAnalyzer extends SourceAnalyzer implements StatementsSource * @return string */ function ($line) { - return explode(' ', trim($line))[0]; + return preg_split('/[\s]+/', $line)[0]; }, $comments['specials']['psalm-suppress'] ) diff --git a/tests/IssueSuppressionTest.php b/tests/IssueSuppressionTest.php index 2f2ffa40a..f5982fb60 100644 --- a/tests/IssueSuppressionTest.php +++ b/tests/IssueSuppressionTest.php @@ -79,6 +79,16 @@ class IssueSuppressionTest extends TestCase ); }', ], + 'suppressWithNewlineAfterComment' => [ + '