diff --git a/.gitignore b/.gitignore index d1ac00fd4afb..581b1fdb0d9b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ !/temp/.gitkeep /example /vendor +/build composer.lock diff --git a/composer.json b/composer.json index 545c2398f1d0..bc311d4b8df6 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,18 @@ "vendor/bin/ecs check bin packages src tests --fix", "bin/clean_levels.sh" ], - "phpstan": "vendor/bin/phpstan.phar analyse packages src tests --level max --configuration phpstan.neon" + "phpstan": "vendor/bin/phpstan.phar analyse packages src tests --level max --configuration phpstan.neon", + "prefix-rector": [ + "rm -rf build/", + "php php-scoper.phar add-prefix --no-interaction --prefix='RectorPrefixed'", + "find build/ -type f -name '*.yml' | xargs perl -pi -e 's/((?:\\\\{1,2}\\w+|\\w+\\\\{1,2})(?:\\w+\\\\{0,2})+)/RectorPrefixed\\\\\\1/g'", + "find build/ -type f | xargs sed -i 's/RectorPrefixed\\\\Rector/Rector/g'", + "find build/ -type f | xargs sed -i 's/RectorPrefixed\\\\\\\\Rector/Rector/g'", + "find build/ -type f | xargs sed -i 's/use Symfony/use RectorPrefixed\\\\\\\\Symfony/g'", + "cp composer.json build/composer.json", + "cd build && composer dump-autoload", + "cd build && php bin/rector" + ] }, "bin": [ "bin/rector", diff --git a/php-scoper.phar b/php-scoper.phar new file mode 100644 index 000000000000..3db003ec20ed Binary files /dev/null and b/php-scoper.phar differ diff --git a/php-scoper.phar.pubkey b/php-scoper.phar.pubkey new file mode 100644 index 000000000000..a1455c679358 --- /dev/null +++ b/php-scoper.phar.pubkey @@ -0,0 +1,14 @@ +-----BEGIN PUBLIC KEY----- +MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxKi/ABhiCMn7hqH9/W0x +v2WKZDtUTDoSFRMl3WMBRL0wEmwvEajOJkzgAZLLomg6DCGrH7dSgZXBaxWyq1yY +efw1qj9HcFlRs82Y8OfzdDRGDbRobERXH+sulukN0Su7jADOJHyILlQgc64Zql2J ++BXQbBXJGIeoVk3I1hKg6GALpoA5kfFMw3l8FztKiRFcBMSRdeFQJlcsB/FCXnfN +LJMnaB2LJnnV6eTj4xD3dXrKky8KxBKMxrryxNFcXqMMfL5gBdaU6CH4VUn5yPDs +R/1KBsCgTmnFY6QmRlp+kI1ogmS5Eqk66xs5WBmuCHeB+phP7CFwvfF4kFGIGITl +5nKMJ7GJWG9CFEbPlZAcfgK3e12NyHuX+XUoc94IxbfzvcWxC/ZiuFSOAbTG95ut +Ue51KkeIxq0GmW8djFySSJM4PZbPHtr7b2LhkJzjQ66dXWyTJjqxZRskmKQota6o +qe8YWALClKLaG+LYM7ZFC4Q6fb4gs1x05feucbmuiWboeJyfL/CmoafnB6MqYXxX +DXXJhMWYbrTZuawNXUe/WhEQIdiGJsoI61y7DgvKw6ExdnelIakAO9EOfkffY5wE +KVZf+2kuEqm5UPvKmwozp/g/WmMAEEn6OJbHxeqKX7Ds/eLFiE2WlZm1YO3/JNbF +HshwDz0FnMzwQom3CiykuOsCAwEAAQ== +-----END PUBLIC KEY----- diff --git a/scoper.inc.php b/scoper.inc.php new file mode 100644 index 000000000000..f126496265b7 --- /dev/null +++ b/scoper.inc.php @@ -0,0 +1,28 @@ + 'RectorPrefixed', + 'finders' => [ + Finder::create() + ->files() + ->ignoreVCS(true) + ->notName('/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/') + ->in('*') + ->exclude([ + 'docs', + 'Tests' + ]) + , + ], + 'patchers' => [ + function (string $filePath, string $prefix, string $contents): string { + // Change the contents here. + + return $contents; + }, + ], +];