Skip to content

Commit 7a21246

Browse files
committed
[BCB] Removed autoload_files
1 parent d25c5e5 commit 7a21246

File tree

3 files changed

+1
-38
lines changed

3 files changed

+1
-38
lines changed

conf/config.neon

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ parameters:
99
excludes_analyse: []
1010
excludePaths: null
1111
autoload_directories: []
12-
autoload_files: []
1312
level: null
1413
paths: []
1514
exceptions:
@@ -195,7 +194,6 @@ parametersSchema:
195194
])
196195
), nullable())
197196
autoload_directories: listOf(string())
198-
autoload_files: listOf(string())
199197
level: schema(anyOf(int(), string()), nullable())
200198
paths: listOf(string())
201199
exceptions: structure([
@@ -1687,7 +1685,6 @@ services:
16871685
parser: @phpParserDecorator
16881686
php8Parser: @php8PhpParser
16891687
autoloadDirectories: %autoload_directories%
1690-
autoloadFiles: %autoload_files%
16911688
scanFiles: %scanFiles%
16921689
scanDirectories: %scanDirectories%
16931690
analysedPaths: %analysedPaths%

src/Command/CommandHelper.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -308,25 +308,6 @@ public static function begin(
308308
throw new \PHPStan\Command\InceptionNotSuccessfulException();
309309
}
310310

311-
$autoloadFiles = $container->getParameter('autoload_files');
312-
if ($manageMemoryLimitFile && count($autoloadFiles) > 0) {
313-
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>autoload_files</>. ⚠️️');
314-
$errorOutput->writeLineFormatted('');
315-
$errorOutput->writeLineFormatted('You might not need it anymore - try removing it from your');
316-
$errorOutput->writeLineFormatted('configuration file and run PHPStan again.');
317-
$errorOutput->writeLineFormatted('');
318-
$errorOutput->writeLineFormatted('If the analysis fails, there are now two distinct options');
319-
$errorOutput->writeLineFormatted('to choose from to replace <fg=cyan>autoload_files</>:');
320-
$errorOutput->writeLineFormatted('1) <fg=cyan>scanFiles</> - PHPStan will scan those for classes and functions');
321-
$errorOutput->writeLineFormatted(' definitions. PHPStan will not execute those files.');
322-
$errorOutput->writeLineFormatted('2) <fg=cyan>bootstrapFiles</> - PHPStan will execute these files to prepare');
323-
$errorOutput->writeLineFormatted(' the PHP runtime environment for the analysis.');
324-
$errorOutput->writeLineFormatted('');
325-
$errorOutput->writeLineFormatted('Read more about this in PHPStan\'s documentation:');
326-
$errorOutput->writeLineFormatted('https://phpstan.org/user-guide/discovering-symbols');
327-
$errorOutput->writeLineFormatted('');
328-
}
329-
330311
$autoloadDirectories = $container->getParameter('autoload_directories');
331312
if (count($autoloadDirectories) > 0 && $manageMemoryLimitFile) {
332313
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>autoload_directories</>. ⚠️️');
@@ -341,16 +322,6 @@ public static function begin(
341322
$errorOutput->writeLineFormatted('');
342323
}
343324

344-
foreach ($autoloadFiles as $parameterAutoloadFile) {
345-
if (!file_exists($parameterAutoloadFile)) {
346-
$errorOutput->writeLineFormatted(sprintf('Autoload file %s does not exist.', $parameterAutoloadFile));
347-
throw new \PHPStan\Command\InceptionNotSuccessfulException();
348-
}
349-
(static function (string $file) use ($container): void {
350-
require_once $file;
351-
})($parameterAutoloadFile);
352-
}
353-
354325
$bootstrapFile = $container->getParameter('bootstrap');
355326
if ($bootstrapFile !== null) {
356327
if ($manageMemoryLimitFile) {

src/Reflection/BetterReflection/BetterReflectionSourceLocatorFactory.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ class BetterReflectionSourceLocatorFactory
5656
/** @var string[] */
5757
private $autoloadDirectories;
5858

59-
/** @var string[] */
60-
private $autoloadFiles;
61-
6259
/** @var string[] */
6360
private $scanFiles;
6461

@@ -102,7 +99,6 @@ public function __construct(
10299
AutoloadSourceLocator $autoloadSourceLocator,
103100
Container $container,
104101
array $autoloadDirectories,
105-
array $autoloadFiles,
106102
array $scanFiles,
107103
array $scanDirectories,
108104
array $analysedPaths,
@@ -122,7 +118,6 @@ public function __construct(
122118
$this->autoloadSourceLocator = $autoloadSourceLocator;
123119
$this->container = $container;
124120
$this->autoloadDirectories = $autoloadDirectories;
125-
$this->autoloadFiles = $autoloadFiles;
126121
$this->scanFiles = $scanFiles;
127122
$this->scanDirectories = $scanDirectories;
128123
$this->analysedPaths = $analysedPaths;
@@ -156,7 +151,7 @@ public function create(): SourceLocator
156151
$analysedDirectories[] = $analysedPath;
157152
}
158153

159-
$analysedFiles = array_unique(array_merge($analysedFiles, $this->autoloadFiles, $this->scanFiles));
154+
$analysedFiles = array_unique(array_merge($analysedFiles, $this->scanFiles));
160155
foreach ($analysedFiles as $analysedFile) {
161156
$locators[] = $this->optimizedSingleFileSourceLocatorRepository->getOrCreate($analysedFile);
162157
}

0 commit comments

Comments
 (0)