Php.ini settings for absolute maximum strictness

For MySQL I’ve got:


which AFAIK sets MySQL to it’s absolutely maximum possible strictness. What settings should I have in my php.ini file to set PHP to its absolutely maximum possible strictness?

I have mine set at error_reporting( -1 ); which I believe is the maximum setting,

Just checked the online manual:

// Report all PHP errors

I was thinking more on the lines of things like where you don’t specify what type of variable a variable is (eg string, integer, etc) that it would force you to always specify what type of variable it is

You can’t do that in php.ini, but if you want check you’re using the correct types of variables the first thing to do is to declare(strict_types=1); in all your files, and you can do additional checking using phpstan. I would recommend to start with level 1 and work your way up to level 7.
I’ve been using phpstan for a few months now and it’s caught a lot of tiny mistakes already.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.