Skip to content

Commit 5ec52d6

Browse files
committed
Update code to match the project style guide
This change is a result of running phpcbf over the code, and performing some manual changes to ensure that the code passes the phpcs configuration.
1 parent e862969 commit 5ec52d6

25 files changed

Lines changed: 57 additions & 70 deletions

src/ConfigProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
use Laminas\ServiceManager\Factory\InvokableFactory;
88
use PhpDb\Adapter\AdapterInterface;
99
use PhpDb\Adapter\Driver\ConnectionInterface;
10-
use PhpDb\Adapter\Driver\PdoConnectionInterface;
1110
use PhpDb\Adapter\Driver\DriverInterface;
11+
use PhpDb\Adapter\Driver\Pdo\Result;
12+
use PhpDb\Adapter\Driver\Pdo\Statement;
13+
use PhpDb\Adapter\Driver\PdoConnectionInterface;
1214
use PhpDb\Adapter\Driver\PdoDriverInterface;
1315
use PhpDb\Adapter\Driver\ResultInterface;
1416
use PhpDb\Adapter\Driver\StatementInterface;
15-
use PhpDb\Adapter\Driver\Pdo\Result;
16-
use PhpDb\Adapter\Driver\Pdo\Statement;
1717
use PhpDb\Adapter\Platform\PlatformInterface;
1818
use PhpDb\Adapter\Profiler\Profiler;
1919
use PhpDb\Adapter\Profiler\ProfilerInterface;
@@ -34,10 +34,10 @@ public function __invoke(): array
3434
public function getDependencies(): array
3535
{
3636
return [
37-
'aliases' => [
37+
'aliases' => [
3838
MetadataInterface::class => Metadata\Source\SqliteMetadata::class,
3939
],
40-
'factories' => [
40+
'factories' => [
4141
Metadata\Source\SqliteMetadata::class => Container\MetadataInterfaceFactory::class,
4242
],
4343
'delegators' => [

src/Container/AdapterFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,3 @@ public function __invoke(ContainerInterface $container): AdapterInterface
8181
);
8282
}
8383
}
84-

src/Container/MetadataInterfaceFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
namespace PhpDb\Adapter\Sqlite\Container;
66

77
use PhpDb\Adapter\AdapterInterface;
8-
use PhpDb\Adapter\Sqlite\Metadata\Source\SqliteMetadata;
98
use PhpDb\Adapter\SchemaAwareInterface;
9+
use PhpDb\Adapter\Sqlite\Metadata\Source\SqliteMetadata;
1010
use PhpDb\Metadata\MetadataInterface;
1111
use Psr\Container\ContainerInterface;
1212

src/Container/PdoDriverFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use PhpDb\Adapter\Driver\PdoDriverInterface;
1111
use PhpDb\Adapter\Driver\ResultInterface;
1212
use PhpDb\Adapter\Driver\StatementInterface;
13-
use PhpDb\Adapter\Sqlite\Driver\Pdo\Feature\SqliteRowCounter;
1413
use PhpDb\Adapter\Sqlite\Driver\Pdo\Connection;
14+
use PhpDb\Adapter\Sqlite\Driver\Pdo\Feature\SqliteRowCounter;
1515
use PhpDb\Adapter\Sqlite\Driver\Pdo\Pdo as PdoDriver;
1616
use PhpDb\Container\AdapterManager;
1717
use Psr\Container\ContainerInterface;

src/Container/PdoStatementFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use PhpDb\Adapter\Driver\Pdo\Statement;
88
use PhpDb\Adapter\Driver\StatementInterface;
9-
use PhpDb\Adapter\ParameterContainer;
109
use Psr\Container\ContainerInterface;
1110

1211
final class PdoStatementFactory

src/Container/PlatformInterfaceFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
use PDO;
88
use PhpDb\Adapter\Driver\PdoDriverInterface;
9-
use PhpDb\Adapter\Sqlite\Platform\Sqlite;
109
use PhpDb\Adapter\Platform\PlatformInterface;
10+
use PhpDb\Adapter\Sqlite\Platform\Sqlite;
1111
use PhpDb\Container\AdapterManager;
1212
use Psr\Container\ContainerInterface;
1313

src/Driver/Pdo/Connection.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PhpDb\Adapter\Sqlite\Driver\Pdo;
66

77
use Override;
8+
use PDO;
89
use PDOException;
910
use PhpDb\Adapter\Driver\ConnectionInterface;
1011
use PhpDb\Adapter\Driver\Pdo\AbstractPdoConnection;
@@ -94,9 +95,9 @@ public function connect(): ConnectionInterface
9495
$this->dsn = $dsn;
9596

9697
try {
97-
$this->resource = new \PDO(dsn: $dsn, options: $options);
98-
$this->resource->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
99-
$this->driverName = strtolower($this->resource->getAttribute(\PDO::ATTR_DRIVER_NAME));
98+
$this->resource = new PDO(dsn: $dsn, options: $options);
99+
$this->resource->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
100+
$this->driverName = strtolower($this->resource->getAttribute(PDO::ATTR_DRIVER_NAME));
100101
} catch (PDOException $e) {
101102
$code = $e->getCode();
102103
if (! is_int($code)) {

src/Metadata/Source/SqliteMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ protected function loadConstraintData(string $table, string $schema): void
171171
$id = $name = null;
172172
foreach ($foreignKeys as $fk) {
173173
if ($id !== $fk['id']) {
174-
$id = $fk['id'];
174+
$id = $fk['id'];
175175
// todo: decide on whether to continue to use _laminas_
176176
$name = '_laminas_' . $table . '_FOREIGN_KEY_' . ($id + 1);
177177
$constraints[$name] = [

src/Platform/Sqlite.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@
55
namespace PhpDb\Adapter\Sqlite\Platform;
66

77
use Override;
8+
use PDO;
89
use PhpDb\Adapter\Driver\PdoDriverInterface;
9-
use PhpDb\Adapter\Exception;
1010
use PhpDb\Adapter\Platform\AbstractPlatform;
11-
use PhpDb\Sql\Platform\PlatformDecoratorInterface;
12-
use PhpDb\Adapter\Sqlite\Driver\Pdo;
1311
use PhpDb\Adapter\Sqlite\Sql\Platform\Sqlite as SqlPlatformDecorator;
12+
use PhpDb\Sql\Platform\PlatformDecoratorInterface;
1413

1514
class Sqlite extends AbstractPlatform
1615
{
1716
public final const PLATFORM_NAME = 'SQLite';
1817
/** @var string[] */
1918
protected $quoteIdentifier = ['"', '"'];
2019

21-
/** @var \PDO */
20+
/** @var PDO */
2221
protected $resource;
2322

2423
/**
@@ -27,7 +26,7 @@ class Sqlite extends AbstractPlatform
2726
protected $quoteIdentifierTo = '\'';
2827

2928
public function __construct(
30-
protected readonly PdoDriverInterface|\PDO $driver
29+
protected readonly PdoDriverInterface|PDO $driver
3130
) {
3231
}
3332

@@ -43,7 +42,7 @@ public function quoteValue(string $value): string
4342
$resource = $resource->getConnection()->getResource();
4443
}
4544

46-
if ($resource instanceof \PDO) {
45+
if ($resource instanceof PDO) {
4746
return $resource->quote($value);
4847
}
4948

@@ -62,7 +61,7 @@ public function quoteTrustedValue(int|float|string|bool $value): ?string
6261
$resource = $resource->getConnection()->getResource();
6362
}
6463

65-
if ($resource instanceof \PDO) {
64+
if ($resource instanceof PDO) {
6665
return $resource->quote($value);
6766
}
6867

src/Sql/Platform/Ddl/AlterTableDecorator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use PhpDb\Adapter\Platform\PlatformInterface;
66
use PhpDb\Sql\Ddl\AlterTable;
7+
use PhpDb\Sql\Ddl\Column\ColumnInterface;
78
use PhpDb\Sql\Platform\PlatformDecoratorInterface;
89

910
use function count;
@@ -147,7 +148,7 @@ protected function processChangeColumns(?PlatformInterface $adapterPlatform = nu
147148
{
148149
$sqls = [];
149150

150-
/** @var \PhpDb\Sql\Ddl\Column\ColumnInterface $column */
151+
/** @var ColumnInterface $column */
151152
foreach ($this->changeColumns as $name => $column) {
152153
$sql = $this->processExpression($column, $adapterPlatform);
153154
$insertStart = $this->getSqlInsertOffsets($sql);
@@ -217,6 +218,7 @@ private function normalizeColumnOption(string $name): string
217218

218219
/**
219220
* phpcs:ignore SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod
221+
*
220222
* @psalm-suppress UnusedReturnValue
221223
*/
222224
private function compareColumnOptions(string $columnA, string $columnB): int

0 commit comments

Comments
 (0)