Skip to content

Commit

Permalink
bin/rector run with extracted phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 6, 2021
1 parent 4f8985a commit 528d4a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build_scoped_rector_php70.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ jobs:
# extra content of phpstan.phar to vendor/phpstan/phpstan-extracted
- run: php box.phar extract vendor/phpstan/phpstan/phpstan.phar vendor/phpstan/phpstan-extracted

# original phpstan/phpstan is now duplicated, we don't need it now
- run: composer remove phpstan/phpstan
# "composer remove phpstan/phpstan" original phpstan/phpstan is now duplicated, we don't need it now -required by phpstan extensions, cannot be removed like this

# to avoid double packing the same code
- run: rm -rf vendor/bin/phpstan
- run: rm -rf vendor/phpstan/phpstan/phpstan.phar
- run: rm phpstan-for-rector.neon

# THIS MUST WORK
- run: bin/rector downgrade-paths

# 1. 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
Expand Down
7 changes: 6 additions & 1 deletion bin/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
$autoloadIncluder = new AutoloadIncluder();
$autoloadIncluder->includeDependencyOrRepositoryVendorAutoloadIfExists();

if (should_include_preload()) {

// load extracted PHPStan with its own preload.php
$extractedPhpstanAutoload = __DIR__ . '/../vendor/phpstan/phpstan-extracted/vendor/autoload.php';
if (file_exists($extractedPhpstanAutoload)) {
require_once $extractedPhpstanAutoload;
} elseif (should_include_preload()) {
require_once __DIR__ . '/../preload.php';
}

Expand Down
3 changes: 0 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
use Symplify\SymfonyPhpConfig\ValueObjectInliner;

return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SETS, [SetList::NAMING]);

// include sets
$containerConfigurator->import(SetList::CODING_STYLE);
$containerConfigurator->import(SetList::CODE_QUALITY);
Expand Down

0 comments on commit 528d4a6

Please sign in to comment.