Skip to content

Commit

Permalink
Fixed type hint error, when don't set true for `PDO::ATTR_PERSISTEN…
Browse files Browse the repository at this point in the history
…T`. (#3137)

* Revert #3045

* Fixed type hint error, when don't set `true` for `PDO::ATTR_PERSISTENT`.
  • Loading branch information
limingxinleo committed Jan 15, 2021
1 parent bc5e02e commit 8cbc5f2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
5 changes: 0 additions & 5 deletions src/Connectors/Connector.php
Expand Up @@ -11,7 +11,6 @@
*/
namespace Hyperf\Database\Connectors;

use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection;
use Exception;
use Hyperf\Database\DetectsLostConnections;
use PDO;
Expand Down Expand Up @@ -104,10 +103,6 @@ public function setDefaultOptions(array $options)
*/
protected function createPdoConnection($dsn, $username, $password, $options)
{
if (class_exists(PDOConnection::class) && ! $this->isPersistentConnection($options)) {
return new PDOConnection($dsn, $username, $password, $options);
}

return new PDO($dsn, $username, $password, $options);
}

Expand Down
3 changes: 1 addition & 2 deletions src/Connectors/MySqlConnector.php
Expand Up @@ -137,9 +137,8 @@ protected function getHostDsn(array $config)

/**
* Set the modes for the connection.
* @param PDO $connection
*/
protected function setModes($connection, array $config)
protected function setModes(PDO $connection, array $config)
{
if (isset($config['modes'])) {
$this->setCustomModes($connection, $config);
Expand Down

0 comments on commit 8cbc5f2

Please sign in to comment.