-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parsing phpdoc with no trailing whitespace
- Loading branch information
1 parent
9d45205
commit 7c621a2
Showing
3 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ private function parseText(TokenIterator $tokens): Ast\PhpDoc\PhpDocTextNode | |
$tokens->pushSavePoint(); | ||
$tokens->next(); | ||
|
||
if ($tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_TAG) || $tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL) || $tokens->isCurrentTokenType(Lexer::TOKEN_CLOSE_PHPDOC) || $tokens->isCurrentTokenType(Lexer::TOKEN_END)) { | ||
if ($tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_TAG, Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END)) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
TomasVotruba
Contributor
|
||
$tokens->rollback(); | ||
break; | ||
} | ||
|
@@ -491,7 +491,10 @@ private function parseOptionalDescription(TokenIterator $tokens, bool $limitStar | |
$tokens->consumeTokenType(Lexer::TOKEN_OTHER); // will throw exception | ||
} | ||
|
||
if (!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL) && !$tokens->isPrecededByHorizontalWhitespace()) { | ||
if ( | ||
!$tokens->isCurrentTokenType(Lexer::TOKEN_PHPDOC_EOL, Lexer::TOKEN_CLOSE_PHPDOC, Lexer::TOKEN_END) | ||
&& !$tokens->isPrecededByHorizontalWhitespace() | ||
) { | ||
$tokens->consumeTokenType(Lexer::TOKEN_HORIZONTAL_WS); // will throw exception | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So when I rollback this line, it works. Interesting 😄