Skip to content

[CLEANUP] Tidy up DeclarationBlock::parse() #1294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 28, 2025

Conversation

JakeQZ
Copy link
Collaborator

@JakeQZ JakeQZ commented Jun 28, 2025

  • Assign the result of ParserState::peek() to a local variable, for efficiency;
  • Use a switch statement to branch on its value, for extensibility (e.g. [BUGFIX] Allow comma-separated arguments in selectors #1292);
  • Don't unnecessarily test that a quote character is not escaped when not within a string.

- Assign the result of `ParserState::peek()` to a local variable, for
  efficiency;
- Use a switch statement to branch on its value, for extensibility (e.g.
  #1292);
- Don't unnecessarily test that a quote character is not escaped when not
  within a string.
@coveralls
Copy link

coveralls commented Jun 28, 2025

Coverage Status

coverage: 57.935% (+0.03%) from 57.906%
when pulling 5826c8b on cleanup/declarationblock-parse
into 11e634c on main.

Copy link
Collaborator

@oliverklee oliverklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it, let's move the changed parts to nullable strings instead of set/not-set variables.

JakeQZ and others added 4 commits June 28, 2025 18:35
Co-authored-by: Oliver Klee <github@oliverklee.de>
Co-authored-by: Oliver Klee <github@oliverklee.de>
Co-authored-by: Oliver Klee <github@oliverklee.de>
Co-authored-by: Oliver Klee <github@oliverklee.de>
@JakeQZ
Copy link
Collaborator Author

JakeQZ commented Jun 28, 2025

While we're at it, let's move the changed parts to nullable strings instead of set/not-set variables.

I've accepted all suggestions :)

@JakeQZ JakeQZ requested a review from oliverklee June 28, 2025 17:37
@oliverklee
Copy link
Collaborator

The red builds look like some PHIVE install hiccup. I've kicked the pipeline.

Copy link
Collaborator

@oliverklee oliverklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might also fix a PHPStan warning - so we might need to regenerate the baseline.

@JakeQZ
Copy link
Collaborator Author

JakeQZ commented Jun 28, 2025

This might also fix a PHPStan warning - so we might need to regenerate the baseline.

It does, but also $stringWrapperCharacter needs to be initialized in order to use is_string instead of isset. Should be OK now.

@oliverklee oliverklee merged commit 8e45197 into main Jun 28, 2025
21 checks passed
@oliverklee oliverklee deleted the cleanup/declarationblock-parse branch June 28, 2025 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants