3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { function poop (self $a): self { } } $refMethod = new ReflectionMethod('Foo', 'poop'); $refParam = $refMethod->getParameters()[0]; print_r(array( 'paramType' => $refParam->getType()->getName(), 'returnType' => $refMethod->getReturnType()->getName(), ));
Output for 8.2.31 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26
Array ( [paramType] => self [returnType] => self )
Output for 8.5.2 - 8.5.11
Array ( [paramType] => Foo [returnType] => Foo )

preferences:
36.69 ms | 1154 KiB | 9 Q