So, #PHP typed class constants are vaguely useful?

Here is a nice usage case that will definitely makes everyone love them.

#phptip #phptrick

https://php-tips.readthedocs.io/en/latest/tips/crazy_const_type.html

@dseguy Important feature!

We wouldn't want to confuse tooling with invalid type definitions, now would we:

<?php

if (random_int(0, 1)) {
class A {
const int|float X = 42;
}
} else {
class A {
const int|float X = 42.0;
}
}

var_dump(A::X);

/s