Skip to content

Conversation

@Seldaek
Copy link
Contributor

@Seldaek Seldaek commented Sep 5, 2021

$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

2 participants