PHPStan allows you to choose the type of warnings based on levels. https://phpstan.org/user-guide/rule-levels It is currently set to level 5 (the maximum is 10). Let's make it stricter and refactor the code for better quality.