1--TEST--
2Typed class constants (type coercion is unsupported)
3--FILE--
4<?php
5class S {
6    public function __toString() {
7        echo "Side effect!\n";
8        return 'S';
9    }
10}
11
12class A {
13    public const string S = S;
14}
15
16define("S", new S());
17
18try {
19    var_dump(A::S);
20} catch (TypeError $e) {
21    echo $e->getMessage() . "\n";
22}
23?>
24--EXPECT--
25Cannot assign S to class constant A::S of type string
26