Repository navigation
Bring Mago back to green against phpdb 0.6.x - #87
Open
simon-mundy wants to merge 2 commits into
Open
simon-mundy wants to merge 2 commits into
simon-mundy wants to merge 2 commits into
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🟢 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 tomixedto 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.
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.
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$sqlOrResourceasmysqli|mysqli_stmt|string. That is narrower than theresource|stringthatDriverInterfacedeclares, so the analyzer reported an incompatible parameter type. The method wraps amysqli_stmt, prepares a string and ignores anything else, so it is now documented asmixed. 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
Connectionstill redeclares$resourcewithout a type. Once php-db/phpdb#255 types the parent property asmixed, that redeclaration becomes a fatal error. The fix needs a narrowing accessor and comes separately.Verification
mago fmt --dry-run,lint,analyzeandguardall exit 0, and the unit suite passes (193 tests).