ReflectionFunctionAbstract::getTentativeReturnType
(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) { }
参见
- ReflectionFunctionAbstract::getReturnType() - Gets the specified return type of a function
- ReflectionFunctionAbstract::hasTentativeReturnType() - Returns whether the function has a tentative return type
- Return Type Compatibility with Internal Classes
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/reflectionfunctionabstract.gettentativereturntype.php