1515use PHPStan \PhpDocParser \Ast \Type \TypeNode ;
1616use PHPStan \PhpDocParser \Parser \TokenIterator ;
1717use TypePHP \Internal \Ast \Elimination \StaticTypeEvaluator ;
18+ use TypePHP \Internal \Diagnostic \DebugLog ;
1819use TypePHP \Internal \Docblock \DocblockExtractor ;
1920use TypePHP \Internal \Docblock \DocblockNormalizer ;
2021use TypePHP \Internal \Docblock \DocblockParser ;
@@ -362,7 +363,8 @@ private function collectUnprovenClassConstantChecks(Node\Stmt\Class_ $node, stri
362363 $ checkStmt ->setAttribute ('typephp_injected ' , true );
363364 $ injectedStmts [] = $ checkStmt ;
364365 }
365- } catch (\Throwable ) {
366+ } catch (\Throwable $ e ) {
367+ DebugLog ::swallowed ($ e );
366368 }
367369 }
368370
@@ -425,7 +427,8 @@ private function collectUnprovenGlobalConstantChecks(Node\Stmt\Const_ $node): ar
425427 $ checkStmt ->setAttribute ('typephp_injected ' , true );
426428 $ injectedStmts [] = $ checkStmt ;
427429 }
428- } catch (\Throwable ) {
430+ } catch (\Throwable $ e ) {
431+ DebugLog ::swallowed ($ e );
429432 }
430433
431434 return $ injectedStmts ;
@@ -721,7 +724,8 @@ private function processClassPropertyDefaults(Node\Stmt\Class_ $node): void
721724 if ($ classTemplates !== [] && DocblockParser ::typeReferencesTemplate ($ propTypeNode , $ classTemplates )) {
722725 continue ;
723726 }
724- } catch (\Throwable ) {
727+ } catch (\Throwable $ e ) {
728+ DebugLog ::swallowed ($ e );
725729 }
726730 }
727731
@@ -804,7 +808,8 @@ private function resolveClassTemplatesForDefaults(Node\Stmt\Class_ $node): array
804808 try {
805809 $ phpDocNode = DocblockExtractor ::parseDocString ($ nodeDoc ->getText ());
806810 $ classTemplates = DocblockExtractor ::extractTemplates ($ phpDocNode );
807- } catch (\Throwable ) {
811+ } catch (\Throwable $ e ) {
812+ DebugLog ::swallowed ($ e );
808813 }
809814 }
810815
@@ -814,7 +819,8 @@ private function resolveClassTemplatesForDefaults(Node\Stmt\Class_ $node): array
814819 try {
815820 $ loadedTemplates = DocblockParser ::parseClassTemplates ($ className );
816821 $ classTemplates = [...$ classTemplates , ...$ loadedTemplates ];
817- } catch (\Throwable ) {
822+ } catch (\Throwable $ e ) {
823+ DebugLog ::swallowed ($ e );
818824 }
819825 }
820826 }
@@ -825,7 +831,8 @@ private function resolveClassTemplatesForDefaults(Node\Stmt\Class_ $node): array
825831 try {
826832 $ parentTemplates = DocblockParser ::parseClassTemplates ($ parentClass );
827833 $ classTemplates = [...$ classTemplates , ...$ parentTemplates ];
828- } catch (\Throwable ) {
834+ } catch (\Throwable $ e ) {
835+ DebugLog ::swallowed ($ e );
829836 }
830837 }
831838
@@ -903,7 +910,8 @@ private function enterClassLike(Node\Stmt\Class_|Node\Stmt\Interface_|Node\Stmt\
903910 try {
904911 $ phpDocNode = DocblockExtractor ::parseDocString ($ doc ->getText ());
905912 $ templates = DocblockExtractor ::extractTemplates ($ phpDocNode );
906- } catch (\Throwable ) {
913+ } catch (\Throwable $ e ) {
914+ DebugLog ::swallowed ($ e );
907915 }
908916 }
909917 $ hasTemplates = $ templates !== [];
@@ -981,7 +989,8 @@ private function enterClassLike(Node\Stmt\Class_|Node\Stmt\Interface_|Node\Stmt\
981989 try {
982990 $ methodPhpDoc = DocblockExtractor ::parseDocString ($ methodDoc ->getText ());
983991 $ methodParamTags = DocblockExtractor ::getParamTags ($ methodPhpDoc );
984- } catch (\Throwable ) {
992+ } catch (\Throwable $ e ) {
993+ DebugLog ::swallowed ($ e );
985994 }
986995 }
987996
@@ -1168,6 +1177,7 @@ private function propagateShapeTypesToDestructuring(Node\Expr\List_|Node\Expr\Ar
11681177 }
11691178 }
11701179 } catch (\Throwable $ e ) {
1180+ DebugLog ::swallowed ($ e );
11711181 }
11721182 }
11731183
@@ -1231,7 +1241,8 @@ private function handleAssign(Node\Expr\Assign $node): void
12311241 if (StaticTypeEvaluator ::satisfies ($ expr , $ parsedType , $ this ->currentFile )) {
12321242 return ;
12331243 }
1234- } catch (\Throwable ) {
1244+ } catch (\Throwable $ e ) {
1245+ DebugLog ::swallowed ($ e );
12351246 }
12361247
12371248 $ node ->expr = $ this ->wrapVariableCheck ($ expr , $ typeString , $ varName , $ node ->var ->getStartLine ());
0 commit comments