phpstan-fixer

phpstan-fixer is a skill for Claude Code, Codex from marcelorodrigo/agent-skills. It costs 46 tokens per session (3,426 once invoked), scanned A, original, MIT.

A guide for fixing PHPStan errors in PHP code with type annotations, PHPDocs, and code changes.

In plain words
What is it for?
Use it when PHPStan reports type mismatches, missing type hints, or other static-analysis failures in a PHP project.
Why use it?
It helps resolve the underlying type problems instead of hiding errors or weakening the project's PHPStan settings.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions AGENTS.md.

Good fit Use it when PHPStan reports type mismatches, missing type hints, or other…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/marcelorodrigo/agent-skills/phpstan-fixer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add marcelorodrigo/agent-skills --skill phpstan-fixer
Clone the repo
git clone --depth 1 https://github.com/marcelorodrigo/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for phpstan-fixer

README.md
[![agentmods](https://agentmods.dev/badge/skills/marcelorodrigo/agent-skills/phpstan-fixer.svg)](https://agentmods.dev/skills/marcelorodrigo/agent-skills/phpstan-fixer)
Your own site
<a href="https://agentmods.dev/skills/marcelorodrigo/agent-skills/phpstan-fixer"><img src="https://agentmods.dev/badge/skills/marcelorodrigo/agent-skills/phpstan-fixer.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,426 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.03426
Opus 5 $0.00023 $0.01713
Sonnet 5 $0.00009 $0.00685
Haiku 4.5 $0.00005 $0.00343

Measured 6d ago against content hash c9877b80e613, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

phpstan-fixer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/phpstan-fixer/SKILL.md · 634 lines

How it starts

The opening of the file, as written. The whole thing — 634 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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:

# Check for Laravel
grep laravel/framework composer.json

# Check for Symfony
grep symfony/symfony composer.json

# Check for PHPStan extensions
grep phpstan composer.json

# Read PHPStan config
cat phpstan.neon

# Check project guidelines
cat AGENTS.md

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:

------ ----------------------------------------------
Line   /path/to/File.php
------ ----------------------------------------------
42     Parameter $user of method foo() has invalid
       type App\User.
       💡 Identifier: parameter.type
------ ----------------------------------------------

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?)

Read the full file on GitHub · 634 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 634 lines · 46 tokens per session scan A c9877b80e613

Subscribe to this mod's changes

phpstan-fixer is a skill published in the GitHub repository marcelorodrigo/agent-skills (18 stars, last pushed 3d ago), licensed MIT. It adds 46 tokens to every session and 3,426 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

sentry-php-sdk

Full Sentry SDK setup for PHP. Use when asked to "add Sentry to PHP", "install sentry/sentry", "setup Sentry in PHP", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for PHP applications. Supports plain PHP, Laravel, and Symfony.

getsentry/sentry-for-ai · 71 tokens

bug-root-cause-finder

Root cause analysis methods for PHP bugs. Provides 5 Whys technique, fault tree analysis, git bisect guidance, and stack trace parsing.

dykyi-roman/awesome-claude-code · 36 tokens

check-cascading-failures

Detects cascading failure risks in PHP systems. Identifies shared resources, unbounded queues, missing backpressure, thread pool exhaustion, and failure propagation paths.

dykyi-roman/awesome-claude-code · 39 tokens

php-quality-tooling

Use when setting up PHPStan, Rector, or PHP-CS-Fixer on a non-Laravel PHP project, incl. CI wiring. Do NOT use for Laravel (Pint/Larastan), tests, or syntax.

fusengine/agents · 51 tokens

wp-phpstan-static-analysis

Run PHPStan static analysis on a WordPress plugin or theme using szepeviktor/phpstan-wordpress. Covers the composer dev-dependencies and what is pulled transitively (phpstan/phpstan ^2.0, php-stubs/wordpress-stubs), the optional phpstan/extension-installer that auto-registers the extension, the phpstan.neon.dist…

Lonsdale201/wp-agent-skills · 227 tokens

wp-phpstan

Use when configuring, running, or fixing PHPStan static analysis in WordPress projects (plugins/themes/sites): phpstan.neon setup, baselines, WordPress-specific typing, and handling third-party plugin classes.

WordPress/agent-skills · 47 tokens