(PHP 8 >= 8.1.0)
ReflectionFunctionAbstract::getTentativeReturnType — Returns the tentative return type associated with the function
public ReflectionFunctionAbstract::getTentativeReturnType(): ?ReflectionType
Returns the tentative return type associated with the function.
This function has no parameters.
Returns a ReflectionType object if a tentative return type is specified, null otherwise.
Example #1 ReflectionFunctionAbstract::getTentativeReturnType() example
<?php $method = new ReflectionMethod(\ArrayAccess::class, 'offsetGet'); var_dump($method->getTentativeReturnType());
The above example will output something similar to:
object(ReflectionNamedType)#2 (0) {
}
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/reflectionfunctionabstract.gettentativereturntype.php