Skip to content

Commit

Permalink
Added fix for token parsing running into comma tokens and breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxwilko committed Mar 16, 2022
1 parent e15806d commit c7a5f6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Parse/PHP/ArrayPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ protected function getNodeComments(Node $node): ?array
$content = [];

while (++$pos < $end) {
if (!isset($tokens[$pos]) || !is_array($tokens[$pos])) {
if (!isset($tokens[$pos]) || (!is_array($tokens[$pos]) && $tokens[$pos] !== ',')) {
break;
}

if ($tokens[$pos][0] === T_WHITESPACE) {
if ($tokens[$pos][0] === T_WHITESPACE || $tokens[$pos] === ',') {
continue;
}

Expand Down

0 comments on commit c7a5f6a

Please sign in to comment.