Skip to content

Commit

Permalink
Merge branch '3.3.x' into 4.0.x
Browse files Browse the repository at this point in the history
* 3.3.x:
  Fix doc block
  Workaround for "mixed is a reserved word" error
  Remove exception coverter unit tests
  Fix return type of _getNestedTransactionSavePointName
  Fix coding standard violation in the IBM DB2 driver
  Use abstract middleware classes for PDO_sqlsrv
  • Loading branch information
derrabus committed Nov 30, 2021
2 parents 5651820 + 71b2e68 commit 1bdd79d
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 454 deletions.
7 changes: 7 additions & 0 deletions psalm.xml.dist
Expand Up @@ -190,6 +190,13 @@
<file name="tests/Functional/Driver/AbstractDriverTest.php"/>
</errorLevel>
</RedundantConditionGivenDocblockType>
<!-- Workaround for https://github.com/vimeo/psalm/issues/7026 -->
<ReservedWord>
<errorLevel type="suppress">
<directory name="src"/>
<directory name="tests"/>
</errorLevel>
</ReservedWord>
<TypeDoesNotContainNull>
<errorLevel type="suppress">
<!-- See https://github.com/psalm/psalm-plugin-phpunit/issues/107 -->
Expand Down
7 changes: 2 additions & 5 deletions src/Connection.php
Expand Up @@ -1059,12 +1059,9 @@ public function getNestTransactionsWithSavepoints(): bool
}

/**
* Returns the savepoint name to use for nested transactions are false if they are not supported
* "savepointFormat" parameter is not set
*
* @return mixed A string with the savepoint name or false.
* Returns the savepoint name to use for nested transactions.
*/
protected function _getNestedTransactionSavePointName()
protected function _getNestedTransactionSavePointName(): string
{
return 'DOCTRINE2_SAVEPOINT_' . $this->transactionNestingLevel;
}
Expand Down
3 changes: 3 additions & 0 deletions src/Driver/IBMDB2/Driver.php
Expand Up @@ -7,6 +7,9 @@
use Doctrine\DBAL\Driver\AbstractDB2Driver;
use Doctrine\DBAL\Driver\IBMDB2\Exception\ConnectionFailed;

use function db2_connect;
use function db2_pconnect;

final class Driver extends AbstractDB2Driver
{
/**
Expand Down
51 changes: 5 additions & 46 deletions src/Driver/PDO/SQLSrv/Connection.php
Expand Up @@ -4,17 +4,19 @@

namespace Doctrine\DBAL\Driver\PDO\SQLSrv;

use Doctrine\DBAL\Driver\Connection as ConnectionInterface;
use Doctrine\DBAL\Driver\Middleware\AbstractConnectionMiddleware;
use Doctrine\DBAL\Driver\PDO\Connection as PDOConnection;
use Doctrine\DBAL\Driver\PDO\Result;
use Doctrine\DBAL\Driver\Statement as StatementInterface;
use PDO;

final class Connection implements ConnectionInterface
final class Connection extends AbstractConnectionMiddleware
{
private PDOConnection $connection;

public function __construct(PDOConnection $connection)
{
parent::__construct($connection);

$this->connection = $connection;
}

Expand All @@ -25,49 +27,6 @@ public function prepare(string $sql): Statement
);
}

public function query(string $sql): Result
{
return $this->connection->query($sql);
}

public function quote(string $value): string
{
return $this->connection->quote($value);
}

public function exec(string $sql): int
{
return $this->connection->exec($sql);
}

/**
* {@inheritDoc}
*/
public function lastInsertId()
{
return $this->connection->lastInsertId();
}

public function beginTransaction(): void
{
$this->connection->beginTransaction();
}

public function commit(): void
{
$this->connection->commit();
}

public function rollBack(): void
{
$this->connection->rollBack();
}

public function getServerVersion(): string
{
return $this->connection->getServerVersion();
}

public function getNativeConnection(): PDO
{
return $this->connection->getNativeConnection();
Expand Down
12 changes: 4 additions & 8 deletions src/Driver/PDO/SQLSrv/Statement.php
Expand Up @@ -4,13 +4,12 @@

namespace Doctrine\DBAL\Driver\PDO\SQLSrv;

use Doctrine\DBAL\Driver\Middleware\AbstractStatementMiddleware;
use Doctrine\DBAL\Driver\PDO\Statement as PDOStatement;
use Doctrine\DBAL\Driver\Result;
use Doctrine\DBAL\Driver\Statement as StatementInterface;
use Doctrine\DBAL\ParameterType;
use PDO;

final class Statement implements StatementInterface
final class Statement extends AbstractStatementMiddleware
{
private PDOStatement $statement;

Expand All @@ -19,6 +18,8 @@ final class Statement implements StatementInterface
*/
public function __construct(PDOStatement $statement)
{
parent::__construct($statement);

$this->statement = $statement;
}

Expand Down Expand Up @@ -61,9 +62,4 @@ public function bindValue($param, $value, int $type = ParameterType::STRING): vo
{
$this->bindParam($param, $value, $type);
}

public function execute(?array $params = null): Result
{
return $this->statement->execute($params);
}
}
6 changes: 3 additions & 3 deletions src/Driver/SQLSrv/Statement.php
Expand Up @@ -46,14 +46,14 @@ final class Statement implements StatementInterface
/**
* References to the variables bound as statement parameters.
*
* @var mixed
* @var array<int, mixed>
*/
private $variables = [];
private array $variables = [];

/**
* Bound parameter types.
*
* @var int[]
* @var array<int, int>
*/
private array $types = [];

Expand Down
78 changes: 0 additions & 78 deletions tests/Driver/API/ExceptionConverterTest.php

This file was deleted.

109 changes: 0 additions & 109 deletions tests/Driver/API/MySQL/ExceptionConverterTest.php

This file was deleted.

0 comments on commit 1bdd79d

Please sign in to comment.