-
-
Notifications
You must be signed in to change notification settings - Fork 40
Fix #730: Add ExpressionBuilderInterface::build() #946
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
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #946 +/- ##
============================================
- Coverage 99.23% 98.80% -0.44%
- Complexity 1534 1548 +14
============================================
Files 98 98
Lines 3815 3843 +28
============================================
+ Hits 3786 3797 +11
- Misses 29 46 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* @param array $params The binding parameters. | ||
* | ||
* @return string The raw SQL that won't be additionally escaped or quoted. | ||
*/ | ||
public function build(ExpressionInterface $expression, array &$params = []): string | ||
{ | ||
if (!$expression instanceof ArrayExpression) { | ||
throw new InvalidArgumentException(static::class . ' could only be used with ArrayExpression.'); |
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 we throw InvalidArgumentException
or InvalidConfigException
here?
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.
The type check seems redundant, the value is then passed to a strongly typed method buildValue()
where the right type specified.
@@ -68,13 +69,17 @@ public function __construct(protected readonly QueryBuilderInterface $queryBuild | |||
/** | |||
* The Method builds the raw SQL from the `$expression` that won't be additionally escaped or quoted. | |||
* | |||
* @param ArrayExpression $expression The expression to build. | |||
* @param ExpressionInterface $expression The expression to build. |
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.
We can leave ArrayExpression
here since it is the only valid type for the class method.
* @param array $params The binding parameters. | ||
* | ||
* @return string The raw SQL that won't be additionally escaped or quoted. | ||
*/ | ||
public function build(ExpressionInterface $expression, array &$params = []): string | ||
{ | ||
if (!$expression instanceof ArrayExpression) { | ||
throw new InvalidArgumentException(static::class . ' could only be used with ArrayExpression.'); |
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.
The type check seems redundant, the value is then passed to a strongly typed method buildValue()
where the right type specified.
TODO: