Skip to content

Commit

Permalink
[FEATURE] Add comsumeWhitespaceWithComments and redirect comsumeWhite…
Browse files Browse the repository at this point in the history
…space

Having comsumeWhitespace also consume comments and returning them was unexpected.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
  • Loading branch information
ziegenberg committed Aug 25, 2024
1 parent b48925e commit a07190b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ This project adheres to [Semantic Versioning](https://semver.org/).

### Added

- Add `ParserState::comsumeWhitespaceWithComments` method (#668)

### Changed

- Mark all class constants as `@internal` (#500)
- Redirect `ParserState::comsumeWhitespace` to `ParserState::comsumeWhitespaceWithComments` (#668)

### Deprecated

Expand Down
19 changes: 17 additions & 2 deletions src/Parsing/ParserState.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,27 @@ public function parseCharacter($bIsForIdentifier)
}

/**
* @return array<int, Comment>|void
* Consumes whitespace and comments and returns a list of comments.
*
* @return list<Comment> List of comments.
*
* @throws UnexpectedEOFException
* @throws UnexpectedTokenException
*/
public function comsumeWhitespace(): array
{
return $this->comsumeWhitespaceWithComments();
}

/**
* Consumes whitespace and comments and returns a list of comments.
*
* @return list<Comment> List of comments.
*
* @throws UnexpectedEOFException
* @throws UnexpectedTokenException
*/
public function consumeWhiteSpace()
public function comsumeWhitespaceWithComments()
{
$aComments = [];
do {
Expand Down

0 comments on commit a07190b

Please sign in to comment.