- Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- foo: ?int
<?php
class A {
public function foo(): ?int
{ return 1; }
public function baz()
{ return 2; }
}
$foo = new ReflectionMethod((new A), "foo");
$baz = new ReflectionMethod((new A), "baz");
echo "foo: " . $foo->getReturnType();