-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Migrate Parser to PHP 8 #10506
Migrate Parser to PHP 8 #10506
Conversation
*/ | ||
public function SimpleConditionalExpression() | ||
*/ | ||
public function SimpleConditionalExpression(): AST\ExistsExpression|AST\BetweenExpression|AST\LikeExpression|AST\InListExpression|AST\InSubselectExpression|AST\InstanceOfExpression|AST\CollectionMemberExpression|AST\NullComparisonExpression|AST\EmptyCollectionComparisonExpression|AST\ComparisonExpression |
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.
Should I simplify this one to AST\Node
?
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.
Depends on how we answer my question regarding final
. 🙂
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.
Shall we final
ize the Parser
class? With all those native union types, it'll otherwise hard to change that method in the future.
lib/Doctrine/ORM/Query/Parser.php
Outdated
match (true) { | ||
$AST instanceof AST\UpdateStatement => $treeWalkerChain->walkUpdateStatement($AST), | ||
$AST instanceof AST\DeleteStatement => $treeWalkerChain->walkDeleteStatement($AST), | ||
default => $treeWalkerChain->walkSelectStatement($AST), |
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.
Let's be explicit about the remaining case that we expect here. Static analysis should recognize that the match
statement covers all cases without a default
and will notify us if that will ever change in the future. 💪🏻
default => $treeWalkerChain->walkSelectStatement($AST), | |
$AST instanceof AST\SelectStatement => $treeWalkerChain->walkSelectStatement($AST), |
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.
Looks nicer indeed 👍
Let's try |
4dd88d6
to
ce03a61
Compare
In some cases, I had to widen the documented type, running the test suite showed me it was wrong.