mirror of
https://github.com/rectorphp/rector.git
synced 2024-07-31 13:50:23 +00:00
[Scoper] Skip vendor/composer/composer for prefixing (#6291)
* [Scoper] Skip vendor/composer/composer for prefixing * on Composer\Plugin
This commit is contained in:
parent
f9170bec35
commit
e7dba6f48a
@ -39,6 +39,7 @@ jobs:
|
||||
|
||||
# 1. (a) copy files to $NESTED_DIRECTORY directory Exclude the scoped/nested directories to prevent rsync from copying in a loop
|
||||
- run: rsync --exclude rector-build-php70 -av * rector-build-php70 --quiet
|
||||
- run: rm -rf rector-build-php70/packages-tests rector-build-php70/rules-tests rector-build-php70/tests
|
||||
|
||||
# 2. downgrade rector
|
||||
- run: sh build/downgrade-rector-php70.sh rector-build-php70
|
||||
@ -46,9 +47,6 @@ jobs:
|
||||
# 3. prefix classes
|
||||
- run: sh build/build-rector-scoped.sh rector-build-php70 rector-prefixed-downgraded-php70
|
||||
|
||||
# 1. (b) remove tests directory after run scoped
|
||||
- run: rm -rf rector-build-php70/packages-tests rector-build-php70/rules-tests rector-build-php70/tests
|
||||
|
||||
# 4. lint the code for PHP 7.0 - this must happen here, as setup-php allows only one PHP version switch: https://github.com/shivammathur/setup-php/issues/434
|
||||
-
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
12
scoper.php
12
scoper.php
@ -69,6 +69,18 @@ return [
|
||||
);
|
||||
},
|
||||
|
||||
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'
|
||||
);
|
||||
},
|
||||
|
||||
// get version for prefixed version
|
||||
function (string $filePath, string $prefix, string $content): string {
|
||||
if (! Strings::endsWith($filePath, 'src/Configuration/Configuration.php')) {
|
||||
|
Loading…
Reference in New Issue
Block a user