1--TEST--
2#[\Deprecated]: Using the value of a deprecated class constant as the deprecation message with a throwing error handler.
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
10class Clazz {
11	#[\Deprecated(self::TEST)]
12	public const TEST = "from itself";
13
14	#[\Deprecated]
15	public const TEST2 = "from another";
16
17	#[\Deprecated(self::TEST2)]
18	public const TEST3 = 1;
19}
20
21try {
22	Clazz::TEST;
23} catch (ErrorException $e) {
24	echo "Caught: ", $e->getMessage(), PHP_EOL;
25}
26
27try {
28	Clazz::TEST3;
29} catch (ErrorException $e) {
30	echo "Caught: ", $e->getMessage(), PHP_EOL;
31}
32
33?>
34--EXPECT--
35Caught: Constant Clazz::TEST is deprecated, from itself
36Caught: Constant Clazz::TEST2 is deprecated
37