GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Home
  • Try
  • Documentation
  • Blog
  • GitHub

This view

  • Original page
  • New address

GeezerVison is showing phpstan.org — Documentation

Documentation

Documentation

Find the right guide for your problem. Whether you're just getting started, looking to write better PHPDocs, or building custom extensions.

User Guide Config Reference Writing PHP Code Developing Extensions

Getting Started

Installation, first run, and core concepts

Getting Started

I want to install PHPStan and run it for the first time

Command Line Usage

I want to know all the CLI options and flags

Rule Levels

I want to understand what each level (0–10) checks

Config Reference

I want to configure PHPStan using a NEON config file

Docker

I want to run PHPStan in a Docker container

Solving Specific Errors

Guides for common PHPStan errors and how to fix them

"No value type specified in iterable type"

I have an array parameter or return type and PHPStan wants me to be more specific

"Unsafe usage of new static()"

I use new static() and PHPStan says it might break in subclasses

"Access to an undefined property"

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.

Search error identifiers:

Dealing with Errors

PHPStan reported something and you need to act on it

Ignoring Errors

I want to suppress a specific error I can't fix right now

The Baseline

I want to adopt PHPStan on a legacy codebase without fixing all existing errors

Output Format

I want PHPStan output in JSON, JUnit, or another CI-friendly format

Writing PHP Code for PHPStan

PHPDocs, type syntax, and patterns that help PHPStan understand your code

PHPDocs Basics

I want to learn what PHPDoc tags PHPStan understands

PHPDoc Types

I want to know what types I can use in PHPDocs — array shapes, generics, unions, and more

Narrowing Types

I want PHPStan to understand that after an instanceof check, the variable has a specific type

Solving Undefined Variables

PHPStan reports a variable as possibly undefined but I know it's always defined

Stub Files

I want to override wrong or imprecise PHPDocs in third-party code (vendor)

Troubleshooting

Something isn't working the way you'd expect

Troubleshooting Types

PHPStan infers a different type than I expect — where is it coming from?

Discovering Symbols

PHPStan reports "Class not found" or "Function not found" but the code runs fine

Different Errors Locally vs. CI

PHPStan reports different errors on my machine and in CI

Result Cache

I want to understand caching, or PHPStan keeps running a full analysis

Debugging Performance

PHPStan is slow — I want to find out which files take the longest

Generics

Type-safe collections, containers, and reusable code with @template

Generics in PHP Using PHPDocs

I want to understand how generics work in PHPStan — @template, @extends, type variables

Generics By Examples

I want to see practical examples of generics for common patterns

What's Up With @template-covariant

I want to pass Collection<Cat> where Collection<Animal> is expected

Call-site Generic Variance

I want covariance or contravariance at the call site without modifying the class declaration

Solving "Unable to resolve template type"

PHPStan can't figure out what type a template type should be

Advanced Topics

Going further with PHPStan's features

Pure and Impure Functions

I want PHPStan to forget function return values that might change between calls

Checked Exceptions with @throws

I want PHPStan to enforce that exceptions are caught or declared

Try-Catch-Finally Analysis

I want to understand how PHPStan analyses code in try-catch-finally blocks

Bleeding Edge

I want to enable experimental checks before the next major release

Extension Library

I use Symfony, Laravel, Doctrine, or another framework and want better analysis

Developing Custom Extensions

Extend PHPStan with custom rules and type inference for your codebase

Extension Types Overview

I want to see what kinds of extensions I can build

Custom Rules

I want to enforce project-specific coding standards with PHPStan

Dynamic Return Type Extensions

A method's return type depends on its arguments and PHPStan doesn't infer it correctly

Class Reflection Extensions

My class uses __get, __set, or __call and PHPStan doesn't know about the magic properties/methods

Type-Specifying Extensions

I have a custom assertion function that narrows types and PHPStan doesn't understand it

Error Formatters

I want to output errors in a custom format for my CI system

API Reference

I want to browse PHPStan's internal classes and interfaces

Theme
X Mastodon YouTube RSS
© 2026 PHPStan s.r.o.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.