1--TEST--
2Deprecation promoted to exception should result in fatal error during inheritance
3--SKIPIF--
4<?php
5if (getenv('SKIP_PRELOAD')) die('skip Error handler not active during preloading');
6?>
7--FILE--
8<?php
9
10set_error_handler(function($code, $message) {
11    throw new Exception($message);
12});
13
14$class = new class extends DateTime {
15    public function getTimezone() {}
16};
17
18?>
19--EXPECTF--
20Fatal error: During inheritance of DateTime: Uncaught Exception: Return type of DateTime@anonymous::getTimezone() should either be compatible with DateTime::getTimezone(): DateTimeZone|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in %s:%d
21Stack trace:
22#0 %s(%d): {closure:%s:%d}(8192, 'Return type of ...', '%s', 8)
23#1 {main} in %s on line %d
24