As I know we can't redefine a constant in PHP. So if I do:
define("DEVELOPMENT", true);
theoretical I can not redefine it using:
define("DEVELOPMENT", false); (or) const DEVELOPMENT = false;
The problem is PHP let me do that. It lets me redefining a constant without throwing any error. Display error is on (I got any other error):
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
What to do so constants can't be redefined and to get error if I try?
My PHP version is 7.2.17
To report all php error
error_reporting(E_ALL);
To report all php errors except notices
error_reporting(E_ALL & ~E_NOTICE);
And in your case, you are redefining a constant that has been already defined show PHP throws a notice. By using
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
You are telling PHP not to report any kind of notices or warnings. You should remove them.
To get all warning and notices use
error_reporting(E_ALL);
Fore more information refer to the official doc, and have a look on examples.