1--TEST-- 2#[\Deprecated]: Throwing error handler when using the return value. 3--FILE-- 4<?php 5 6set_error_handler(function (int $errno, string $errstr, ?string $errfile = null, ?int $errline = null) { 7 throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); 8}); 9 10#[Deprecated] 11function test() {} 12 13try { 14 $x = test(); 15} catch (ErrorException $e) { 16 echo "Caught: ", $e->getMessage(), PHP_EOL; 17} 18 19?> 20--EXPECT-- 21Caught: Function test() is deprecated 22