From 16ef81ca8eb13d5acef4a9de60ae8f6d8adc6708 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Tue, 6 Oct 2026 23:58:27 -0500 Subject: [PATCH 1/2] Add missing mysqli_result import to Driver and prune dead baseline entries src/Driver.php references mysqli_result in the docblock for createResult() but never imported it, so the unqualified name resolved to the non-existent PhpDb\Mysql\mysqli_result. Adding the import clears 2 of the 6 baselined findings for this file: non-existent-class-like and possibly-invalid-argument. Regenerating the baseline with mago also refreshed the message on the pre-existing incompatible-parameter-type entry for createResult(), whose text embedded the unresolved unknown-ref(PhpDb\Mysql\mysqli_result). The entry itself is unchanged in intent and remains baselined. The remaining 4 baselined findings for this file are deliberately left alone: two incompatible-parameter-type contravariance violations against DriverInterface::resource (a phpdb core concern), plus missing-property-type and docblock-type-mismatch. --- analysis-baseline.toml | 14 +------------- src/Driver.php | 1 + 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/analysis-baseline.toml b/analysis-baseline.toml index b2fc9a1..97c46a4 100644 --- a/analysis-baseline.toml +++ b/analysis-baseline.toml @@ -267,7 +267,7 @@ count = 1 [[issues]] file = "src/Driver.php" code = "incompatible-parameter-type" -message = 'Parameter `$resource` of `PhpDb\Mysql\Driver::createresult()` expects type `mysqli|mysqli_stmt|unknown-ref(PhpDb\Mysql\mysqli_result)` but parent `PhpDb\Adapter\Driver\DriverInterface::createresult()` expects type `resource`' +message = 'Parameter `$resource` of `PhpDb\Mysql\Driver::createresult()` expects type `mysqli|mysqli_result|mysqli_stmt` but parent `PhpDb\Adapter\Driver\DriverInterface::createresult()` expects type `resource`' count = 1 [[issues]] @@ -282,18 +282,6 @@ code = "missing-property-type" message = "Property `$options` is missing a type hint." count = 1 -[[issues]] -file = "src/Driver.php" -code = "non-existent-class-like" -message = 'Cannot find class, interface, enum, or type alias `PhpDb\Mysql\mysqli_result`.' -count = 1 - -[[issues]] -file = "src/Driver.php" -code = "possibly-invalid-argument" -message = 'Possible argument type mismatch for argument #1 of `PhpDb\Mysql\Result::initialize`: expected `mysqli|mysqli_result|mysqli_stmt`, but possibly received `mysqli|mysqli_stmt|unknown-ref(PhpDb\Mysql\mysqli_result)`.' -count = 1 - [[issues]] file = "src/Metadata/Source.php" code = "impossible-condition" diff --git a/src/Driver.php b/src/Driver.php index 2b0828d..ad18544 100644 --- a/src/Driver.php +++ b/src/Driver.php @@ -5,6 +5,7 @@ namespace PhpDb\Mysql; use mysqli; +use mysqli_result; use mysqli_stmt; use Override; use PhpDb\Adapter\Driver\ConnectionInterface; From 079081f20549c855671306a7b0b05cdc9b5bbc99 Mon Sep 17 00:00:00 2001 From: Joey Smith Date: Wed, 7 Oct 2026 00:14:35 -0500 Subject: [PATCH 2/2] Add native array type hint to Driver::$options The property was untyped, so mago reported missing-property-type. Declaring `array` satisfies the check; the docblock now also names the variable. Regenerated the analysis baseline with mago, dropping the now-dead entry (88 -> 87 blocks; src/Driver.php 4 -> 3). --- analysis-baseline.toml | 6 ------ src/Driver.php | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/analysis-baseline.toml b/analysis-baseline.toml index 97c46a4..f333111 100644 --- a/analysis-baseline.toml +++ b/analysis-baseline.toml @@ -276,12 +276,6 @@ code = "incompatible-parameter-type" message = 'Parameter `$sqlOrResource` of `PhpDb\Mysql\Driver::createstatement()` expects type `mysqli|mysqli_stmt|string` but parent `PhpDb\Adapter\Driver\DriverInterface::createstatement()` expects type `resource|string`' count = 1 -[[issues]] -file = "src/Driver.php" -code = "missing-property-type" -message = "Property `$options` is missing a type hint." -count = 1 - [[issues]] file = "src/Metadata/Source.php" code = "impossible-condition" diff --git a/src/Driver.php b/src/Driver.php index ad18544..4f1d8c9 100644 --- a/src/Driver.php +++ b/src/Driver.php @@ -24,8 +24,8 @@ final class Driver implements DriverInterface, ProfilerAwareInterface { protected ?ProfilerInterface $profiler = null; - /** @var array */ - protected $options = [ + /** @var array $options */ + protected array $options = [ 'buffer_results' => false, ];