PHP 8.5.0 Beta 3 available for testing

ReflectionType クナ゚

(PHP 7, PHP 8)

はじめãĢ

ReflectionType クナ゚は、 é–ĸ数ぎåŧ•æ•°ã‚„æˆģり値ぎ型、 ãžãŸã¯ã‚¯ãƒŠã‚šãŽãƒ—ãƒ­ãƒ‘ãƒ†ã‚ŖãŽåž‹ãĢé–ĸã™ã‚‹æƒ…å ąã‚’å ąå‘Šã—ãžã™ã€‚ ãƒĒフãƒŦã‚¯ã‚ˇãƒ§ãƒŗæ‹ĄåŧĩãƒĸジãƒĨãƒŧãƒĢでは、äģĨ下ぎã‚ĩãƒ–ã‚¯ãƒŠã‚šãŒåŽŖč¨€ã•ã‚ŒãĻいぞす。

クナ゚æĻ‚čρ

abstract class ReflectionType implements Stringable {
/* ãƒĄã‚Ŋッド */
public allowsNull(): bool
public __toString(): string
}

変更åąĨæ­´

バãƒŧã‚¸ãƒ§ãƒŗ čĒŦ明
8.0.0 ReflectionType は、æŠŊčąĄã‚¯ãƒŠã‚šãĢãĒり、 ReflectionType::isBuiltin() は、 ReflectionNamedType::isBuiltin() ãĢį§ģ動しぞした。

į›ŽæŦĄ

īŧ‹add a note

User Contributed Notes 2 notes

up
43
1franck Âļ
5 years ago
For those who stumble on notice about ReflectionType::__toString() beeing deprecated, use method ReflectionNamedType::getName() instead which is not yet documented.
up
16
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.
To Top