About Psalm

Psalm is a static analysis tool that attempts to dig into your program and find as many type-related bugs as possible.

Introduction

Psalm tries to understand your codebase as best as possible so it can find errors.

It has a few features that go further than other similar tools:

Psalm also has a few features to make it perform as well as possible on large codebases:

Example output

// somefile.php
<?php
$a = ['foo', 'bar'];
echo implode($a, ' ');
> ./vendor/bin/psalm somefile.php
ERROR: InvalidArgument - somefile.php:3:14 - Argument 1 of implode expects `string`, `array` provided

Inspirations

There are two main inspirations for Psalm: - Etsy's Phan, which uses nikic's php-ast extension to create an abstract syntax tree - Facebook's Hack, a PHP-like language that supports many advanced typing features natively, so docblocks aren't necessary.