3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Accessor { public static function int():int { var_dump(new ReflectionEnum(self::class)); } } enum Titular: int { use Accessor; case minimus=1; case maximus=2; } echo Titular::minimus::int();
Output for 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
object(ReflectionEnum)#3 (1) { ["name"]=> string(7) "Titular" } Fatal error: Uncaught TypeError: Titular::int(): Return value must be of type int, none returned in /in/S09UY:8 Stack trace: #0 /in/S09UY(18): Titular::int() #1 {main} thrown in /in/S09UY on line 8
Process exited with code 255.
Output for 8.1.0 - 8.1.31
object(ReflectionEnum)#2 (1) { ["name"]=> string(7) "Titular" } Fatal error: Uncaught TypeError: Titular::int(): Return value must be of type int, none returned in /in/S09UY:8 Stack trace: #0 /in/S09UY(18): Titular::int() #1 {main} thrown in /in/S09UY on line 8
Process exited with code 255.

preferences:
46.98 ms | 407 KiB | 5 Q