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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"php-db/phpdb": "^0.2.0",
"php-db/phpdb": "^0.3.0",
"webmozart/assert": "^1.11"
},
"require-dev": {
Expand Down
15 changes: 8 additions & 7 deletions composer.lock

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

6 changes: 1 addition & 5 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@

<!-- Include all rules from Laminas Coding Standard -->
<rule ref="LaminasCodingStandard">
<!--
declare(strict_types=1) is too risky for a security-only component,
and should only be reconsidered once this package receives new feature work.
-->
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing"/>

</rule>
</ruleset>
103 changes: 103 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
parameters:
ignoreErrors:
-
message: '#^Variable \$aliasTo on left side of \?\?\= is never defined\.$#'
identifier: nullCoalesce.variable
count: 1
path: src/Container/DriverInterfaceFactoryFactory.php

-
message: '#^Cannot call static method createFromConfig\(\) on callable\.$#'
identifier: staticMethod.nonObject
count: 1
path: src/Container/PdoDriverFactory.php

-
message: '#^Parameter \#1 \$name \(string\) of method PhpDb\\Adapter\\Sqlite\\Driver\\Pdo\\Connection\:\:getLastGeneratedValue\(\) should be compatible with parameter \$name \(null\) of method PhpDb\\Adapter\\Driver\\ConnectionInterface\:\:getLastGeneratedValue\(\)$#'
identifier: method.childParameterType
count: 2
path: src/Driver/Pdo/Connection.php

-
message: '#^Parameter \#2 \$parameters of class PhpDb\\Adapter\\Exception\\InvalidConnectionParametersException constructor expects int, array given\.$#'
identifier: argument.type
count: 1
path: src/Driver/Pdo/Connection.php

-
message: '#^Parameter \#1 \$resource \(PDOStatement\) of method PhpDb\\Adapter\\Sqlite\\Driver\\Pdo\\Pdo\:\:createResult\(\) should be compatible with parameter \$resource \(resource\) of method PhpDb\\Adapter\\Driver\\DriverInterface\:\:createResult\(\)$#'
identifier: method.childParameterType
count: 3
path: src/Driver/Pdo/Pdo.php

-
message: '#^Parameter \#3 \$rowCount of method PhpDb\\Adapter\\Driver\\Pdo\\Result\:\:initialize\(\) expects int\|null, Closure\|null given\.$#'
identifier: argument.type
count: 1
path: src/Driver/Pdo/Pdo.php

-
message: '#^Variable \$schemas might not be defined\.$#'
identifier: variable.undefined
count: 1
path: src/Metadata/Source/SqliteMetadata.php

-
message: '#^Method PhpDb\\Adapter\\Sqlite\\Sql\\Platform\\Ddl\\AlterTableDecorator\:\:processAddColumns\(\) should return array\<string\> but returns array\<int, array\<string\>\>\.$#'
identifier: return.type
count: 1
path: src/Sql/Platform/Ddl/AlterTableDecorator.php

-
message: '#^Method PhpDb\\Adapter\\Sqlite\\Sql\\Platform\\Ddl\\AlterTableDecorator\:\:processChangeColumns\(\) should return array\<string\> but returns array\<int, list\<array\<int, string\>\>\>\.$#'
identifier: return.type
count: 1
path: src/Sql/Platform/Ddl/AlterTableDecorator.php

-
message: '#^Offset ''paramPrefix'' does not exist on string\.$#'
identifier: offsetAccess.notFound
count: 2
path: src/Sql/Platform/SelectDecorator.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertIsArray\(\) with array will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 3
path: test/unit/ConfigProviderTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertIsCallable\(\) with callable\(\)\: mixed will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: test/unit/Container/ConnectionInterfaceFactoryFactoryTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertIsCallable\(\) with callable\(\)\: mixed will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: test/unit/Container/DriverInterfaceFactoryFactoryTest.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertIsCallable\(\) with callable\(\)\: mixed will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
count: 1
path: test/unit/Container/PlatformInterfaceFactoryFactoryTest.php

-
message: '#^PHPDoc tag @var with type PhpDb\\Adapter\\Driver\\PdoDriverAwareInterface&PhpDb\\Adapter\\Driver\\StatementInterface is not subtype of native type PHPUnit\\Framework\\MockObject\\MockObject\.$#'
identifier: varTag.nativeType
count: 1
path: test/unit/Driver/Pdo/PdoTest.php

-
message: '#^Parameter \#1 \$callback of function set_error_handler expects \(callable\(int, string, string, int\)\: bool\)\|null, Closure\(int, string\)\: void given\.$#'
identifier: argument.type
count: 1
path: test/unit/Platform/SqliteTest.php

-
message: '#^Parameter \#1 \$callback of function set_error_handler expects \(callable\(int, string, string, int\)\: bool\)\|null, Closure\(mixed, mixed\)\: void given\.$#'
identifier: argument.type
count: 1
path: test/unit/Platform/SqliteTest.php
2 changes: 1 addition & 1 deletion src/Driver/Pdo/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Connection extends AbstractPdoConnection
* {@inheritDoc}
*/
#[Override]
public function getCurrentSchema(): string|bool
public function getCurrentSchema(): string|false
{
if (! $this->isConnected()) {
$this->connect();
Expand Down
2 changes: 2 additions & 0 deletions src/Sql/Platform/Ddl/AlterTableDecorator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PhpDb\Adapter\Sqlite\Sql\Platform\Ddl;

use PhpDb\Adapter\Platform\PlatformInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Sql/Platform/Ddl/CreateTableDecorator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PhpDb\Adapter\Sqlite\Sql\Platform\Ddl;

use PhpDb\Adapter\Platform\PlatformInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Sql/Platform/SelectDecorator.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PhpDb\Adapter\Sqlite\Sql\Platform;

use PhpDb\Adapter\Driver\DriverInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Sql/Platform/Sqlite.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PhpDb\Adapter\Sqlite\Sql\Platform;

use PhpDb\Sql\Ddl\AlterTable;
Expand Down
2 changes: 1 addition & 1 deletion test/integration/Container/TestAsset/SetupTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
use PhpDb\Adapter\Driver\DriverInterface;
use PhpDb\Adapter\Sqlite\ConfigProvider;
use PhpDb\Adapter\Sqlite\Driver\Pdo\Pdo;
use PhpDb\ConfigProvider as LaminasDbConfigProvider;
use PhpDb\Container\AdapterManager;
use PhpDb\Container\ConfigProvider as LaminasDbConfigProvider;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Psr\Container\ContainerInterface;

Expand Down
2 changes: 2 additions & 0 deletions test/integration/Driver/Pdo/AbstractAdapterTestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace PhpDbIntegrationTest\Adapter\Sqlite\Driver\Pdo;

use PhpDb\Adapter\AdapterInterface;
Expand Down
71 changes: 31 additions & 40 deletions test/integration/Driver/Pdo/ConnectionIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,46 +75,6 @@ public function testDisconnect(): void
self::assertFalse($connection->isConnected());
}

/**
* @todo Implement testBeginTransaction().
*/
public function testBeginTransaction(): never
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}

/**
* @todo Implement testCommit().
*/
public function testCommit(): never
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}

/**
* @todo Implement testRollback().
*/
public function testRollback(): never
{
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}

public function testGetLastGeneratedValue(): never
{
$this->markTestIncomplete('Need to create a temporary sequence.');
//$connection = new Connection($this->variables);
//$connection->getLastGeneratedValue();
}

public function testConnectReturnsConnectionWhenResourceSet(): void
{
/** @var PDO $resource */
Expand All @@ -129,4 +89,35 @@ public function testConnectReturnsConnectionWhenResourceSet(): void
unset($connection);
unset($resource);
}

// public function testBeginTransaction(): never
// {
// // Remove the following lines when you implement this test.
// $this->markTestIncomplete(
// 'This test has not been implemented yet.'
// );
// }

// public function testCommit(): never
// {
// // Remove the following lines when you implement this test.
// $this->markTestIncomplete(
// 'This test has not been implemented yet.'
// );
// }

// public function testRollback(): never
// {
// // Remove the following lines when you implement this test.
// $this->markTestIncomplete(
// 'This test has not been implemented yet.'
// );
// }

// public function testGetLastGeneratedValue(): never
// {
// $this->markTestIncomplete('Need to create a temporary sequence.');
// //$connection = new Connection($this->variables);
// //$connection->getLastGeneratedValue();
// }
}
Loading