Skip to content

Commit bc6352b

Browse files
committed
File passed to --tmp-file cannot be in project files
1 parent f5f0b37 commit bc6352b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Command/AnalyseCommand.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
286286
}
287287
}
288288

289+
if ($inceptionResult->getEditorModeTmpFile() !== null) {
290+
if (in_array($inceptionResult->getEditorModeTmpFile(), $files, true)) {
291+
$inceptionResult->getStdOutput()->getStyle()->error(sprintf('File %s passed to --tmp-file is already in analysed project files.', $inceptionResult->getEditorModeInsteadOfFile()));
292+
return $inceptionResult->handleReturn(1, null, $this->analysisStartTime);
293+
}
294+
}
295+
289296
$analysedConfigFiles = array_intersect($files, $container->getParameter('allConfigFiles'));
290297
/** @var RelativePathHelper $relativePathHelper */
291298
$relativePathHelper = $container->getService('relativePathHelper');

0 commit comments

Comments
 (0)