From 2502342644ef3393a306a51059c5c468228b5b6f Mon Sep 17 00:00:00 2001 From: Michal Lulco Date: Sat, 20 Aug 2022 14:29:58 +0200 Subject: [PATCH] [Scoper] Added namespaces to exclude (#30) --- scoper.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scoper.php b/scoper.php index c728a7d..9fb8973 100644 --- a/scoper.php +++ b/scoper.php @@ -15,16 +15,23 @@ return [ 'prefix' => 'RevealPrefix' . $timestamp, // @see https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#exposed-symbols - regex format - 'exclude-namespaces' => ['#^PHPStan#', '#^Reveal#', '#^PhpParser#'], + 'exclude-namespaces' => [ + '#^PHPStan#', + '#^Reveal#', + '#^PhpParser#', + '#^Symplify\\\\Astral#', + '#^Symplify\\\\SmartFileSystem#', + '#^Symplify\\\\PackageBuilder#', + ], 'expose-functions' => ['u', 'b', 's', 'trigger_deprecation'], 'patchers' => [ // fixes https://github.com/rectorphp/rector/issues/7017 - still needed 2022-06 function (string $filePath, string $prefix, string $content): string { - if (str_ends_with($filePath, 'vendor/symfony/string/ByteString.php')) { + if (\str_ends_with($filePath, 'vendor/symfony/string/ByteString.php')) { return Strings::replace($content, '#' . $prefix . '\\\\\\\\1_\\\\\\\\2#', '\\\\1_\\\\2'); } - if (str_ends_with($filePath, 'vendor/symfony/string/AbstractUnicodeString.php')) { + if (\str_ends_with($filePath, 'vendor/symfony/string/AbstractUnicodeString.php')) { return Strings::replace($content, '#' . $prefix . '\\\\\\\\1_\\\\\\\\2#', '\\\\1_\\\\2'); } @@ -44,5 +51,14 @@ function (string $filePath, string $prefix, string $content): string { return Strings::replace($content, '#services\->load\(\'#', "services->load('" . $prefix . '\\'); }, + + // latte services + function (string $filePath, string $prefix, string $content): string { + if (! \str_ends_with($filePath, 'config.neon') && ! \str_ends_with($filePath, 'services.neon')) { + return $content; + } + + return Strings::replace($content, '#- Latte\\\\#', "- $prefix\\Latte\\"); + }, ], ];