Psalm is an open-source static analysis tool for PHP that helps you identify both obvious and hard-to-spot bugs in your code.
Psalm is designed to be useful on both large legacy codebases and small, modern ones. It can help you prevent the vast majority of type-related runtime errors, and also enables you to take advantage of safe coding patterns popular in other languages.
Psalm is extended with plugins, and there's a growing plugin ecosystem.
Lastly, Psalm can automatically fix a number of the errors it finds, allowing you to improve your code without breaking a sweat.