From 9c7ada4614cf0921b51856eda704775720a39aa2 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 2 Aug 2020 03:28:31 +0200 Subject: [PATCH] PHP 8.0 | Generic/EmptyStatement: include match expressions Allows the sniff to also check for empty match expressions. Includes unit test. --- .../Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php | 1 + .../Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc | 4 +++- .../Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php b/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php index d9248af39c..574bb0ba5a 100644 --- a/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php +++ b/src/Standards/Generic/Sniffs/CodeAnalysis/EmptyStatementSniff.php @@ -50,6 +50,7 @@ public function register() T_IF, T_SWITCH, T_WHILE, + T_MATCH, ]; }//end register() diff --git a/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc b/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc index 83780bce24..210788a1de 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc +++ b/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.inc @@ -69,4 +69,6 @@ try { // TODO: Handle this exception later :-) } -if (true) {} elseif (false) {} \ No newline at end of file +if (true) {} elseif (false) {} + +match($foo) {}; diff --git a/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php b/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php index 9d89ce2456..4e00ada1ca 100644 --- a/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php +++ b/src/Standards/Generic/Tests/CodeAnalysis/EmptyStatementUnitTest.php @@ -39,6 +39,7 @@ public function getErrorList() 64 => 1, 68 => 1, 72 => 2, + 74 => 1, ]; }//end getErrorList()