From 2bb590feb629e9cd8ab2a314219133674de6a793 Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Wed, 15 Feb 2023 03:29:02 -0400 Subject: [PATCH] Allow suppressing `MissingThrowsDocblock` for individual exceptions Fixes vimeo/psalm#8638 --- config.xsd | 2 +- src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php | 1 + src/Psalm/Issue/MissingThrowsDocblock.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.xsd b/config.xsd index 3582e854b..fd338ad9d 100644 --- a/config.xsd +++ b/config.xsd @@ -318,7 +318,7 @@ - + diff --git a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php index 6eca8ec95..fb9c7128c 100644 --- a/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php @@ -736,6 +736,7 @@ abstract class FunctionLikeAnalyzer extends SourceAnalyzer $possibly_thrown_exception . ' is thrown but not caught - please either catch' . ' or add a @throws annotation', $codelocation, + $possibly_thrown_exception, ), ); } diff --git a/src/Psalm/Issue/MissingThrowsDocblock.php b/src/Psalm/Issue/MissingThrowsDocblock.php index 4a5862bf8..7dc0ba8ba 100644 --- a/src/Psalm/Issue/MissingThrowsDocblock.php +++ b/src/Psalm/Issue/MissingThrowsDocblock.php @@ -2,7 +2,7 @@ namespace Psalm\Issue; -final class MissingThrowsDocblock extends CodeIssue +final class MissingThrowsDocblock extends ClassIssue { public const SHORTCODE = 169; }