phpstan

Enforce PHPStan static analysis to detect type and compatibility issues.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/dairectiv/dairectiv --skill phpstan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phpstan
Source: https://github.com/dairectiv/dairectiv/tree/main/.claude/skills/phpstan
Command: npx skills add https://github.com/dairectiv/dairectiv --skill phpstan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps teams enforce PHPStan-based static analysis to catch type and compatibility issues in PHP projects.

Core Features & Use Cases

  • Enforce project-wide static analysis to identify type mistakes, nullability issues, and incorrect method signatures.
  • Provide guidance for configuring PHPStan levels, custom rules, and PHPDoc correctness.
  • Use Case: Integrate PHPStan into CI to fail builds when type errors are detected and to guide developers in fixing issues quickly.

Quick Start

Install PHPStan via Composer in your project and run a basic analysis:

  • composer require --dev phpstan/phpstan
  • vendor/bin/phpstan analyse

Frequently Asked Questions about phpstan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use static analysis to catch type mismatches and nullability errors in PHP?

Static analysis catches type mismatches and nullability errors in PHP by enforcing PHPStan rules across your project to detect incorrect method contracts and type issues. It requires a PHP environment with PHPStan installed via Composer.

What's the best way to configure PHPStan levels for a large PHP application?

Configuring PHPStan levels involves setting a specific analysis level (e.g., level max) to enforce project-wide type safety and PHPDoc correctness. This ensures compatibility and strict type checking across large PHP applications and small libraries.

How do I integrate PHPStan into CI to fail builds when type errors are detected?

Integrate PHPStan into CI by running the static analysis command to fail builds automatically when type errors are detected. This guides developers in fixing type mistakes, nullability issues, and incorrect method signatures quickly.

Does PHPStan support project-specific PHPDoc rules and custom extensions?

PHPStan supports project-specific PHPDoc rules and custom extensions to enforce tailored static analysis. This allows teams to address unique type compatibility issues and incorrect method contracts within their specific PHP codebase.

How do I fix PHPStan errors related to incorrect method signatures?

Fixing PHPStan errors related to incorrect method signatures involves correcting type definitions and ensuring PHPDoc correctness based on the enforced static analysis level. This resolves type mismatches and nullability issues detected during the scan.

Do I need Composer to run PHPStan for type safety checks?

You need Composer to install PHPStan as a development dependency in your PHP project. This sets up the required environment to execute static analysis and catch type and compatibility issues effectively.