From e237ffb66926a5e9e3c87c7d4bc5a3e12b114cee Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 3 May 2021 00:29:38 +0700 Subject: [PATCH] [Scoper] Skip Prefix\Composer\ usage (#6293) * [Scoper] Skip Prefix\Composer\ usage * cover Composer\InstalledVersions --- scoper.php | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/scoper.php b/scoper.php index c0580a729a78..510b19cccbfe 100644 --- a/scoper.php +++ b/scoper.php @@ -57,39 +57,14 @@ function (string $filePath, string $prefix, string $content) use ($filePathsToRe }, function (string $filePath, string $prefix, string $content): string { - if (! Strings::endsWith($filePath, 'vendor/composer/package-versions-deprecated/src/PackageVersions/Versions.php')) { - return $content; - } - - // see https://regex101.com/r/v8zRMm/1 - return Strings::replace( - $content, ' - #' . $prefix . '\\\\Composer\\\\InstalledVersions#', - 'Composer\InstalledVersions' - ); - }, - - function (string $filePath, string $prefix, string $content): string { - if (! Strings::contains($content, $prefix . '\Composer\Plugin')) { - return $content; - } - - return Strings::replace( - $content, ' - #' . $prefix . '\\\\Composer\\\\Plugin#', - 'Composer\Plugin' - ); - }, - - function (string $filePath, string $prefix, string $content): string { - if (! Strings::contains($content, $prefix . '\Composer\EventDispatcher')) { + if (! Strings::contains($content, $prefix . '\Composer\\')) { return $content; } return Strings::replace( $content, ' - #' . $prefix . '\\\\Composer\\\\EventDispatcher#', - 'Composer\EventDispatcher' + #' . $prefix . '\\\\Composer\\\\#', + 'Composer\\' ); },