The ReflectionType class

(PHP 7)

소개

The ReflectionType class reports information about a function's return type.

클래스 개요

ReflectionType {
/* 메소드 */
public bool allowsNull ( void )
public bool isBuiltin ( void )
public string __toString ( void )
}

Table of Contents

add a note add a note

User Contributed Notes 4 notes

up
37
1franck
4 years ago
For those who stumble on notice about ReflectionType::__toString() beeing deprecated, use method ReflectionType::getName() instead which is not yet documented.
up
14
Ondej Mirtes
4 years ago
Method ReflectionType::getName() does not exist. This may have been virtually true in the past but not anymore. It exists on ReflectionNamedType which used to be the only child class of ReflectionType. So you could have kind of relied on that.

But in PHP 8 there's also ReflectionUnionType which doesn't have the getName() method. So in order to support PHP 8, you need to support both ReflectionNamedType and ReflectionUnionType.
up
2
benjamin dot morel at gmail dot com
4 years ago
Known subclasses:

- ReflectionNamedType
- ReflectionUnionType
up
1
roland at mxchange dot org
4 years ago
I guess it is <?php ReflectionNamedType::getName(); ?> ?
To Top