Repository navigation
Fix Driver imports and untyped property; prune dead mago baseline entries - #85
Merged
Merged
Conversation
…tries 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
simon-mundy
approved these changes
Oct 7, 2026
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two mago-related fixes in
src/Driver.php, plus the baseline regeneration they require:use mysqli_result;import.$optionsthe nativearraytype hint it was missing.analysis-baseline.tomlwas then regenerated by mago so the now-dead entries for that file are removed.Fix 1 — missing
mysqli_resultimportsrc/Driver.phpimportedmysqliandmysqli_stmtbut notmysqli_result, while the docblock forcreateResult()references it:Because the import was absent, the unqualified
mysqli_resultresolved relative to the current namespace asPhpDb\Mysql\mysqli_result, which does not exist. Addinguse mysqli_result;in alphabetical position (betweenuse mysqli;anduse mysqli_stmt;) makes the reference resolve.This clears 2 baselined findings:
non-existent-class-like—Cannot find class, interface, enum, or type alias PhpDb\Mysql\mysqli_result.possibly-invalid-argument— argument base deps #1 ofPhpDb\Mysql\Result::initializeFix 2 — untyped
$optionspropertyThe property carried only a docblock and no declared type, so mago reported
missing-property-type("Property$optionsis missing a type hint."). That check inspects declared property types, not annotations — verified by experiment: adding the variable name to the docblock alone left the finding in place, while declaringarraycleared it. This matchessrc/Result.php, which uses natively-typed properties and never appears in the baseline.This un-suppresses 3 findings — it does not add suppression
src/Driver.phphad 6 baselined findings. These two changes clear exactly 3 of them, which mago then removed from the baseline:non-existent-class-like— the unresolvedPhpDb\Mysql\mysqli_resultpossibly-invalid-argument— argument base deps #1 ofPhpDb\Mysql\Result::initializemissing-property-type— the untyped$optionsNet effect: the baseline goes from 90 → 87 entries, with 3 remaining for this file. This is an improvement — real defects are no longer masked — rather than a new suppression.
Baseline note
The baseline was regenerated by mago (
mago analyze --generate-baseline), never hand-edited. Besides the 3 removals, the only other change is the message text of the pre-existingincompatible-parameter-typeentry forcreateResult(): its message embedded the unresolvedunknown-ref(PhpDb\Mysql\mysqli_result), which is nowmysqli_result. The entry's intent is unchanged and it remains baselined.Deliberately out of scope
The remaining 3 baselined findings for
src/Driver.phpare intentionally left alone:incompatible-parameter-type—Driver::createResult()/Driver::createStatement()narrow the parent interface'sresourceparameter tomysqli|.... This is a parameter-contravariance issue that belongs tophpdbcore'sDriverInterface(whoseresourcetype is PHP-7-era), not to this repo. A real fix changes core, so this awaits a separate decision.docblock-type-mismatch— the/** @var mysqli $resource */annotation does not match what is assigned.Verification
mago format --check— all files already formattedmago lint— no issues found (nounused-importon the new import, no redundant-docblock complaint)mago analyze— no issues foundmago guard— no guard configuration present; checks skipped, no issuesvendor/bin/phpunit --testsuite "unit test"— OK (193 tests, 385 assertions)Diff: 2 files changed, 4 insertions(+), 21 deletions(-).
Does not reopen #71 — that issue is closed and its remaining findings are intentionally baselined.