fix(books): rimuovi guard morto su traduttore/illustratore scrapati (PHPStan L5 verde)#200
fix(books): rimuovi guard morto su traduttore/illustratore scrapati (PHPStan L5 verde)#200fabiodalez-dev wants to merge 1 commit into
Conversation
…tratore PHPStan level 5 flagged BookRepository's scraped-field merge: the `!isset($cols['traduttore'])` / `!isset($cols['illustratore'])` guards are dead code — no earlier branch assigns those keys, so the condition is always true (isset.offset → impossibleType). Unlike the sibling fields (ean, collana, data_pubblicazione) which a prior branch can set, traduttore/illustratore are assigned only here, so the guard never fires. Remove the redundant guard (behavior-identical: the removed condition was always true) so the project-wide PHPStan gate is green again. Verified: php -l clean, `phpstan analyse` (level 5) reports no errors across the whole project.
|
Warning Review limit reached
More reviews will be available in 44 minutes and 35 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Problema
phpstan analyse(livello 5) sull'intero progetto riportava 2 errori inapp/Models/BookRepository.php:1208/1211:Causa
I guard
!isset($cols['traduttore'])/!isset($cols['illustratore'])sono codice morto: nessun branch precedente imposta quelle chiavi in$cols, quindi la condizione è sempre vera. A differenza dei campi gemelli (ean,collana,data_pubblicazione) che un branch precedente può impostare,traduttore/illustratoresono assegnati solo lì.Fix
Rimosso il guard ridondante (comportamento identico — la condizione rimossa era sempre vera), così il gate PHPStan dell'intero progetto torna verde.
Verifica
php -lpulito.phpstan analyselivello 5 sull'intero progetto →[OK] No errors(prima: 2 errori).Pre-esistente su
main, indipendente dalle altre PR. Emerso eseguendo PHPStan full-project.