From f38d603d67010953b3ce14e793ee004b86cda788 Mon Sep 17 00:00:00 2001 From: Copilot Date: Wed, 7 Oct 2026 02:42:44 -0500 Subject: [PATCH 1/2] Widen ConnectionInterface::getResource() to resource|object|null --- analyzer-baseline.toml | 18 ------------------ src/Adapter/Driver/AbstractConnection.php | 6 +----- src/Adapter/Driver/ConnectionInterface.php | 2 +- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/analyzer-baseline.toml b/analyzer-baseline.toml index 0ab2d502..7e364514 100644 --- a/analyzer-baseline.toml +++ b/analyzer-baseline.toml @@ -156,18 +156,6 @@ code = "imprecise-type" message = "Type `array` in return type of `getConnectionParameters` is imprecise, equivalent to `array`." count = 1 -[[issues]] -file = "src/Adapter/Driver/AbstractConnection.php" -code = "incompatible-return-type" -message = 'Return type `null|resource` of `PhpDb\Adapter\Driver\AbstractConnection::getresource()` is incompatible with parent return type `resource` of `PhpDb\Adapter\Driver\ConnectionInterface::getresource()`' -count = 1 - -[[issues]] -file = "src/Adapter/Driver/AbstractConnection.php" -code = "incompatible-return-type" -message = 'Return type `null|resource` of `PhpDb\Adapter\Driver\Pdo\AbstractPdoConnection::getresource()` is incompatible with parent return type `resource` of `PhpDb\Adapter\Driver\ConnectionInterface::getresource()`' -count = 1 - [[issues]] file = "src/Adapter/Driver/AbstractConnection.php" code = "missing-api-or-internal" @@ -426,12 +414,6 @@ code = "imprecise-type" message = "Type `array` in parameter `$connectionParameters` is imprecise, equivalent to `array`." count = 1 -[[issues]] -file = "src/Adapter/Driver/Pdo/AbstractPdoConnection.php" -code = "incompatible-property-type" -message = 'Property `PhpDb\Adapter\Driver\Pdo\AbstractPdoConnection::$resource` has an incompatible type declaration from docblock.' -count = 1 - [[issues]] file = "src/Adapter/Driver/Pdo/AbstractPdoConnection.php" code = "missing-api-or-internal" diff --git a/src/Adapter/Driver/AbstractConnection.php b/src/Adapter/Driver/AbstractConnection.php index c76498a8..ac50195f 100644 --- a/src/Adapter/Driver/AbstractConnection.php +++ b/src/Adapter/Driver/AbstractConnection.php @@ -21,11 +21,7 @@ abstract class AbstractConnection implements ConnectionInterface, ProfilerAwareI protected ?ProfilerInterface $profiler = null; - /** - * Extending classes must be covariant - * - * @var mixed - */ + /** Extending classes must be covariant. */ protected $resource; #[Override] diff --git a/src/Adapter/Driver/ConnectionInterface.php b/src/Adapter/Driver/ConnectionInterface.php index 77ca4380..51511428 100644 --- a/src/Adapter/Driver/ConnectionInterface.php +++ b/src/Adapter/Driver/ConnectionInterface.php @@ -30,7 +30,7 @@ public function getLastGeneratedValue(?string $name = null): string|int|false|nu /** * Get resource * - * @return resource + * @return resource|object|null */ public function getResource(); From 162fcd551acd7aed725af891bb3cbbcee1d3fd77 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Wed, 7 Oct 2026 15:01:48 -0500 Subject: [PATCH 2/2] Refresh analyzer baseline for mago 1.52.0 mago 1.52.0 changed method-name casing in non-existent-method messages (getlastgeneratedvalue -> getLastGeneratedValue, getsqlstring -> getSqlString, preparestatement -> prepareStatement), so the 11 baselined entries for Pdo/AbstractPdo.php and Sql/Platform/* stopped matching and resurfaced. Regenerated with mago analyze --generate-baseline under 1.52.0. The diff is exactly 11 message lines: no entries added, none removed, no findings changed. --- analyzer-baseline.toml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/analyzer-baseline.toml b/analyzer-baseline.toml index 7e364514..6264b00f 100644 --- a/analyzer-baseline.toml +++ b/analyzer-baseline.toml @@ -351,19 +351,19 @@ count = 1 [[issues]] file = "src/Adapter/Driver/Pdo/AbstractPdo.php" code = "non-existent-method" -message = "Method `getlastgeneratedvalue` does not exist on type `PDO`." +message = "Method `getLastGeneratedValue` does not exist on type `PDO`." count = 1 [[issues]] file = "src/Adapter/Driver/Pdo/AbstractPdo.php" code = "non-existent-method" -message = "Method `getresource` does not exist on type `PDO`." +message = "Method `getResource` does not exist on type `PDO`." count = 1 [[issues]] file = "src/Adapter/Driver/Pdo/AbstractPdo.php" code = "non-existent-method" -message = "Method `isconnected` does not exist on type `PDO`." +message = "Method `isConnected` does not exist on type `PDO`." count = 1 [[issues]] @@ -2877,25 +2877,25 @@ count = 1 [[issues]] file = "src/Sql/Platform/AbstractPlatform.php" code = "non-existent-method" -message = 'Method `getsqlstring` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' +message = 'Method `getSqlString` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' count = 1 [[issues]] file = "src/Sql/Platform/AbstractPlatform.php" code = "non-existent-method" -message = 'Method `getsqlstring` does not exist on type `PhpDb\Sql\PreparableSqlInterface`.' +message = 'Method `getSqlString` does not exist on type `PhpDb\Sql\PreparableSqlInterface`.' count = 1 [[issues]] file = "src/Sql/Platform/AbstractPlatform.php" code = "non-existent-method" -message = 'Method `preparestatement` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' +message = 'Method `prepareStatement` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' count = 1 [[issues]] file = "src/Sql/Platform/AbstractPlatform.php" code = "non-existent-method" -message = 'Method `preparestatement` does not exist on type `PhpDb\Sql\SqlInterface`.' +message = 'Method `prepareStatement` does not exist on type `PhpDb\Sql\SqlInterface`.' count = 1 [[issues]] @@ -2925,25 +2925,25 @@ count = 1 [[issues]] file = "src/Sql/Platform/Platform.php" code = "non-existent-method" -message = 'Method `getsqlstring` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' +message = 'Method `getSqlString` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' count = 1 [[issues]] file = "src/Sql/Platform/Platform.php" code = "non-existent-method" -message = 'Method `getsqlstring` does not exist on type `PhpDb\Sql\PreparableSqlInterface`.' +message = 'Method `getSqlString` does not exist on type `PhpDb\Sql\PreparableSqlInterface`.' count = 1 [[issues]] file = "src/Sql/Platform/Platform.php" code = "non-existent-method" -message = 'Method `preparestatement` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' +message = 'Method `prepareStatement` does not exist on type `PhpDb\Sql\Platform\PlatformDecoratorInterface`.' count = 1 [[issues]] file = "src/Sql/Platform/Platform.php" code = "non-existent-method" -message = 'Method `preparestatement` does not exist on type `PhpDb\Sql\SqlInterface`.' +message = 'Method `prepareStatement` does not exist on type `PhpDb\Sql\SqlInterface`.' count = 1 [[issues]]