Skip to content

Commit 706b953

Browse files
authored
Ignore all PHPStan errors since ArgTyper only collects types and doesn't throw errors (#4)
1 parent 88ff40d commit 706b953

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.github/workflows/code_analysis.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030

3131
-
3232
name: 'Class Leak'
33-
run: vendor/bin/class-leak check src tests --skip-path=Fixture --skip-path=Source
33+
run: vendor/bin/class-leak check src tests --skip-path=Fixture --skip-path=Source --skip-type="Rector\\ArgTyper\\PHPStan\\IgnoreAllErrorsExceptArgTyperErrorExtension"
3434

3535
-
3636
name: 'Tests'
@@ -46,7 +46,7 @@ jobs:
4646

4747
-
4848
name: 'Check Active Classes'
49-
run: vendor/bin/class-leak check src bin tests --ansi --skip-path=Fixture --skip-path=Source
49+
run: vendor/bin/class-leak check src bin tests --ansi --skip-path=Fixture --skip-path=Source --skip-type="Rector\\ArgTyper\\PHPStan\\IgnoreAllErrorsExceptArgTyperErrorExtension"
5050

5151
name: ${{ matrix.actions.name }}
5252
runs-on: ubuntu-latest

config/phpstan-collecting-data.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@ parameters:
1414
rules:
1515
- Rector\ArgTyper\PHPStan\Rule\CollectFuncCallArgTypesRule
1616
- Rector\ArgTyper\PHPStan\Rule\CollectCallLikeArgTypesRule
17+
18+
services:
19+
-
20+
class: Rector\ArgTyper\PHPStan\IgnoreAllErrorsExceptArgTyperErrorExtension
21+
tags:
22+
- phpstan.ignoreErrorExtension
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Rector\ArgTyper\PHPStan;
6+
7+
use PhpParser\Node;
8+
use PHPStan\Analyser\Error;
9+
use PHPStan\Analyser\IgnoreErrorExtension;
10+
use PHPStan\Analyser\Scope;
11+
12+
final class IgnoreAllErrorsExceptArgTyperErrorExtension implements IgnoreErrorExtension
13+
{
14+
public function shouldIgnore(Error $error, Node $node, Scope $scope): bool
15+
{
16+
// Ignore all errors since ArgTyper only collects types and doesn't throw errors
17+
return true;
18+
}
19+
}

0 commit comments

Comments
 (0)