From 8372de2d2c3cc87f59478bc04c3df8bb342f57b4 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Thu, 28 Sep 2023 11:51:19 +0200 Subject: [PATCH] Fixed issue with set in YAML specification + interpolation for PHP 8.2 --- util/ActionTest.php | 15 +++++++++------ util/YamlTests.php | 13 +++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/util/ActionTest.php b/util/ActionTest.php index 7c8677442..67bdda131 100644 --- a/util/ActionTest.php +++ b/util/ActionTest.php @@ -175,12 +175,15 @@ private function transform_and_set(array $action): string private function set(array $action): string { - $key = key($action); - $this->variables[] = $action[$key]; - return YamlTests::render(self::TEMPLATE_SET_VARIABLE, [ - ':var' => $action[$key], - ':value' => $this->convertResponseField($key) - ]); + $output = ''; + foreach ($action as $key => $var) { + $this->variables[] = $var; + $output .= YamlTests::render(self::TEMPLATE_SET_VARIABLE, [ + ':var' => $var, + ':value' => $this->convertResponseField($key) + ]); + } + return $output; } private function warnings(array $action, array &$vars) diff --git a/util/YamlTests.php b/util/YamlTests.php index 6998f8e33..c78008ad2 100644 --- a/util/YamlTests.php +++ b/util/YamlTests.php @@ -291,6 +291,9 @@ public function build(): array ] ); } + // Fix ${var} string interpolation deprecated for PHP 8.2 + // @see https://php.watch/versions/8.2/$%7Bvar%7D-string-interpolation-deprecated + $test = $this->fixStringInterpolationInCurlyBracket($test); file_put_contents($testDirName . '/' . $testName . '.php', $test); try { eval(substr($test, 5)); // remove testDir) + 1);