phpstan-resolver

Résout automatiquement les erreurs PHPStan en analysant et corrigeant les problèmes de types. Boucle jusqu'à zéro erreur ou stagnation.

⭐6stars🔀0forks📁View on GitHub🕐Updated Jan 2, 2026

When & Why to Use This Skill

The PHPStan Error Resolver is an automated Claude skill designed to streamline PHP development by identifying and fixing static analysis errors. It iteratively analyzes codebases using PHPStan, corrects type-related issues, and validates fixes in a continuous loop until the code reaches zero errors or optimal stability, significantly reducing manual debugging time.

Use Cases

  • Legacy Code Modernization: Automatically resolve hundreds of type-hinting and static analysis errors when increasing PHPStan strictness levels in older projects.
  • Automated Bug Fixing: Use the agent to analyze and fix complex PHP type mismatches and undefined method errors identified during the QA process.
  • CI/CD Workflow Optimization: Integrate the skill to pre-process and fix static analysis failures before manual code reviews, ensuring a cleaner codebase.
  • Refactoring Support: Maintain code integrity after large-scale refactors by automatically correcting cascading type errors across the entire application.
namephpstan-resolver
description>
allowed-tools[Task, Bash, Read, Edit, Grep, Glob, TodoWrite]
modelclaude-opus-4-1-20250805

PHPStan Error Resolver Skill

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

  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

References

Error Handling

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