Skip to content
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

Fix types on walkLiteral() and walkLikeExpression() #9566

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

derrabus
Copy link
Member

@derrabus derrabus commented Mar 6, 2022

No description provided.

public $stringExpression;

/** @var InputParameter */
/** @var InputParameter|FunctionNode|PathExpression|Literal */
Copy link
Member Author

@derrabus derrabus Mar 6, 2022

Choose a reason for hiding this comment

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

Those are the types we expect here, see:

if ($likeExpr->stringPattern instanceof AST\InputParameter) {
$sql .= $this->walkInputParameter($likeExpr->stringPattern);
} elseif ($likeExpr->stringPattern instanceof AST\Functions\FunctionNode) {
$sql .= $this->walkFunction($likeExpr->stringPattern);
} elseif ($likeExpr->stringPattern instanceof AST\PathExpression) {
$sql .= $this->walkPathExpression($likeExpr->stringPattern);
} else {
$sql .= $this->walkLiteral($likeExpr->stringPattern);
}

@@ -335,7 +335,7 @@ public function walkInstanceOfExpression($instanceOfExpr);
/**
* Walks down a literal that represents an AST node, thereby generating the appropriate SQL.
*
* @param mixed $literal
* @param AST\Literal $literal
Copy link
Member Author

@derrabus derrabus Mar 6, 2022

Choose a reason for hiding this comment

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

Passing anything else to the implementation in SqlWalker would cause an error because we access properties on $literal.

@derrabus derrabus added this to the 2.12.0 milestone Mar 10, 2022
@derrabus derrabus force-pushed the types/walk-literal branch from 7b3e58d to c4180ca Compare March 20, 2022 11:48
@derrabus derrabus force-pushed the types/walk-literal branch from c4180ca to 04b7f74 Compare March 28, 2022 16:16
Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

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

A second reviewer should be consulted. Despite that no one mentioned an error before and "smaller" BC breaks were applied in the past in 2.11, this PR can probably be merged after a second review.

@derrabus derrabus requested a review from greg0ire April 4, 2022 23:26
@derrabus derrabus merged commit e8472c8 into doctrine:2.12.x Apr 6, 2022
@derrabus derrabus deleted the types/walk-literal branch April 6, 2022 08:49
derrabus added a commit to derrabus/orm that referenced this pull request Apr 6, 2022
* 2.12.x:
  Deprecate custom ObjectRepository implementations (doctrine#9533)
  Fix types on walkLiteral() and walkLikeExpression() (doctrine#9566)
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