Dutch PHP Conference 2025 - Call For Papers

ReflectionFunctionAbstract::getTentativeReturnType

(PHP 8 >= 8.1.0)

ReflectionFunctionAbstract::getTentativeReturnTypeReturns the tentative return type associated with the function

Опис

public ReflectionFunctionAbstract::getTentativeReturnType(): ?ReflectionType

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

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top