Skip to content

Commit 0fa736a

Browse files
committed
[FEATURE] Add comsumeWhitespaceWithComments and redirect comsumeWhitespace (#670)
Having comsumeWhitespace also consume comments and returning them was unexpected. Signed-off-by: Daniel Ziegenberg <[email protected]>
1 parent d2fb94a commit 0fa736a

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ This project adheres to [Semantic Versioning](https://semver.org/).
77

88
### Added
99

10+
- Add `ParserState::consumeWhiteSpaceWithComments()` method (#670)
11+
1012
### Changed
1113

14+
- Redirect `ParserState::consumeWhiteSpace()` to `ParserState::consumeWhiteSpaceWithComments()` (#670)
15+
1216
### Deprecated
1317

1418
### Removed

src/Parsing/ParserState.php

Lines changed: 16 additions & 1 deletion
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.
230232
*
231233
* @throws UnexpectedEOFException
232234
* @throws UnexpectedTokenException
233235
*/
234236
public function consumeWhiteSpace()
237+
{
238+
return $this->consumeWhiteSpaceWithComments();
239+
}
240+
241+
/**
242+
* Consumes whitespace and comments and returns a list of comments.
243+
*
244+
* @return list<Comment> List of comments.
245+
*
246+
* @throws UnexpectedEOFException
247+
* @throws UnexpectedTokenException
248+
*/
249+
public function consumeWhiteSpaceWithComments()
235250
{
236251
$aComments = [];
237252
do {

0 commit comments

Comments
 (0)