Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<ReflectionFunctionAbstract::getStaticVariablesReflectionFunctionAbstract::hasReturnType>
^ReflectionFunctionAbstractLast updated: Mon, 26 Oct 2026

ReflectionFunctionAbstract::getTentativeReturnType

(PHP 8 >= 8.1.0)

ReflectionFunctionAbstract::getTentativeReturnType — Returns the tentative return type associated with the function

Description

public function ReflectionFunctionAbstract::getTentativeReturnType(): ?ReflectionType

Returns the tentative return type associated with the function.

Parameters

This function has no parameters.

Return Values

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

Examples

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) {
}

See Also


<ReflectionFunctionAbstract::getStaticVariablesReflectionFunctionAbstract::hasReturnType>
^ReflectionFunctionAbstractLast updated: Mon, 26 Oct 2026