File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ private function createLexer(array $grammar): Lexer
120120 /**
121121 * @psalm-suppress UndefinedAttributeClass : Optional (builtin) attribute usage
122122 */
123- public function parse (#[Language('PHP ' )] mixed $ source ): ? TypeStatement
123+ public function parse (#[Language('PHP ' )] mixed $ source ): TypeStatement
124124 {
125125 $ this ->lastProcessedTokenOffset = 0 ;
126126
@@ -142,7 +142,10 @@ public function parse(#[Language('PHP')] mixed $source): ?TypeStatement
142142 }
143143 }
144144
145- return null ;
145+ throw new ParseException (
146+ message: 'Could not read type statement ' ,
147+ code: ParseException::ERROR_CODE_INTERNAL_ERROR ,
148+ );
146149 } catch (UnexpectedTokenException $ e ) {
147150 throw $ this ->unexpectedTokenError ($ e , $ instance );
148151 } catch (UnrecognizedTokenException $ e ) {
@@ -161,8 +164,6 @@ public function parse(#[Language('PHP')] mixed $source): ?TypeStatement
161164 previous: $ e ,
162165 );
163166 }
164-
165- return null ;
166167 }
167168
168169 /**
Original file line number Diff line number Diff line change @@ -21,5 +21,5 @@ interface ParserInterface
2121 *
2222 * @psalm-suppress UndefinedAttributeClass : Optional (builtin) attribute usage
2323 */
24- public function parse (#[Language('PHP ' )] mixed $ source ): ? TypeStatement ;
24+ public function parse (#[Language('PHP ' )] mixed $ source ): TypeStatement ;
2525}
You can’t perform that action at this time.
0 commit comments