PHP - Manual: ReflectionFunctionAbstract::getTentativeReturnType
2024-11-14
(PHP 8 >= 8.1.0)
ReflectionFunctionAbstract::getTentativeReturnType — Returns the tentative return type associated with the function
Returns the tentative return type associated with the function.
此函数没有参数。
Returns a ReflectionType object if a tentative return type is
specified, null
otherwise.
示例 #1 ReflectionFunctionAbstract::getTentativeReturnType() example
<?php
$method = new ReflectionMethod(\ArrayAccess::class, 'offsetGet');
var_dump($method->getTentativeReturnType());
以上例程的输出类似于:
object(ReflectionNamedType)#2 (0) { }
官方地址:https://www.php.net/manual/en/reflectionfunctionabstract.gettentativereturntype.php