Static Analysis & Code Quality
Prerequisites: Introduction to Symfony
PHPStan (or Psalm) analyzes code without running it, catching type errors and other bugs that PHP's own runtime would only discover if that exact code path executed:
./vendor/bin/phpstan analyse src
function greet(string $name): string
{
return "Hello, " . $name->length; // PHPStan flags this immediately —
} // strings don't have ->length
PHP-CS-Fixer (or PHP_CodeSniffer) automatically reformats code to match a style standard (PSR-12, from Level 2) — run in CI alongside PHPUnit and PHPStan so every merge meets the same bar.