Skip to content

Commit

Permalink
[Config] Remove asterisk support in import() for file, use explicit p…
Browse files Browse the repository at this point in the history
…aths instead (#5010)
  • Loading branch information
TomasVotruba authored Sep 12, 2023
1 parent 848c2ad commit 01c0ea9
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 117 deletions.
1 change: 0 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
- 'e2e/parallel-reflection-resolver'
- 'e2e/applied-rule-removed-node'
- 'e2e/parallel with space'
- 'e2e/wildcards-path-import-config'
- 'e2e/different-path-over-skip-config'

name: End to end test - ${{ matrix.directory }}
Expand Down
4 changes: 1 addition & 3 deletions build/config/config-downgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
require_once __DIR__ . '/../target-repository/stubs-rector/PHPUnit/Framework/TestCase.php';

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->parallel();

$rectorConfig->skip(DowngradeRectorConfig::DEPENDENCY_EXCLUDE_PATHS);

$rectorConfig->phpstanConfig(__DIR__ . '/phpstan-for-downgrade.neon');

$rectorConfig->import(DowngradeLevelSetList::DOWN_TO_PHP_72);
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72]);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion build/target-repository/e2e/attributes/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Rector\Symfony\Set\SymfonySetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(SymfonySetList::SYMFONY_52);
$rectorConfig->sets([SymfonySetList::SYMFONY_52]);

$rectorConfig->phpVersion(PhpVersion::PHP_80);
$rectorConfig->paths([__DIR__ . '/src']);
Expand Down
2 changes: 1 addition & 1 deletion build/target-repository/e2e/dont-execute-code/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([__DIR__.'/src']);

$rectorConfig->import(SetList::PHP_53);
$rectorConfig->sets([SetList::PHP_53]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([__DIR__.'/src']);

$rectorConfig->import(SetList::DEAD_CODE);
$rectorConfig->sets([SetList::DEAD_CODE]);
};
2 changes: 1 addition & 1 deletion build/target-repository/e2e/parse-php7-code/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([__DIR__.'/src']);

$rectorConfig->import(SetList::PHP_53);
$rectorConfig->sets([SetList::PHP_53]);
};
2 changes: 1 addition & 1 deletion build/target-repository/e2e/parse-php8-code/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([__DIR__.'/src']);

$rectorConfig->import(SetList::PHP_53);
$rectorConfig->sets([SetList::PHP_53]);
};
1 change: 0 additions & 1 deletion e2e/wildcards-path-import-config/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions e2e/wildcards-path-import-config/composer.json

This file was deleted.

10 changes: 0 additions & 10 deletions e2e/wildcards-path-import-config/config/import_config.php

This file was deleted.

10 changes: 0 additions & 10 deletions e2e/wildcards-path-import-config/config/import_config_another.php

This file was deleted.

38 changes: 0 additions & 38 deletions e2e/wildcards-path-import-config/expected-output.diff

This file was deleted.

13 changes: 0 additions & 13 deletions e2e/wildcards-path-import-config/rector.php

This file was deleted.

8 changes: 0 additions & 8 deletions e2e/wildcards-path-import-config/src/DeadConstructor.php

This file was deleted.

11 changes: 0 additions & 11 deletions e2e/wildcards-path-import-config/src/GotUnreachableReturn.php

This file was deleted.

11 changes: 1 addition & 10 deletions packages/Config/RectorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,7 @@ static function (

public function import(string $filePath): void
{
$paths = [$filePath];

if (str_contains($filePath, '*')) {
$filesystemTweaker = new FilesystemTweaker();
$paths = $filesystemTweaker->resolveWithFnmatch($paths);
}

foreach ($paths as $path) {
$this->importFile($path);
}
$this->importFile($filePath);
}

/**
Expand Down

0 comments on commit 01c0ea9

Please sign in to comment.