<?php
declare(strict_types=1);

$image = imagecreatetruecolor(8, 6);
set_error_handler(static function (int $severity, string $message): bool {
    if ($severity === E_DEPRECATED) { echo "deprecated\n"; return true; }
    return false;
});
try { var_dump(imagedestroy($image)); } finally { restore_error_handler(); }
echo imagesx($image), "\n";
