Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead¶
Description¶
The error level E_USER_ERROR is deprecated since PHP 8.4. It should be replaced with a thrown exceptions. The other levels, E_USER_NOTICE and E_USER_WARNING are still available.
Example¶
<?php
trigger_error('message', E_USER_ERROR);
?>
Solutions¶
Throw an execption.
Changed Behavior¶
This error may appear following an evolution in behavior, in previous versions. See E_USER_ERROR.
Static Analysis¶
This error may be tracked down with the following static analysis rules: Php/TriggerErrorUserError.