Skip to content

Commit

Permalink
Deprecate autoload_files
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Jun 7, 2020
1 parent b971fc6 commit d0e9bf2
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/Command/CommandHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,26 @@ public static function begin(
throw new \PHPStan\Command\InceptionNotSuccessfulException();
}

foreach ($container->getParameter('autoload_files') as $parameterAutoloadFile) {
$autoloadFiles = $container->getParameter('autoload_files');
if (count($autoloadFiles) > 0) {
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>autoload_files</>. ⚠️️');
$errorOutput->writeLineFormatted('');
$errorOutput->writeLineFormatted('You might not need it anymore - try removing it from your');
$errorOutput->writeLineFormatted('configuration file and run PHPStan again.');
$errorOutput->writeLineFormatted('');
$errorOutput->writeLineFormatted('If the analysis fails, there are now two distinct options');
$errorOutput->writeLineFormatted('to choose from to replace <fg=cyan>autoload_files</>:');
$errorOutput->writeLineFormatted('1) <fg=cyan>scanFiles</> - PHPStan will scan those for classes and functions');
$errorOutput->writeLineFormatted(' definitions. PHPStan will not execute those files.');
$errorOutput->writeLineFormatted('2) <fg=cyan>bootstrapFiles</> - PHPStan will execute these files to prepare');
$errorOutput->writeLineFormatted(' the PHP runtime environment for the analysis.');
$errorOutput->writeLineFormatted('');
$errorOutput->writeLineFormatted('Read more about this in PHPStan\'s documentation:');
$errorOutput->writeLineFormatted('https://phpstan.org/user-guide/discovering-symbols');
$errorOutput->writeLineFormatted('');
}

foreach ($autoloadFiles as $parameterAutoloadFile) {
if (!file_exists($parameterAutoloadFile)) {
$errorOutput->writeLineFormatted(sprintf('Autoload file %s does not exist.', $parameterAutoloadFile));
throw new \PHPStan\Command\InceptionNotSuccessfulException();
Expand Down

0 comments on commit d0e9bf2

Please sign in to comment.