Skip to content

Commit dfdd554

Browse files
committed
Fix Yaml tests for PHP 7.1 and 7.2 removing stdClass::__set_state()
1 parent 05f0ba7 commit dfdd554

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

util/ActionTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ private function do(array $actions): string
9999
$params = $this->adjustClientParams($value);
100100
$params = var_export($params, true);
101101
$params = $this->convertDollarValueInVariable($params); // replace '$var' or '${var}' in $var
102+
$params = $this->convertStdClass($params); // convert "stdClass::__set_state(array())" in "(object)[]"
102103
}
103104
$vars[':endpoint'] = $this->convertDotToArrow($key);
104105
$vars[':params'] = str_replace("\n","\n" . self::TAB14, $params);
@@ -445,6 +446,15 @@ private function convertJavaRegexToPhp(string $regex): string
445446
return $regex;
446447
}
447448

449+
/**
450+
* Convert "stdClass::__set_state" into "(object) []"
451+
* @see https://www.php.net/manual/en/function.var-export.php#refsect1-function.var-export-changelog
452+
*/
453+
private function convertStdClass(string $value): string
454+
{
455+
return preg_replace("/stdClass::__set_state\(array\(\s+\)\)/", '(object) []', $value);
456+
}
457+
448458
/**
449459
* Adjust the client parameters (e.g. ignore)
450460
*/

0 commit comments

Comments
 (0)