refactor(types): eliminate the PHPStan baseline (level max → 0)#48
Conversation
The baseline is down to its last 15 entries; clear them and delete the file so the codebase is clean at level: max with no suppressed debt. - VerifyEmailController: User now implements MustVerifyEmail (it already used the trait's methods and the verify flow is tested), so the event + method calls type-check. Controller uses a plain null-guard. The 'verified' middleware becomes enforcing — a no-op today since registration is disabled and all users are verified. - Indexes: extract the duplicated NULLS-LAST orderByRaw into a shared WithIndexFiltering::applyNullsLastOrder() helper (DRY across Album/ Board Game/Concert/Game), with one documented ignore for the whitelist-validated identifier. - WithAccentInsensitiveSearch: one documented ignore for the hardcoded column identifier in orWhereRaw. - Drop phpstan-baseline.neon and its include from phpstan.neon. Closes #39, #41, #42, #43, #44, #45.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Note
|
| Layer / File(s) | Summary |
|---|---|
Email Verification Contract & Guard app/Models/User.php, app/Http/Controllers/Auth/VerifyEmailController.php |
User declares MustVerifyEmail implementation. VerifyEmailController caches the authenticated user and redirect URL, guards against null or already-verified users, and only dispatches the Verified event after calling markEmailAsVerified(). |
Nulls-Last Ordering Helper app/Livewire/Concerns/WithIndexFiltering.php |
New applyNullsLastOrder() helper normalizes sort direction, quotes column identifiers, and applies PostgreSQL NULLS LAST semantics via orderByRaw. Imports Builder and Model for proper typing. |
Apply Nulls-Last Across Index Components app/Livewire/Albums/AlbumIndex.php, app/Livewire/BoardGames/BoardGameIndex.php, app/Livewire/Concerts/ConcertIndex.php, app/Livewire/Games/GameIndex.php |
Four index render methods replace inline orderByRaw(... NULLS LAST) calls with delegated applyNullsLastOrder() for nullable columns (rating, year, bgg_rating, plays, year_published, event_date). |
PHPStan Baseline & Suppressions phpstan.neon, phpstan-baseline.neon, app/Livewire/Concerns/WithAccentInsensitiveSearch.php |
Removes phpstan-baseline.neon from includes and deletes 91 baseline error suppressions. Adds @phpstan-ignore comment in WithAccentInsensitiveSearch for safe type coercion. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related issues
#39: This PR directly implements the code fixes and removes PHPStan baseline suppressions targeted by the "burn down the PHPStan baseline" effort, addressing the same files (VerifyEmailController, Livewire index components, WithIndexFiltering, WithAccentInsensitiveSearch).
Poem
🔐 Email now verified, nulls sorted last,
PHPStan baselines relegated to the past.
One helper born to tame the order,
Four indices dance across the border.
Type safety wins the day! ✨
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately describes the main objective: eliminating the PHPStan baseline to reach level max with zero suppressed violations, which is the core purpose across all file changes. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
chore/phpstan-baseline-zero
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 @coderabbitai help to get the list of available commands and usage tips.
What
Clears the last 15 entries of `phpstan-baseline.neon` and deletes the file (plus its `includes` line in `phpstan.neon`). The codebase is now clean at `level: max` with zero suppressed debt. Closes out the #39 epic.
The baseline was already down from ~1340 → 15 via the earlier #46 / Rector (#47) passes; this pays off the remainder.
The 15 entries, in two clusters
Auth (3) —
VerifyEmailController`User` already used the `MustVerifyEmail` trait methods and the verify flow is tested (asserts the `Verified` event fires), but it never implemented the interface — so the `verified` middleware was a silent no-op. `User` now `implements MustVerifyEmail`, the event + method calls type-check, and the controller uses a plain null-guard (no suppressions).
Index raw SQL (12)
orderByRaw("\"$sortBy\" $sortDir NULLS LAST")was duplicated across Album/BoardGame/Concert/Game indexes → extracted intoWithIndexFiltering::applyNullsLastOrder()(DRY), with one documented@phpstan-ignorefor the whitelist-validated identifier.orWhereRawinWithAccentInsensitiveSearch→ one documented@phpstan-ignorefor the hardcoded column identifier (PHPStan attributed this to all 8 using-classes; fixing the trait clears all 8).Verification
composer stan→ [OK] No errors (level max, no baseline)composer lint(Pint) → passphp artisan test→ 91 passed (incl. all EmailVerification + sort-sanitization/index tests)🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests