Skip to content

Bring Mago back to green against phpdb 0.6.x - #87

Open
simon-mundy wants to merge 2 commits into
php-db:0.5.xfrom
simon-mundy:qa/mago-green
Open

simon-mundy wants to merge 2 commits into
php-db:0.5.xfrom
simon-mundy:qa/mago-green

Conversation

@simon-mundy

Copy link
Copy Markdown
Member

Mago fails on this branch against current phpdb 0.6.x. This makes it pass again without adding to the baselines. It is the first of the driver cleanup PRs; the analyzer baseline is reduced in a follow-up.

Changes

  • Driver::createStatement(): the docblock documented $sqlOrResource as mysqli|mysqli_stmt|string. That is narrower than the resource|string that DriverInterface declares, so the analyzer reported an incompatible parameter type. The method wraps a mysqli_stmt, prepares a string and ignores anything else, so it is now documented as mixed. The baseline entry carrying the old message is removed.
  • ColumnOptionTrait: the fall-through comments are re-indented to match the formatter.

Not in this PR

Connection still redeclares $resource without a type. Once php-db/phpdb#255 types the parent property as mixed, that redeclaration becomes a fatal error. The fix needs a narrowing accessor and comes separately.

Verification

mago fmt --dry-run, lint, analyze and guard all exit 0, and the unit suite passes (193 tests).

Driver::createStatement() documented $sqlOrResource as
mysqli|mysqli_stmt|string, which is narrower than the resource|string
that DriverInterface declares, so the analyzer reported an incompatible
parameter type. The method wraps a mysqli_stmt, prepares a string and
ignores anything else, so it is now documented as mixed. The baseline
entry for the old message is removed.

ColumnOptionTrait's fall-through comments are indented to match the
statements they follow, as the formatter requires.
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@simon-mundy
simon-mundy requested a balanced review from Copilot November 17, 2026 23:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues requiring changes.

No open issues 🎉

What changed in this PR

This PR addresses Mago checks against phpdb 0.6.x through documentation and formatting changes, without changing runtime behavior or adding baseline suppressions.

Changes:

  • Widens the Driver::createStatement() PHPDoc parameter type to mixed to accommodate the interface contract.
  • Removes the corresponding obsolete analyzer baseline entry.
  • Re-indents fall-through comments to match the formatter.
File Description
src/​Sql/​Ddl/​ColumnOptionTrait.php Adjusts fall-through comment indentation only.
src/​Driver.php Updates the createStatement() parameter documentation.
analysis-baseline.toml Removes the resolved parameter-type suppression.

Review effort: Balanced

Documenting $sqlOrResource as mixed hid the real contract. It is now
mysqli_stmt|string|null, matching what the method handles, and the
incompatible-parameter-type report against DriverInterface's
resource|string is baselined alongside createResult(), pending
php-db/phpdb#170 introducing @template generics on the interface.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants