PHPStan Error Resolver

VerifiedSafe

Automatically analyzes PHPStan errors and fixes them in batches of five, looping until zero errors or stagnation. Helps maintain a typed PHP codebase without repetitive manual intervention.

Sby Skills Guide Bot
DevelopmentIntermediate
406/2/2026
Claude Code
#phpstan#static-analysis#php#error-resolution#automated-fix

Recommended for

Our review

Automatically resolves PHPStan errors by analyzing and fixing type issues in batches, looping until zero errors or stagnation.

Strengths

  • Greatly reduces manual effort for fixing PHPStan errors
  • Batch processing with delegation to a sub-agent for each correction
  • Generates a final report with error counts and success rate
  • Handles stagnation and maximum iteration limits gracefully

Limitations

  • Only works with PHPStan, not other static analysis tools
  • Automatic fixes may introduce new errors if context is misinterpreted
  • Limited to type-related errors and does not address deep architectural issues
When to use it

Use this skill when your PHP project has a large number of PHPStan errors you want to fix systematically in an iterative manner.

When not to use it

Avoid using it when errors require deep architectural changes or when each fix must be manually reviewed for security or business logic reasons.

Security analysis

Safe
Quality score90/100

The skill uses Bash only to run PHPStan (vendor binary) with safe arguments and uses Edit to fix type errors; no destructive, exfiltration, or obfuscated commands.

No concerns found

Examples

Fix all PHPStan errors
/qa:phpstan
Resolve PHPStan errors batch by batch
Run the PHPStan error resolver workflow to fix type errors in the codebase, correcting 5 errors per iteration.
Iterative PHPStan resolution with report
Automatically resolve PHPStan errors using the resolver skill, then generate a summary of fixes.

name: phpstan-resolver description: > Résout automatiquement les erreurs PHPStan en analysant et corrigeant les problèmes de types. Boucle jusqu'à zéro erreur ou stagnation. allowed-tools: [Task, Bash, Read, Edit, Grep, Glob] model: claude-opus-4-1-20250805

PHPStan Error Resolver Skill

Instructions à Exécuter

IMPORTANT : Exécute ce workflow étape par étape :

Usage

/qa:phpstan

Configuration

PHPSTAN_BIN="./vendor/bin/phpstan"
PHPSTAN_CONFIG="phpstan.neon"  # ou phpstan.neon.dist
ERROR_BATCH_SIZE=5
MAX_ITERATIONS=10

Workflow

Initialisation

Créer les tâches du workflow :

Utiliser TaskCreate pour chaque phase :

TaskCreate #1: Vérifier environnement PHPStan
TaskCreate #2: Exécuter analyse initiale (--error-format=json)
TaskCreate #3: Grouper erreurs par fichier
TaskCreate #4: Boucle de résolution (max 10 itérations)
TaskCreate #5: Générer rapport final

Important :

  • Utiliser activeForm (ex: "Vérifiant environnement PHPStan", "Résolvant erreurs")
  • La tâche #4 peut prendre du temps (boucle jusqu'à 10 itérations)
  • Chaque tâche doit être marquée in_progress puis completed

Pattern d'exécution pour chaque étape :

  1. TaskUpdate → tâche en in_progress
  2. Exécuter l'étape
  3. TaskUpdate → tâche en completed

Spécial pour la boucle de résolution (tâche #4) :

  • Marquer en in_progress au début de la boucle
  • Ne marquer en completed qu'à la fin (0 erreur, stagnation, ou max itérations)
  • Le statut reste in_progress pendant toutes les itérations

Étapes

  1. Vérifier environnement PHPStan
  2. Exécuter analyse initiale (--error-format=json)
  3. Grouper erreurs par fichier
  4. Boucle de résolution :
    • Déléguer corrections à @phpstan-error-resolver
    • Re-exécuter PHPStan
    • Répéter jusqu'à 0 erreur ou stagnation
  5. Générer rapport final

Délégation

Utilise l'agent @phpstan-error-resolver pour les corrections :

  • Batch de 5 erreurs par fichier par itération
  • Maximum 10 itérations

Rapport

details:
  total_errors_initial: X
  total_errors_final: Y
  errors_fixed: Z
  success_rate: "X%"
  iterations: N

Task Management

Progression du workflow :

  • 5 tâches créées à l'initialisation
  • La tâche #4 (boucle) reste in_progress pendant toutes les itérations
  • Chaque tâche suit le pattern : in_progress → exécution → completed
  • Utiliser TaskList pour voir la progression (notamment pour la boucle longue)
  • Les tâches permettent à l'utilisateur de suivre la résolution progressive des erreurs

References

Error Handling

  • PHPStan non trouvé → ARRÊT
  • Config absente → ARRÊT
  • Stagnation → ARRÊT avec rapport
  • Max itérations → ARRÊT avec rapport
Related skills