Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 59 additions & 43 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ parameters:
count: 1
path: src/Metadata/Source.php

-
message: '#^Parameter \#2 \$array of function implode expects array\<string\>, array\<int, array\<string, string\>\|string\> given\.$#'
identifier: argument.type
count: 1
path: src/Metadata/Source.php

-
message: '#^Parameter \#2 \$array of function implode expects array\<string\>, array\<int, list\<string\>\> given\.$#'
identifier: argument.type
Expand Down
33 changes: 0 additions & 33 deletions src/DatabasePlatformNameTrait.php

This file was deleted.

19 changes: 12 additions & 7 deletions src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Override;
use PgSql\Result as PgSqlResult;
use PhpDb\Adapter\Driver\ConnectionInterface;
use PhpDb\Adapter\Driver\DriverAwareInterface;
use PhpDb\Adapter\Driver\DriverInterface;
use PhpDb\Adapter\Driver\ResultInterface;
use PhpDb\Adapter\Driver\StatementInterface;
Expand All @@ -24,8 +25,6 @@
*/
class Driver implements DriverInterface, ProfilerAwareInterface
{
use DatabasePlatformNameTrait;

protected ?ProfilerInterface $profiler = null;

/** @var array */
Expand All @@ -34,9 +33,9 @@ class Driver implements DriverInterface, ProfilerAwareInterface
];

public function __construct(
protected readonly ConnectionInterface&Connection $connection,
protected readonly StatementInterface&Statement $statementPrototype,
protected readonly ResultInterface&Result $resultPrototype,
protected readonly DriverAwareInterface&ConnectionInterface&Connection $connection,
protected readonly DriverAwareInterface&StatementInterface&Statement $statementPrototype = new Statement(),
protected readonly ResultInterface&Result $resultPrototype = new Result(),
array $options = []
) {
$this->checkEnvironment();
Expand All @@ -55,9 +54,15 @@ public function setProfiler(
): DriverInterface&ProfilerAwareInterface {
$this->profiler = $profiler;

$this->connection->setProfiler($profiler);
// @phpstan-ignore instanceof.alwaysTrue
if ($this->connection instanceof ProfilerAwareInterface) {
$this->connection->setProfiler($profiler);
}

$this->statementPrototype->setProfiler($profiler);
// @phpstan-ignore instanceof.alwaysTrue
if ($this->statementPrototype instanceof ProfilerAwareInterface) {
$this->statementPrototype->setProfiler($profiler);
}

return $this;
}
Expand Down
Loading