- Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- foo: ?intbaz: ?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();
echo "baz: " . $foo->getReturnType();