- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- false static
- Output for 7.4.0 - 7.4.33
- Parse error: syntax error, unexpected 'static' (T_STATIC) in /in/ZAqYK on line 6
Process exited with code 255.
<?php
namespace Test;
class Foo {
public function bar(): static {
return $this;
}
}
$class = new \ReflectionClass(Foo::class);
$method = $class->getMethod('bar');
var_export($method->getReturnType()->isBuiltin());
echo PHP_EOL;
echo $method->getReturnType()->getName();