Skip to content

Commit a07190b

Browse files
committed
[FEATURE] Add comsumeWhitespaceWithComments and redirect comsumeWhitespace
Having comsumeWhitespace also consume comments and returning them was unexpected. Signed-off-by: Daniel Ziegenberg <[email protected]>
1 parent b48925e commit a07190b

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ This project adheres to [Semantic Versioning](https://semver.org/).
77

88
### Added
99

10+
- Add `ParserState::comsumeWhitespaceWithComments` method (#668)
11+
1012
### Changed
1113

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

1417
### Deprecated
1518

Diff for: src/Parsing/ParserState.php

+17-2
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,27 @@ public function parseCharacter($bIsForIdentifier)
226226
}
227227

228228
/**
229-
* @return array<int, Comment>|void
229+
* Consumes whitespace and comments and returns a list of comments.
230+
*
231+
* @return list<Comment> List of comments.
232+
*
233+
* @throws UnexpectedEOFException
234+
* @throws UnexpectedTokenException
235+
*/
236+
public function comsumeWhitespace(): array
237+
{
238+
return $this->comsumeWhitespaceWithComments();
239+
}
240+
241+
/**
242+
* Consumes whitespace and comments and returns a list of comments.
243+
*
244+
* @return list<Comment> List of comments.
230245
*
231246
* @throws UnexpectedEOFException
232247
* @throws UnexpectedTokenException
233248
*/
234-
public function consumeWhiteSpace()
249+
public function comsumeWhitespaceWithComments()
235250
{
236251
$aComments = [];
237252
do {

0 commit comments

Comments
 (0)