Skip to content

fix(books): rimuovi guard morto su traduttore/illustratore scrapati (PHPStan L5 verde)#200

Open
fabiodalez-dev wants to merge 1 commit into
mainfrom
fix/phpstan-bookrepo-isset
Open

fix(books): rimuovi guard morto su traduttore/illustratore scrapati (PHPStan L5 verde)#200
fabiodalez-dev wants to merge 1 commit into
mainfrom
fix/phpstan-bookrepo-isset

Conversation

@fabiodalez-dev

Copy link
Copy Markdown
Owner

Problema

phpstan analyse (livello 5) sull'intero progetto riportava 2 errori in app/Models/BookRepository.php:1208/1211:

isset.offset / impossibleType — array_key_exists('traduttore'|'illustratore', $cols) will always evaluate to false

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/illustratore sono 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 -l pulito.
  • phpstan analyse livello 5 sull'intero progetto → [OK] No errors (prima: 2 errori).

Pre-esistente su main, indipendente dalle altre PR. Emerso eseguendo PHPStan full-project.

…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.
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@fabiodalez-dev, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0e31a106-6306-49d6-b33e-2d07c583aecb

📥 Commits

Reviewing files that changed from the base of the PR and between eab030e and 31122b7.

📒 Files selected for processing (1)
  • app/Models/BookRepository.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/phpstan-bookrepo-isset

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant