Convert PHP Warnings and notices into fatal errors

Turn on the feature by setting xdebug.halt_level either in your php.ini or via ini_set():

<?php
ini_set('xdebug.halt_level', E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
?>

Now cause a warning:

<?php
echo "Before";
imagecreatefromstring(null); // Don't pass null into imagecreatefromstring()!; 
echo "After";
?>

The result is that “Before” is displayed and then we get the standard Xdebug notice, but “After” is not displayed as the script is halted on the due to the warning.

<?php
echo "Before";
imagecreatefromstring(null); //Don't pass null into imagecreatefromstring()! 
echo "After";
?>

https://akrabat.com/convert-php-warnings-and-notices-into-fatal-errors/