Skip to content

Commit

Permalink
Better naming classes with PDO - part 2. (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Apr 7, 2023
1 parent 0d676e7 commit 35e0155
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/Command.php
Expand Up @@ -6,8 +6,8 @@

use PDOException;
use Throwable;
use Yiisoft\Db\Driver\PDO\AbstractCommandPDO;
use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface;
use Yiisoft\Db\Driver\Pdo\AbstractPdoCommand;
use Yiisoft\Db\Driver\Pdo\PdoConnectionInterface;
use Yiisoft\Db\Exception\ConvertException;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidArgumentException;
Expand All @@ -23,7 +23,7 @@
* Implements a database command that can be executed with a PDO (PHP Data Object) database connection for SQLite
* Server.
*/
final class Command extends AbstractCommandPDO
final class Command extends AbstractPdoCommand
{
public function insertWithReturningPks(string $table, array $columns): bool|array
{
Expand Down Expand Up @@ -123,7 +123,7 @@ protected function internalExecute(string|null $rawSql): void
&& $this->db->getTransaction() === null
) {
$this->db->transaction(
fn (ConnectionPDOInterface $db) => $this->internalExecute($rawSql),
fn (PdoConnectionInterface $db) => $this->internalExecute($rawSql),
$this->isolationLevel,
);
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/Connection.php
Expand Up @@ -4,8 +4,8 @@

namespace Yiisoft\Db\Sqlite;

use Yiisoft\Db\Driver\PDO\AbstractConnectionPDO;
use Yiisoft\Db\Driver\PDO\CommandPDOInterface;
use Yiisoft\Db\Driver\Pdo\AbstractPdoConnection;
use Yiisoft\Db\Driver\Pdo\PdoCommandInterface;
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface;
use Yiisoft\Db\Schema\Quoter;
use Yiisoft\Db\Schema\QuoterInterface;
Expand All @@ -19,7 +19,7 @@
*
* @link https://www.php.net/manual/en/ref.pdo-sqlite.php
*/
final class Connection extends AbstractConnectionPDO
final class Connection extends AbstractPdoConnection
{
/**
* Reset the connection after cloning.
Expand All @@ -34,7 +34,7 @@ public function __clone()
}
}

public function createCommand(string $sql = null, array $params = []): CommandPDOInterface
public function createCommand(string $sql = null, array $params = []): PdoCommandInterface
{
$command = new Command($this);

Expand Down
4 changes: 2 additions & 2 deletions src/Driver.php
Expand Up @@ -5,14 +5,14 @@
namespace Yiisoft\Db\Sqlite;

use PDO;
use Yiisoft\Db\Driver\PDO\AbstractPDODriver;
use Yiisoft\Db\Driver\Pdo\AbstractPdoDriver;

/**
* Implements the SQLite Server driver based on the PDO (PHP Data Objects) extension.
*
* @link https://www.php.net/manual/en/ref.pdo-sqlite.php
*/
final class Driver extends AbstractPDODriver
final class Driver extends AbstractPdoDriver
{
public function createConnection(): PDO
{
Expand Down
4 changes: 2 additions & 2 deletions src/Schema.php
Expand Up @@ -9,7 +9,7 @@
use Yiisoft\Db\Constraint\Constraint;
use Yiisoft\Db\Constraint\ForeignKeyConstraint;
use Yiisoft\Db\Constraint\IndexConstraint;
use Yiisoft\Db\Driver\PDO\PdoAbstractSchema;
use Yiisoft\Db\Driver\Pdo\AbstractPdoSchema;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidArgumentException;
use Yiisoft\Db\Exception\InvalidConfigException;
Expand Down Expand Up @@ -73,7 +73,7 @@
* array{cid:string, name:string, type:string, notnull:string, dflt_value:string|null, pk:string}
* >
*/
final class Schema extends PdoAbstractSchema
final class Schema extends AbstractPdoSchema
{
/**
* @var array Mapping from physical column types (keys) to abstract column types (values).
Expand Down
4 changes: 2 additions & 2 deletions src/Transaction.php
Expand Up @@ -5,15 +5,15 @@
namespace Yiisoft\Db\Sqlite;

use Throwable;
use Yiisoft\Db\Driver\PDO\AbstractTransactionPDO;
use Yiisoft\Db\Driver\Pdo\AbstractPdoTransaction;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;

/**
* Implements the SQLite Server specific transaction.
*/
final class Transaction extends AbstractTransactionPDO
final class Transaction extends AbstractPdoTransaction
{
/**
* Sets the isolation level of the current transaction.
Expand Down
4 changes: 2 additions & 2 deletions tests/PdoCommandTest.php
Expand Up @@ -5,14 +5,14 @@
namespace Yiisoft\Db\Sqlite\Tests;

use Yiisoft\Db\Sqlite\Tests\Support\TestTrait;
use Yiisoft\Db\Tests\Common\CommonCommandPDOTest;
use Yiisoft\Db\Tests\Common\CommonPdoCommandTest;

/**
* @group sqlite
*
* @psalm-suppress PropertyNotSetInConstructor
*/
final class PdoCommandTest extends CommonCommandPDOTest
final class PdoCommandTest extends CommonPdoCommandTest
{
use TestTrait;
}
4 changes: 2 additions & 2 deletions tests/PdoConnectionTest.php
Expand Up @@ -10,15 +10,15 @@
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Sqlite\Tests\Support\TestTrait;
use Yiisoft\Db\Tests\Common\CommonConnectionPDOTest;
use Yiisoft\Db\Tests\Common\CommonPdoConnectionTest;
use Yiisoft\Db\Transaction\TransactionInterface;

/**
* @group pgsql
*
* @psalm-suppress PropertyNotSetInConstructor
*/
final class PdoConnectionTest extends CommonConnectionPDOTest
final class PdoConnectionTest extends CommonPdoConnectionTest
{
use TestTrait;

Expand Down
4 changes: 2 additions & 2 deletions tests/Support/TestTrait.php
Expand Up @@ -4,7 +4,7 @@

namespace Yiisoft\Db\Sqlite\Tests\Support;

use Yiisoft\Db\Driver\PDO\ConnectionPDOInterface;
use Yiisoft\Db\Driver\Pdo\PdoConnectionInterface;
use Yiisoft\Db\Exception\Exception;
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Sqlite\Connection;
Expand All @@ -20,7 +20,7 @@ trait TestTrait
* @throws Exception
* @throws InvalidConfigException
*/
protected function getConnection(bool $fixture = false): ConnectionPDOInterface
protected function getConnection(bool $fixture = false): PdoConnectionInterface
{
$db = new Connection(new Driver($this->getDsn()), DbHelper::getSchemaCache());

Expand Down

0 comments on commit 35e0155

Please sign in to comment.