The World Wide Web, restored to 800 pixels of glory.
GeezerVison is showing phpstan.org — Documentation
Find the right guide for your problem. Whether you're just getting started, looking to write better PHPDocs, or building custom extensions.
Installation, first run, and core concepts
I want to install PHPStan and run it for the first time
I want to know all the CLI options and flags
I want to understand what each level (0–10) checks
I want to configure PHPStan using a NEON config file
I want to run PHPStan in a Docker container
Guides for common PHPStan errors and how to fix them
I have an array parameter or return type and PHPStan wants me to be more specific
array
I use new static() and PHPStan says it might break in subclasses
new static()
I use __get/__set or dynamic properties and PHPStan doesn't understand them
Every PHPStan error has an identifier. Search for it to find a page with a code example showing when the error is reported, why, and how to fix it.
PHPStan reported something and you need to act on it
I want to suppress a specific error I can't fix right now
I want to adopt PHPStan on a legacy codebase without fixing all existing errors
I want PHPStan output in JSON, JUnit, or another CI-friendly format
PHPDocs, type syntax, and patterns that help PHPStan understand your code
I want to learn what PHPDoc tags PHPStan understands
I want to know what types I can use in PHPDocs — array shapes, generics, unions, and more
I want PHPStan to understand that after an instanceof check, the variable has a specific type
instanceof
PHPStan reports a variable as possibly undefined but I know it's always defined
I want to override wrong or imprecise PHPDocs in third-party code (vendor)
Something isn't working the way you'd expect
PHPStan infers a different type than I expect — where is it coming from?
PHPStan reports "Class not found" or "Function not found" but the code runs fine
PHPStan reports different errors on my machine and in CI
I want to understand caching, or PHPStan keeps running a full analysis
PHPStan is slow — I want to find out which files take the longest
Type-safe collections, containers, and reusable code with @template
@template
I want to understand how generics work in PHPStan — @template, @extends, type variables
I want to see practical examples of generics for common patterns
I want to pass Collection<Cat> where Collection<Animal> is expected
Collection<Cat>
Collection<Animal>
I want covariance or contravariance at the call site without modifying the class declaration
PHPStan can't figure out what type a template type should be
Going further with PHPStan's features
I want PHPStan to forget function return values that might change between calls
I want PHPStan to enforce that exceptions are caught or declared
I want to understand how PHPStan analyses code in try-catch-finally blocks
I want to enable experimental checks before the next major release
I use Symfony, Laravel, Doctrine, or another framework and want better analysis
Extend PHPStan with custom rules and type inference for your codebase
I want to see what kinds of extensions I can build
I want to enforce project-specific coding standards with PHPStan
A method's return type depends on its arguments and PHPStan doesn't infer it correctly
My class uses __get, __set, or __call and PHPStan doesn't know about the magic properties/methods
I have a custom assertion function that narrows types and PHPStan doesn't understand it
I want to output errors in a custom format for my CI system
I want to browse PHPStan's internal classes and interfaces