A static analyzer for PHP that minimizes false positives by attempting to prove incorrectness rather than correctness.
Phan is a static analyzer for PHP that detects bugs, type errors, and potential issues in code without executing it. It analyzes PHP source files to catch common mistakes like undefined variables, type mismatches, dead code, and PHP version incompatibilities, helping developers improve code reliability and maintainability.
PHP developers and teams working on medium to large codebases who want to catch bugs early, enforce type safety, and gradually improve code quality through static analysis.
Developers choose Phan for its low false-positive rate, practical approach to analyzing sloppy legacy code, and extensive support for modern PHP features like union types and generics. Its plugin system and editor integration make it highly adaptable to specific project needs.
Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Phan focuses on proving incorrectness rather than correctness, leading to fewer false alarms and making it practical for large, sloppy codebases, as stated in its philosophy.
Supports modern PHP features like union types, generics, and array shapes, along with comprehensive PHPDoc annotation parsing, as detailed in the features list.
Allows custom checks via plugins for regex validation, printf formatting, and coding style, with several bundled plugins available for immediate use.
Designed to be configured with varying strictness levels, enabling teams to gradually strengthen analysis as code quality improves, per the wiki guidance.
Phan depends on the php-ast extension for optimal parsing, which must be installed separately and may not be available in all hosting or CI environments.
Setting up involves creating a detailed config.php file and managing directory lists, which can be complex for projects with intricate structures or legacy code.
The README admits Phan has a good but not comprehensive understanding of flow control, potentially missing issues in complex conditional logic or dynamic value tracking.