We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
<?php namespace DAMA\DoctrineTestBundle\Doctrine\DBAL; class StaticDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver /** * {@inheritdoc} */ public function getDatabase(\Doctrine\DBAL\Connection $conn): string { return $this->underlyingDriver->getDatabase($conn); }
If you use an in-memory database <env name="DATABASE_URL" value="sqlite:///:memory:"/>
<env name="DATABASE_URL" value="sqlite:///:memory:"/>
then this leads to a type error:
TypeError : Return value of DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver::getDatabase() must be of the type string, null returned
A in memory sqlite goes in here and returns NULL and not string(has no path)
/** * {@inheritdoc} */ public function getDatabase(Connection $conn) { $params = $conn->getParams(); return $params['path'] ?? null; }
Just changing
public function getDatabase(\Doctrine\DBAL\Connection $conn): ?string
fixes the issue.
The text was updated successfully, but these errors were encountered:
See #115
Indeed the AbstractSQLiteDriver may return null although the phpdoc annotates the method with return type string on the Driver interface 😕
AbstractSQLiteDriver
null
string
Driver
https://github.com/doctrine/dbal/blob/2.11.x/lib/Doctrine/DBAL/Driver.php#L56
Sorry, something went wrong.
new release 6.3.2 tagged 😉
Thank you!
Successfully merging a pull request may close this issue.
If you use an in-memory database
<env name="DATABASE_URL" value="sqlite:///:memory:"/>
then this leads to a type error:
TypeError : Return value of DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver::getDatabase() must be of the type string, null returned
A in memory sqlite goes in here and returns NULL and not string(has no path)
Just changing
fixes the issue.
The text was updated successfully, but these errors were encountered: