Skip to content

Commit

Permalink
Apply @xabbuh's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpott committed Jan 7, 2025
1 parent 1e092fc commit 1fc3b02
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Symfony/Component/Yaml/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1206,11 +1206,8 @@ private function lexInlineStructure(int &$cursor, string $closingTag, bool $cons
$value .= $this->currentLine[$cursor];
++$cursor;

if ($consumeUntilEol && isset($this->currentLine[$cursor]) && (strspn($this->currentLine, ' ', $cursor) + $cursor) < strlen($this->currentLine)) {
$remain = trim(substr($this->currentLine, $cursor));
if (!str_starts_with($remain, '#')) {
throw new ParseException(sprintf('Unexpected token "%s".', $remain));
}
if ($consumeUntilEol && isset($this->currentLine[$cursor]) && ($whitespaces = strspn($this->currentLine, ' ', $cursor) + $cursor) < strlen($this->currentLine) && '#' !== $this->currentLine[$whitespaces]) {
throw new ParseException(sprintf('Unexpected token "%s".', trim(substr($this->currentLine, $cursor))));
}

return $value;
Expand Down

0 comments on commit 1fc3b02

Please sign in to comment.