Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PHPStan

PHPStan is a static analysis tool for PHP that finds bugs without running the code, by reading the source, its type declarations, and its docblocks, and checking them for consistency.

PHPStan is able to:

  • Detect type errors, such as calling a method that does not exist or passing the wrong type to a function
  • Understand the generics-like docblock type language, like list<Order>, array<string, Money>, used across the PHP ecosystem
  • Enforce increasingly strict checking through numbered rule levels
  • Be extended with custom rules and framework-specific extensions
  • Run in continuous integration to catch regressions before deployment.

Documentation

See Also