@@ -1081,60 +1081,62 @@ pub(crate) fn find_uncaught_throw_types_with_context(
10811081
10821082 // 1. Direct `throw new Type(…)` statements
10831083 for throw in & throws {
1084- if let Some ( exc_type) = normalize_throw_type ( & throw. type_name ) {
1085- if !is_caught_by ( & catches, throw. offset , & exc_type) && seen . insert ( exc_type . to_string ( ) )
1086- {
1087- uncaught . push ( exc_type ) ;
1088- }
1084+ if let Some ( exc_type) = normalize_throw_type ( & throw. type_name )
1085+ && !is_caught_by ( & catches, throw. offset , & exc_type)
1086+ && seen . insert ( exc_type . to_string ( ) )
1087+ {
1088+ uncaught . push ( exc_type ) ;
10891089 }
10901090 }
10911091
10921092 // 2. `throw $this->method()` -- return type of method is the thrown type
10931093 for te in & throw_expr_types {
1094- if let Some ( exc_type) = normalize_throw_type ( & te. type_name ) {
1095- if !is_caught_by ( & catches, te. offset , & exc_type) && seen. insert ( exc_type. to_string ( ) ) {
1096- uncaught. push ( exc_type) ;
1097- }
1094+ if let Some ( exc_type) = normalize_throw_type ( & te. type_name )
1095+ && !is_caught_by ( & catches, te. offset , & exc_type)
1096+ && seen. insert ( exc_type. to_string ( ) )
1097+ {
1098+ uncaught. push ( exc_type) ;
10981099 }
10991100 }
11001101
11011102 // 3. Propagated @throws from called methods (same-file text search)
11021103 for prop in & propagated {
1103- if let Some ( exc_type) = normalize_throw_type ( & prop. type_name ) {
1104- if !is_caught_by ( & catches, prop. offset , & exc_type) && seen . insert ( exc_type . to_string ( ) )
1105- {
1106- uncaught . push ( exc_type ) ;
1107- }
1104+ if let Some ( exc_type) = normalize_throw_type ( & prop. type_name )
1105+ && !is_caught_by ( & catches, prop. offset , & exc_type)
1106+ && seen . insert ( exc_type . to_string ( ) )
1107+ {
1108+ uncaught . push ( exc_type ) ;
11081109 }
11091110 }
11101111
11111112 // 4. Inline `/** @throws ExceptionType */` annotations in the body
11121113 let inline = find_inline_throws_annotations ( & body) ;
11131114 for info in & inline {
1114- if let Some ( exc_type) = normalize_throw_type ( & info. type_name ) {
1115- if !is_caught_by ( & catches, info. offset , & exc_type) && seen . insert ( exc_type . to_string ( ) )
1116- {
1117- uncaught . push ( exc_type ) ;
1118- }
1115+ if let Some ( exc_type) = normalize_throw_type ( & info. type_name )
1116+ && !is_caught_by ( & catches, info. offset , & exc_type)
1117+ && seen . insert ( exc_type . to_string ( ) )
1118+ {
1119+ uncaught . push ( exc_type ) ;
11191120 }
11201121 }
11211122
11221123 // 5. `throw $variable` — resolved from catch clause variable type
11231124 for tv in & throw_vars {
1124- if let Some ( exc_type) = normalize_throw_type ( & tv. type_name ) {
1125- if !is_caught_by ( & catches, tv. offset , & exc_type) && seen. insert ( exc_type. to_string ( ) ) {
1126- uncaught. push ( exc_type) ;
1127- }
1125+ if let Some ( exc_type) = normalize_throw_type ( & tv. type_name )
1126+ && !is_caught_by ( & catches, tv. offset , & exc_type)
1127+ && seen. insert ( exc_type. to_string ( ) )
1128+ {
1129+ uncaught. push ( exc_type) ;
11281130 }
11291131 }
11301132
11311133 // 6. Cross-file propagated @throws from all call patterns
11321134 for prop in & cross_file_propagated {
1133- if let Some ( exc_type) = normalize_throw_type ( & prop. type_name ) {
1134- if !is_caught_by ( & catches, prop. offset , & exc_type) && seen . insert ( exc_type . to_string ( ) )
1135- {
1136- uncaught . push ( exc_type ) ;
1137- }
1135+ if let Some ( exc_type) = normalize_throw_type ( & prop. type_name )
1136+ && !is_caught_by ( & catches, prop. offset , & exc_type)
1137+ && seen . insert ( exc_type . to_string ( ) )
1138+ {
1139+ uncaught . push ( exc_type ) ;
11381140 }
11391141 }
11401142
0 commit comments