Widen docblocks to the types the code accepts, and raise PHPStan to level 4 - #258
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughPHPDoc annotations across query, mutation, join, where, and having APIs were widened to match existing nullable and closure inputs. PHPStan analysis for ChangesQuery type documentation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@phpstan.neon.dist`:
- Around line 19-25: Update the counted ignores for booleanNot.alwaysTrue and
deadCode.unreachable in phpstan.neon.dist to include message/messages patterns
that match only the intended diagnostics in src/AbstractQuery.php.
Alternatively, replace each file-scoped suppression with an inline ignore at its
exact diagnostic location, ensuring unrelated diagnostics cannot consume the
allowed counts.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 09eaaf18-5ee3-4f04-a533-9d4f9923e99b
📒 Files selected for processing (14)
phpstan.neon.distsrc/AbstractDmlQuery.phpsrc/AbstractQuery.phpsrc/Common/Insert.phpsrc/Common/LateralJoinTrait.phpsrc/Common/OnConflictUpdateInterface.phpsrc/Common/OnConflictUpdateTrait.phpsrc/Common/Select.phpsrc/Common/SelectInterface.phpsrc/Common/Update.phpsrc/Common/ValuesInterface.phpsrc/Common/WhereInterface.phpsrc/Common/WhereTrait.phpsrc/Mysql/Insert.php
Follow-on to #257. Docblocks only; no code changes, no behaviour change.
Each widening was checked by building the SQL rather than read off the
signature:
So
@param string $valuebecomesstring|nullwhere passing null rendersSQL NULL,
@param string $condbecomesstring|Closureon the WHERE andHAVING family, and the 10 join conditions become
string|null-- theydefault to null and a join with no condition is a supported call.
Joins do NOT take a closure (
preg_split(): Argument #2 must be of type string, Closure given), so those staystring, notstring|Closure. Thedistinction is why each case was built rather than swept.
Level 3 -> 4, with three ignores in phpstan.neon.dist:
addClauseCondClosure()empties a clause, hands the query to a closure,then reads the clause back. PHPStan does not model mutation through the
closure, so it reports the test as always true and the rest as unreachable.
The code is correct and is what makes
where(function ($q) { ... })produce grouped parentheses.
getCond()asserts an array key is an int, which PHP guarantees once thestring case has returned. Kept as a deliberate guard.
Each ignore carries a
count, so it suppresses only the occurrences itdescribes -- verified by injecting an unreachable statement elsewhere in
AbstractQuery.php and confirming the run fails.
Checks unchanged: 1303 unit, 132 integration, 24 doc examples.
Summary by CodeRabbit
nullwhere supported.null, documenting that it is represented as SQLNULL.