From 01a94222bb8f65c94dbe18f39a19d5f980e2c7e3 Mon Sep 17 00:00:00 2001 From: Ion Bazan Date: Thu, 13 Oct 2022 12:25:25 +0800 Subject: [PATCH] Fix ValueGenerator on PHP 8.2 --- .github/workflows/phpunit.yml | 1 + src/ProxyManager/Generator/ValueGenerator.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index d7ccb782..d09951b6 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -19,6 +19,7 @@ jobs: - "7.4" - "8.0" - "8.1" + - "8.2" operating-system: - "ubuntu-latest" diff --git a/src/ProxyManager/Generator/ValueGenerator.php b/src/ProxyManager/Generator/ValueGenerator.php index e7d938af..3c4b3951 100644 --- a/src/ProxyManager/Generator/ValueGenerator.php +++ b/src/ProxyManager/Generator/ValueGenerator.php @@ -61,6 +61,10 @@ public function generate(): string private static function fixExport(string $value): string { + if (\PHP_VERSION_ID >= 80200) { + return $value; + } + $parts = preg_split('{(\'(?:[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')}', $value, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($parts as $i => &$part) {