Skip to content

Commit

Permalink
[BCB] Removed autoload_files
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 12, 2021
1 parent d25c5e5 commit 7a21246
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 38 deletions.
3 changes: 0 additions & 3 deletions conf/config.neon
Expand Up @@ -9,7 +9,6 @@ parameters:
excludes_analyse: []
excludePaths: null
autoload_directories: []
autoload_files: []
level: null
paths: []
exceptions:
Expand Down Expand Up @@ -195,7 +194,6 @@ parametersSchema:
])
), nullable())
autoload_directories: listOf(string())
autoload_files: listOf(string())
level: schema(anyOf(int(), string()), nullable())
paths: listOf(string())
exceptions: structure([
Expand Down Expand Up @@ -1687,7 +1685,6 @@ services:
parser: @phpParserDecorator
php8Parser: @php8PhpParser
autoloadDirectories: %autoload_directories%
autoloadFiles: %autoload_files%
scanFiles: %scanFiles%
scanDirectories: %scanDirectories%
analysedPaths: %analysedPaths%
Expand Down
29 changes: 0 additions & 29 deletions src/Command/CommandHelper.php
Expand Up @@ -308,25 +308,6 @@ public static function begin(
throw new \PHPStan\Command\InceptionNotSuccessfulException();
}

$autoloadFiles = $container->getParameter('autoload_files');
if ($manageMemoryLimitFile && 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('');
}

$autoloadDirectories = $container->getParameter('autoload_directories');
if (count($autoloadDirectories) > 0 && $manageMemoryLimitFile) {
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>autoload_directories</>. ⚠️️');
Expand All @@ -341,16 +322,6 @@ public static function begin(
$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();
}
(static function (string $file) use ($container): void {
require_once $file;
})($parameterAutoloadFile);
}

$bootstrapFile = $container->getParameter('bootstrap');
if ($bootstrapFile !== null) {
if ($manageMemoryLimitFile) {
Expand Down
Expand Up @@ -56,9 +56,6 @@ class BetterReflectionSourceLocatorFactory
/** @var string[] */
private $autoloadDirectories;

/** @var string[] */
private $autoloadFiles;

/** @var string[] */
private $scanFiles;

Expand Down Expand Up @@ -102,7 +99,6 @@ public function __construct(
AutoloadSourceLocator $autoloadSourceLocator,
Container $container,
array $autoloadDirectories,
array $autoloadFiles,
array $scanFiles,
array $scanDirectories,
array $analysedPaths,
Expand All @@ -122,7 +118,6 @@ public function __construct(
$this->autoloadSourceLocator = $autoloadSourceLocator;
$this->container = $container;
$this->autoloadDirectories = $autoloadDirectories;
$this->autoloadFiles = $autoloadFiles;
$this->scanFiles = $scanFiles;
$this->scanDirectories = $scanDirectories;
$this->analysedPaths = $analysedPaths;
Expand Down Expand Up @@ -156,7 +151,7 @@ public function create(): SourceLocator
$analysedDirectories[] = $analysedPath;
}

$analysedFiles = array_unique(array_merge($analysedFiles, $this->autoloadFiles, $this->scanFiles));
$analysedFiles = array_unique(array_merge($analysedFiles, $this->scanFiles));
foreach ($analysedFiles as $analysedFile) {
$locators[] = $this->optimizedSingleFileSourceLocatorRepository->getOrCreate($analysedFile);
}
Expand Down

0 comments on commit 7a21246

Please sign in to comment.