It’s easy to make great things in PHP, but bugs can creep in just as easily. Psalm is a free & open-source static analysis tool that helps you identify problems in your code, so you can sleep a little better.
Psalm helps people maintain a wide variety of codebases – large and small, ancient and modern. On its strictest setting it can help you prevent almost all type-related runtime errors, and enables you to take advantage of safe coding patterns popular in other languages.
Psalm also fixes bugs automatically, allowing you to improve your code without breaking a sweat.
Help support Psalm’s ongoing development costs by requesting a paid support contract from Psalm’s maintainer.
xxxxxxxxxx
/**
* @return array<string>
*/
function takesAnInt(int $i) {
return [$i, "hello"];
}
$data = ["some text", 5];
takesAnInt($data[0]);
$condition = rand(0, 5);
if ($condition) {
} elseif ($condition) {}