A nice article about type safety in PHP 7+ on performance enhancing drugs when using Psalm (whoops, I mean Psalm):
https://psalm.dev/articles/php-or-type-safety-pick-any-two
If you don’t want to introduce full fledged static analysis into your CI pipeline, sneak types in on the linter with PHPCS Type Sniff: