Skip to content

Commit b7fe990

Browse files
committed
Do not report nonexistent paths in ignoreErrors if reportUnmatchedIgnoredErrors: false
1 parent 6ee5c22 commit b7fe990

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

Diff for: .github/workflows/e2e-tests.yml

+4
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ jobs:
247247
cp -r tmp-node-modules node_modules
248248
OUTPUT=$(../../bin/phpstan analyse -c ignoreNonexistentExcludePath.neon)
249249
echo "$OUTPUT"
250+
- script: |
251+
cd e2e/bad-exclude-paths
252+
OUTPUT=$(../../bin/phpstan analyse -c ignoreReportUnmatchedFalse.neon)
253+
echo "$OUTPUT"
250254
251255
steps:
252256
- name: "Checkout"
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
includes:
2+
- ../../conf/bleedingEdge.neon
3+
4+
parameters:
5+
level: 8
6+
paths:
7+
- src
8+
reportUnmatchedIgnoredErrors: false
9+
ignoreErrors:
10+
-
11+
message: '#aaa#'
12+
path: tests

Diff for: src/Command/CommandHelper.php

+5
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ public static function begin(
355355
$errorOutput->writeLineFormatted($error);
356356
$errorOutput->writeLineFormatted('');
357357
}
358+
359+
$errorOutput->writeLineFormatted('To ignore non-existent paths in ignoreErrors,');
360+
$errorOutput->writeLineFormatted('set <fg=cyan>reportUnmatchedIgnoredErrors: false</> in your configuration file.');
361+
$errorOutput->writeLineFormatted('');
362+
358363
throw new InceptionNotSuccessfulException();
359364
} catch (InvalidExcludePathsException $e) {
360365
$errorOutput->writeLineFormatted(sprintf('<error>Invalid %s in excludePaths:</error>', count($e->getErrors()) === 1 ? 'entry' : 'entries'));

Diff for: src/DependencyInjection/NeonAdapter.php

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

34-
public const CACHE_KEY = 'v27-optional-path';
34+
public const CACHE_KEY = 'v28-ignore-errors';
3535

3636
private const PREVENT_MERGING_SUFFIX = '!';
3737

Diff for: src/DependencyInjection/ValidateIgnoredErrorsExtension.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ public function getRegistry(): OperatorTypeSpecifyingExtensionRegistry
136136
}
137137
}
138138

139-
if ($noImplicitWildcard) {
139+
$reportUnmatched = (bool) $builder->parameters['reportUnmatchedIgnoredErrors'];
140+
141+
if ($noImplicitWildcard && $reportUnmatched) {
140142
foreach ($ignoreErrors as $ignoreError) {
141143
if (!is_array($ignoreError)) {
142144
continue;

0 commit comments

Comments
 (0)