-
-
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
Connection::executeQuery return type #3214
Comments
@pauliusrum is there a practical impact introduced by this change? |
When you upgrade to 2.8 and you use |
@pauliusrum given that
The former can be transparently used instead of the latter according to the LSP. What kind of failures are you seeing? |
It's the other way around. In 2.8 |
Hi, You can verify this by the following patch and running the test suite: diff --git a/lib/Doctrine/DBAL/Connection.php b/lib/Doctrine/DBAL/Connection.php
index c1cb8acf5..6a9457f55 100644
--- a/lib/Doctrine/DBAL/Connection.php
+++ b/lib/Doctrine/DBAL/Connection.php
@@ -915,7 +915,8 @@ class Connection implements DriverConnection
public function executeQuery($query, array $params = [], $types = [], QueryCacheProfile $qcp = null)
{
if ($qcp !== null) {
- return $this->executeCacheQuery($query, $params, $types, $qcp);
+ $stmt = $this->executeCacheQuery($query, $params, $types, $qcp);
+ goto end;
}
$this->connect();
@@ -948,7 +949,9 @@ class Connection implements DriverConnection
if ($logger) {
$logger->stopQuery();
}
+end:
+ assert($stmt instanceof DriverStatement);
return $stmt;
} Will cause assertion error:
Note that now we have a type issue here: dbal/lib/Doctrine/DBAL/Connection.php Line 987 in 5140a64
As ResultCacheStatement expects Driver\Statement instead of Driver\ResultStatement , but that can't happen as Connection::executeQuery() is invoked without cache profile.
Closing as invalid. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
BC Break Report
Previous behavior
In 2.7
Doctrine\DBAL\Connection::executeQuery
return type wasDoctrine\DBAL\Driver\Statement
. https://github.com/doctrine/dbal/blob/2.7/lib/Doctrine/DBAL/Connection.php#L906Current behavior
In 2.8
Doctrine\DBAL\Connection::executeQuery
return type isDoctrine\DBAL\Driver\ResultStatement
https://github.com/doctrine/dbal/blob/2.8/lib/Doctrine/DBAL/Connection.php#L911
The text was updated successfully, but these errors were encountered: