I just ran this in php 7.4 and php 8.2, and there is different behavior.
In 7.4, if $coolness is not set to anything before this code snippet is run, there are warnings but "You are cool" is printed. If $coolness is set, the same warning about COOL_MODE is thrown as is thrown when $coolness is not set, but again "You are cool" is printed no matter what $coolness is set to. Very weird.
The same happens, without warning, if you use 'COOL_MODE' in that check (with quotes, which is what the warning leads you to try). The problem seems to be that when you define COOL_MODE to true it's set to 1 (!). So you really want to check COOL_MODE against 1, not true, in that second if. However, you don't want to use 'COOL_MODE' with quotes--that doesn't work!
This is such a bizarre combination of errors and behaviors 🤯
8.2 behaves a little more gracefully. If $coolness is not set, there's a warning about that. Then there's also an error that COOL_MODE is undefined. Both seem useful. If $coolness is set, but not > 10, then an error is thrown that COOL_MODE is undefined, which also seems useful. The snippet works as expected if $coolness is set and is greater than 10, even with the check against true in the second if.