PHP 8.4.0 RC4 available for testing

ReflectionType sınıfı

(PHP 7, PHP 8)

Giriş

ReflectionType sınıfı bir işlevin bağımsız değişken/dönüş türü veya bir sınıfın özellik türü hakkında bilgi sağlar. Eklentide şu alt türler bildirilmiştir:

Sınıf Sözdizimi

abstract class ReflectionType implements Stringable {
/* Yöntemler */
public allowsNull(): bool
public __toString(): string
}

Sürüm Bilgisi

Sürüm: Açıklama
8.0.0 ReflectionType soyut duruma geldi ve ReflectionType::isBuiltin() ise ReflectionNamedType::isBuiltin() oldu.

İçindekiler

add a note

User Contributed Notes 4 notes

up
42
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
15
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