Skip to content

Allow parsing class constants with more than one wildcard in the constant name #81

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 1 commit into from
Sep 12, 2021

Conversation

Seldaek
Copy link
Contributor

@Seldaek Seldaek commented Sep 5, 2021

@@ -61,10 +61,18 @@ public function parse(TokenIterator $tokens, bool $trimStrings = false): Ast\Con
$tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER);
if ($tokens->tryConsumeTokenType(Lexer::TOKEN_WILDCARD)) {
$classConstantName .= '*';
if ($tokens->currentTokenType() === Lexer::TOKEN_IDENTIFIER) {
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this needs a while loop - so that we can have multiple wildcards in the name :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK sure, might as well do a complete solution while I'm at it I guess.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, thank you :)

@Seldaek Seldaek force-pushed the allow_wildcard_in_middle branch from cea6e5c to a8044ee Compare September 12, 2021 08:57
@Seldaek Seldaek changed the title Allow parsing class::*_CONST and class::FOO_*_CONST with wildcard in beginning/middle of the constant name Allow parsing class constants with more than one wildcard in the constant name Sep 12, 2021
@ondrejmirtes ondrejmirtes merged commit 816e826 into phpstan:master Sep 12, 2021
@ondrejmirtes
Copy link
Member

Thank you!

@Seldaek Seldaek deleted the allow_wildcard_in_middle branch October 13, 2021 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants