Skip to content

Commit c3518f3

Browse files
authored
[DX] Fix run on custom rector config when no rector.php (#7985)
1 parent 0594c13 commit c3518f3

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/Configuration/ConfigInitializer.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function __construct(
2020
private array $rectors,
2121
private InitFilePathsResolver $initFilePathsResolver,
2222
private SymfonyStyle $symfonyStyle,
23+
private RectorConfigsResolver $rectorConfigsResolver,
2324
) {
2425
}
2526

@@ -42,6 +43,14 @@ public function createConfig(string $projectDirectory): void
4243
return;
4344
}
4445

46+
$mainConfigFile = $this->rectorConfigsResolver->provide()->getMainConfigFile();
47+
if ($mainConfigFile !== null && file_exists($mainConfigFile)) {
48+
$this->symfonyStyle->warning(
49+
'Register rules or sets in your "' . basename($mainConfigFile) . '" config'
50+
);
51+
return;
52+
}
53+
4554
$response = $this->symfonyStyle->ask(
4655
'No "' . RectorConfigsResolver::DEFAULT_CONFIG_FILE . '" config found. Should we generate it for you?',
4756
'yes'

0 commit comments

Comments
 (0)