Skip to content

Commit 47840f1

Browse files
committed
Exception about extra unconsumed comments
1 parent 73c8e3e commit 47840f1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Parser/PhpDocParser.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,19 @@ public function parse(TokenIterator $tokens): Ast\PhpDoc\PhpDocNode
116116

117117
$tokens->forwardToTheEnd();
118118

119+
$comments = $tokens->flushComments();
120+
if ($comments !== []) {
121+
throw new LogicException('Comments should already be flushed');
122+
}
123+
119124
return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocNode([$this->enrichWithAttributes($tokens, $tag, $startLine, $startIndex)]), 1, 0);
120125
}
121126

127+
$comments = $tokens->flushComments();
128+
if ($comments !== []) {
129+
throw new LogicException('Comments should already be flushed');
130+
}
131+
122132
return $this->enrichWithAttributes($tokens, new Ast\PhpDoc\PhpDocNode($children), 1, 0);
123133
}
124134

0 commit comments

Comments
 (0)