From 7def79ea788bbe6b16f673d1c74bebb78e4f2985 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 22 Feb 2021 05:06:26 +0100 Subject: [PATCH] PHP 8.0 | Generic/DisallowYodaConditions: add tests with match control structure --- .../ControlStructures/DisallowYodaConditionsUnitTest.inc | 9 +++++++++ .../ControlStructures/DisallowYodaConditionsUnitTest.php | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc b/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc index 725e15613f..ce458d8429 100644 --- a/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc +++ b/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.inc @@ -164,3 +164,12 @@ if ([function() { echo 'hi'; }] === [$foo] ) { } +echo match (5 == $num) { + true => "true\n", + false => "false\n" +}; + +echo match ($text) { + 'foo' => 10 === $y, + 10 === $y => 'bar', +}; diff --git a/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php b/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php index e69f3b88b1..c558ae8f6f 100644 --- a/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php +++ b/src/Standards/Generic/Tests/ControlStructures/DisallowYodaConditionsUnitTest.php @@ -59,6 +59,9 @@ public function getErrorList() 142 => 1, 156 => 1, 160 => 1, + 167 => 1, + 173 => 1, + 174 => 1, ]; }//end getErrorList()