Search for a command to run...
PHP static analysis tool that finds bugs in code without running it. It inspects the whole codebase for type errors, undefined variables, invalid method calls, and similar issues, even in rarely executed code paths that tests may miss.
PHPStan is widely adopted across PHP projects, with sponsors including Shopware, Craft CMS, and Inviqa. It stands out by supporting legacy code through its baseline feature, letting teams fix issues gradually, and by understanding third‑party frameworks via an extension ecosystem for Symfony, Laravel, Doctrine, and others. Unlike style-only tools such as PHP_CodeSniffer, it focuses on correctness and type safety.
Key capabilities:
Teams use PHPStan in CI to block buggy code before merge, to refactor legacy codebases safely, and to improve type documentation. Developers integrate it with editors and run it alongside PHPUnit and framework-specific testing for stronger guarantees.