From 34ba861a8f4e68cbd7995133817d39c29dc955f2 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Mon, 12 Jun 2023 18:36:56 +0100 Subject: [PATCH] Add test case with multiple statements on one line --- .../Squiz/Tests/PHP/NonExecutableCodeUnitTest.2.inc | 6 ++++++ src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.2.inc b/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.2.inc index c9bf052f34..2a759ec483 100644 --- a/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.2.inc +++ b/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.2.inc @@ -58,4 +58,10 @@ $a = new class { } }; +// Multiple statements are still one line of unreachable code, so should get +// only one complaint from this sniff. (Well, technically two here since there +// are two 'exit()' statements above, so one complaint from each of those. So, +// two here, but not six.) +echo 'one'; echo 'two'; echo 'three'; + interface MyInterface { diff --git a/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php b/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php index 06c0d475b1..659706ad8f 100644 --- a/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php +++ b/src/Standards/Squiz/Tests/PHP/NonExecutableCodeUnitTest.php @@ -84,6 +84,7 @@ public function getWarningList($testFile='') 10 => 2, 14 => 1, 54 => 2, + 65 => 2, ]; break; case 'NonExecutableCodeUnitTest.3.inc':