Skip to content

Commit 26878e8

Browse files
authored
fix: removes broken sniff EmptyCommentSniff (#249)
* fix: removes broken sniff * fix: re-adds broken sniff and catch possible exceptions * chore: ignores phpstan error
1 parent e0c3d9f commit 26878e8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ parameters:
2424
- '#Access to an undefined property PHP_CodeSniffer\\Config::\$standards.#'
2525
- '#Access to an undefined property PHP_CodeSniffer\\Sniffs\\Sniff::\$#'
2626
- '#NunoMaduro\\PhpInsights\\Application\\Console\\Formatters\\Json has an unused parameter \$input#'
27+
- '#In method "NunoMaduro\\PhpInsights\\Domain\\File::process", caught "Throwable" must be rethrown#'
2728
autoload_files:
2829
- %rootDir%/../../squizlabs/php_codesniffer/autoload.php
2930
reportUnmatchedIgnoredErrors: false

src/Domain/File.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ public function process(): void
111111

112112
$this->reportActiveSniffClass($sniff);
113113

114-
$sniff->process($this, $stackPtr);
114+
try {
115+
$sniff->process($this, $stackPtr);
116+
} catch (\Throwable $e) {
117+
$this->addError('Unparsable php code: syntax error or wrong phpdocs.', $stackPtr, $token['code']);
118+
}
115119
}
116120
}
117121

0 commit comments

Comments
 (0)