-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add native parameter types to Token constructor #526
Add native parameter types to Token constructor #526
Conversation
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
Ensures that token are always a string and that flags are always an integer. Signed-off-by: Maurício Meneghini Fauth <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #526 +/- ##
=========================================
Coverage 96.45% 96.45%
Complexity 2152 2152
=========================================
Files 64 64
Lines 5019 5019
=========================================
Hits 4841 4841
Misses 178 178 ☔ View full report in Codecov by Sentry. |
@kamil-tekiela What do you think? |
On line 256 in Lexer you still assign |
@@ -360,7 +360,7 @@ private function solveAmbiguityOnFunctionKeywords(): void | |||
&& ($next->type !== TokenType::Operator | |||
|| ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) | |||
) | |||
&& ($next->value !== null) | |||
&& ($next->value !== '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope that this ok, but I feel like the phpdoc should be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Token::$value type should definitely be updated. That value is only created by Lexer line 285.
Lines 284 to 285 in 94f2db2
// Adding a final delimiter to mark the ending. | |
$list->tokens[$list->count++] = new Token(null, TokenType::Delimiter); |
Lexer::$delimiter should only be string. But this is not an issue because it gets coerced to string right after. |
Ensures that
token
are always a string and thatflags
are always an integer.Using an empty string for the last delimiter has the same effect as using
null
.