From c7a5f6aae1ac15855055a57492e19523cde285e1 Mon Sep 17 00:00:00 2001 From: Jack Wilkinson Date: Wed, 16 Mar 2022 13:06:32 +0000 Subject: [PATCH] Added fix for token parsing running into comma tokens and breaking --- src/Parse/PHP/ArrayPrinter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Parse/PHP/ArrayPrinter.php b/src/Parse/PHP/ArrayPrinter.php index 5ad5f6f36..04bf38937 100644 --- a/src/Parse/PHP/ArrayPrinter.php +++ b/src/Parse/PHP/ArrayPrinter.php @@ -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; }