Dutch PHP Conference 2021 - Call for Papers

ReflectionType クラス

(PHP 7)

はじめに

ReflectionType クラスは、 関数の戻り値の型に関する情報を報告します

クラス概要

abstract ReflectionType {
/* メソッド */
public allowsNull ( ) : bool
public __toString ( ) : string
}

変更履歴

バージョン 説明
8.0.0 ReflectionType は、抽象クラスになり、 ReflectionType::isBuiltin() は、 ReflectionNamedType::isBuiltin() に移動しました。

目次

add a note add a note

User Contributed Notes 4 notes

up
27
1franck
11 months ago
For those who stumble on notice about ReflectionType::__toString() beeing deprecated, use method ReflectionType::getName() instead which is not yet documented.
up
9
Ondej Mirtes
3 months 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
roland at mxchange dot org
10 months ago
I guess it is <?php ReflectionNamedType::getName(); ?> ?
up
1
benjamin dot morel at gmail dot com
4 months ago
Known subclasses:

- ReflectionNamedType
- ReflectionUnionType
To Top