diff --git a/src/Parsing/ParserState.php b/src/Parsing/ParserState.php index d0969f35..37b66376 100644 --- a/src/Parsing/ParserState.php +++ b/src/Parsing/ParserState.php @@ -334,7 +334,7 @@ public function isEnd(): bool } /** - * @param array|string $aEnd + * @param array|string $stopCharacters * @param string $bIncludeEnd * @param string $consumeEnd * @param array $comments @@ -342,15 +342,19 @@ public function isEnd(): bool * @throws UnexpectedEOFException * @throws UnexpectedTokenException */ - public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, array &$comments = []): string - { - $aEnd = \is_array($aEnd) ? $aEnd : [$aEnd]; + public function consumeUntil( + $stopCharacters, + $bIncludeEnd = false, + $consumeEnd = false, + array &$comments = [] + ): string { + $stopCharacters = \is_array($stopCharacters) ? $stopCharacters : [$stopCharacters]; $out = ''; $start = $this->currentPosition; while (!$this->isEnd()) { $char = $this->consume(1); - if (\in_array($char, $aEnd, true)) { + if (\in_array($char, $stopCharacters, true)) { if ($bIncludeEnd) { $out .= $char; } elseif (!$consumeEnd) { @@ -364,13 +368,13 @@ public function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, a } } - if (\in_array(self::EOF, $aEnd, true)) { + if (\in_array(self::EOF, $stopCharacters, true)) { return $out; } $this->currentPosition = $start; throw new UnexpectedEOFException( - 'One of ("' . \implode('","', $aEnd) . '")', + 'One of ("' . \implode('","', $stopCharacters) . '")', $this->peek(5), 'search', $this->lineNumber