php8.5
Home/ Manual/ reflection / reflectionfunctionabstract/ ReflectionFunctionAbstract::getTentativeReturnType

ReflectionFunctionAbstract::getTentativeReturnType

PHP function Edit on GitHub ✎

(PHP 8 >= 8.1.0)

Returns the tentative return type associated with the function

Description

ReflectionFunctionAbstract::getTentativeReturnType(): ReflectionType|null

Returns the tentative return type associated with the function.

Parameters Parameters

Return Values

Returns a ReflectionType object if a tentative return type is specified, null otherwise.

Examples

ReflectionFunctionAbstract::getTentativeReturnType example

php
<?php

$method = new ReflectionMethod(\ArrayAccess::class, 'offsetGet');
var_dump($method->getTentativeReturnType());

The above example will output something similar to:

output
object(ReflectionNamedType)#2 (0) {
}

See Also

Source: reference/reflection/reflectionfunctionabstract/gettentativereturntype.xml · from the official PHP manual (php/doc-en)