Skip to content

Commit 222abe5

Browse files
committed
[BCB] Removed excludes_analyse config option
1 parent 47dc2e6 commit 222abe5

File tree

8 files changed

+10
-39
lines changed

8 files changed

+10
-39
lines changed

Diff for: UPGRADING.md

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ parameters:
5858
identifier: missingType.generics
5959
```
6060

61+
### Removed option `excludes_analyse`
62+
63+
It has been replaced with [`excludePaths`](https://phpstan.org/user-guide/ignoring-errors#excluding-whole-files).
64+
6165
### Paths in `excludePaths` and `ignoreErrors` have to be a valid file path or a fnmatch pattern
6266

6367
If you are excluding a file path that might not exist but you still want to have it in `excludePaths`, append `(?)`:

Diff for: conf/config.neon

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ parameters:
77
- ../stubs/runtime/ReflectionAttribute.php
88
- ../stubs/runtime/Attribute.php
99
- ../stubs/runtime/ReflectionIntersectionType.php
10-
excludes_analyse: []
11-
excludePaths: null
10+
excludePaths: []
1211
level: null
1312
paths: []
1413
exceptions:
@@ -653,7 +652,6 @@ services:
653652
-
654653
class: PHPStan\File\FileExcluderFactory
655654
arguments:
656-
obsoleteExcludesAnalyse: %excludes_analyse%
657655
excludePaths: %excludePaths%
658656

659657
-

Diff for: conf/parametersSchema.neon

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
parametersSchema:
22
bootstrapFiles: listOf(string())
3-
excludes_analyse: listOf(string())
4-
excludePaths: schema(anyOf(
3+
excludePaths: anyOf(
54
structure([
65
analyse: listOf(string()),
76
]),
@@ -12,7 +11,7 @@ parametersSchema:
1211
analyse: listOf(string()),
1312
analyseAndScan: listOf(string())
1413
])
15-
), nullable())
14+
)
1615
level: schema(anyOf(int(), string()), nullable())
1716
paths: listOf(string())
1817
exceptions: structure([

Diff for: src/Command/CommandHelper.php

-15
Original file line numberDiff line numberDiff line change
@@ -524,21 +524,6 @@ public static function begin(
524524
throw new InceptionNotSuccessfulException();
525525
}
526526

527-
$excludesAnalyse = $container->getParameter('excludes_analyse');
528-
$excludePaths = $container->getParameter('excludePaths');
529-
if (count($excludesAnalyse) > 0 && $excludePaths !== null) {
530-
$errorOutput->writeLineFormatted(sprintf('Configuration parameters <fg=cyan>excludes_analyse</> and <fg=cyan>excludePaths</> cannot be used at the same time.'));
531-
$errorOutput->writeLineFormatted('');
532-
$errorOutput->writeLineFormatted(sprintf('Parameter <fg=cyan>excludes_analyse</> has been deprecated so use <fg=cyan>excludePaths</> only from now on.'));
533-
$errorOutput->writeLineFormatted('');
534-
535-
throw new InceptionNotSuccessfulException();
536-
} elseif (count($excludesAnalyse) > 0) {
537-
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>excludes_analyse</>. ⚠️️');
538-
$errorOutput->writeLineFormatted('');
539-
$errorOutput->writeLineFormatted(sprintf('Parameter <fg=cyan>excludes_analyse</> has been deprecated so use <fg=cyan>excludePaths</> only from now on.'));
540-
}
541-
542527
if ($container->hasParameter('scopeClass') && $container->getParameter('scopeClass') !== MutatingScope::class) {
543528
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>scopeClass</>. ⚠️️');
544529
$errorOutput->writeLineFormatted('');

Diff for: src/DependencyInjection/NeonAdapter.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
final class NeonAdapter implements Adapter
3232
{
3333

34-
public const CACHE_KEY = 'v28-ignore-errors';
34+
public const CACHE_KEY = 'v29-excludes-analyse';
3535

3636
private const PREVENT_MERGING_SUFFIX = '!';
3737

@@ -121,7 +121,6 @@ public function process(array $arr, string $fileKey, string $file): array
121121

122122
if (in_array($keyToResolve, [
123123
'[parameters][paths][]',
124-
'[parameters][excludes_analyse][]',
125124
'[parameters][excludePaths][]',
126125
'[parameters][excludePaths][analyse][]',
127126
'[parameters][excludePaths][analyseAndScan][]',

Diff for: src/File/FileExcluderFactory.php

+2-12
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,17 @@ final class FileExcluderFactory
1111
{
1212

1313
/**
14-
* @param string[] $obsoleteExcludesAnalyse
15-
* @param array{analyse?: array<int, string>, analyseAndScan?: array<int, string>}|null $excludePaths
14+
* @param array{analyse?: array<int, string>, analyseAndScan?: array<int, string>} $excludePaths
1615
*/
1716
public function __construct(
1817
private FileExcluderRawFactory $fileExcluderRawFactory,
19-
private array $obsoleteExcludesAnalyse,
20-
private ?array $excludePaths,
18+
private array $excludePaths,
2119
)
2220
{
2321
}
2422

2523
public function createAnalyseFileExcluder(): FileExcluder
2624
{
27-
if ($this->excludePaths === null) {
28-
return $this->fileExcluderRawFactory->create($this->obsoleteExcludesAnalyse);
29-
}
30-
3125
$paths = [];
3226
if (array_key_exists('analyse', $this->excludePaths)) {
3327
$paths = $this->excludePaths['analyse'];
@@ -41,10 +35,6 @@ public function createAnalyseFileExcluder(): FileExcluder
4135

4236
public function createScanFileExcluder(): FileExcluder
4337
{
44-
if ($this->excludePaths === null) {
45-
return $this->fileExcluderRawFactory->create($this->obsoleteExcludesAnalyse);
46-
}
47-
4838
$paths = [];
4939
if (array_key_exists('analyseAndScan', $this->excludePaths)) {
5040
$paths = $this->excludePaths['analyseAndScan'];

Diff for: src/Testing/TestCase.neon

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ services:
1010
phpParser: @phpParserDecorator
1111
php8Parser: @php8PhpParser
1212
fileExtensions: %fileExtensions%
13-
obsoleteExcludesAnalyse: %excludes_analyse%
1413
excludePaths: %excludePaths%
1514

1615
cacheStorage:

Diff for: src/Testing/TestCaseSourceLocatorFactory.php

-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ final class TestCaseSourceLocatorFactory
3131

3232
/**
3333
* @param string[] $fileExtensions
34-
* @param string[] $obsoleteExcludesAnalyse
3534
* @param array{analyse?: array<int, string>, analyseAndScan?: array<int, string>}|null $excludePaths
3635
*/
3736
public function __construct(
@@ -43,7 +42,6 @@ public function __construct(
4342
private ReflectionSourceStubber $reflectionSourceStubber,
4443
private PhpVersion $phpVersion,
4544
private array $fileExtensions,
46-
private array $obsoleteExcludesAnalyse,
4745
private ?array $excludePaths,
4846
)
4947
{
@@ -56,7 +54,6 @@ public function create(): SourceLocator
5654
$cacheKey = sha1(serialize([
5755
$this->phpVersion->getVersionId(),
5856
$this->fileExtensions,
59-
$this->obsoleteExcludesAnalyse,
6057
$this->excludePaths,
6158
]));
6259
if ($classLoaderReflection->hasProperty('vendorDir') && ! isset(self::$composerSourceLocatorsCache[$cacheKey])) {

0 commit comments

Comments
 (0)