-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Introduce Join class in QueryBuilder #3830
Conversation
Code-wise looks good! Do you want to try and remove the whitelisted PHPStan error, then squash everything? |
a894328
to
58c104a
Compare
Already tried it, still the same error.
Squashed! |
Not sure where it is. Should it be documented in upgrade notes then?
This is surprising. It may make sense to update the reported issue since unlike the earlier implementation, the proposed uses better-defined types. |
It's in |
Strangely, now it doesn't happen in the sandbox anymore: But it definitely does in our codebase. TBH, I'd better avoid wasting more time on this phpstan bug, and invest it in improving this codebase instead. Once all the changes will be merged, the error will be gone, as you can see in #3829 (d8eecdf). |
Thanks, @BenMorel! |
diff --git a/lib/Doctrine/DBAL/Query/QueryBuilder.php b/lib/Doctrine/DBAL/Query/QueryBuilder.php
index 00eba6b55..f20e466d9 100644
--- a/lib/Doctrine/DBAL/Query/QueryBuilder.php
+++ b/lib/Doctrine/DBAL/Query/QueryBuilder.php
@@ -1298,8 +1298,8 @@ class QueryBuilder
$sql = '';
if (isset($this->sqlParts['join'][$fromAlias])) {
+ /** @var Join $join */
foreach ($this->sqlParts['join'][$fromAlias] as $join) {
- /** @var Join $join */
if (array_key_exists($join->alias, $knownAliases)) {
throw NonUniqueAlias::new($join->alias, array_keys($knownAliases));
} Not a bug but documented behavior: phpstan/phpstan#466 (comment). |
Summary
This is a subset of #3829, that only replaces the associative array for the JOIN part with a proper class.
Note that this change alone doesn't solve the phpstan issue.