Add the following else-if branch under the current one.
Rationale: if you're in a quoted-string, don't look for more quotes as they're part of the comment.
if ($char === $currentQuoteDelim) {
$inQuote = false;
$currentQuoteDelim = null;
continue;
}
// We are in a quote, but encountered another quote-char: don't do anything.
else if ( $inQuote ) {
continue;
}
Code to reproduce the issue
Expected results
Actual results
Solution
Add the following else-if branch under the current one. Rationale: if you're in a quoted-string, don't look for more quotes as they're part of the comment.