Agent skill · software engineering · marcelorodrigo
phpstan-fixer
Fix PHPStan static analysis errors by adding type annotations and PHPDocs. Use when encountering PHPStan errors, type mismatches, missing type hints, or static analysis failures. Never ignores errors without user approval.
Why this skill is useful
Teaches specific PHPStan error resolution techniques and type annotation patterns that the AI wouldn't reliably generate on its own.
What it needs
Requires phpstan installed locally. About 7k tokens when loaded. Last updated 2026-08-02. 15 stars on the source repository.
What this skill does
PHPStan Error Fixer Fix PHPStan static analysis errors through proper type annotations, PHPDocs, and code improvements. This skill teaches agents how to resolve errors without suppressing them, respecting the project's configured strictness level. Core Principles 1. Never suppress errors as first resort — Fix the root cause with proper types and annotations 2. Respect user configuration — Never modify phpstan.neon settings (level, paths, parameters) 3. No silent ignoring — Never add ignoreErrors to config without explicit user approval 4. Context-aware fixes — Understand the project type (Laravel, Symfony, vanilla PHP) before proposing solutions 5. Ask before ignoring — If a legitimate ignore is needed, explain why and get user approval first 6. Don't fix third-party code — Never modify files in vendor/. Use stub files instead to override wrong types Workflow Step 1: Understand the Project Context Before fixing errors, identify the project type: Key information to extract: PHPStan level (0-10, or max) Installed PHPStan extensions (larastan, phpstan-strict-rules, etc.) Framework-specific helpers (Laravel IDE Helper, Symfony plugin) Project-specific type conventions Step 2: Analyze the Error PHPStan errors have this structure: Extract: 1. Error identifier (e.g., parameter.type, missingType.return) 2. Error location (file, line number) 3. Context (what's the code trying to do?) Step 3: Apply the Right Fix Use the error identifier to determine the fix strategy: Step 4: Verify the Fix After applying fixes, run PHPStan again to confirm: Important: If new errors appear, the fix may have been incorrect. Re-analyze the error and try a different approach. If the same error persists, the fix wasn't applied correctly. Double-check the code. If errors are resolved, mark the fix as successful and move to the next error. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills marcelorodrigo/phpstan-fixer