ReflectionNamedType クラス
(PHP 7 >= 7.1.0, PHP 8)
はじめに
クラス概要
/* メソッド */
/* 継承したメソッド */
}目次
- ReflectionNamedType::getName — 型の名前の文字列を取得する
- ReflectionNamedType::isBuiltin — 組み込みの型であるかを調べる
+add a note
User Contributed Notes 1 note
tuncdan dot ozdemir dot peng at gmail dot com ¶
10 months ago
Editor note: This behaviour is due to BC concerns with PHP 7, and will likely be fixed in PHP 9.
2024-02-14
PHP 8.3
interface AnyType {}
interface Type2 {}
function test (AnyType|null $param) {}
The ReflectionParameter will return ReflectionNamedType, NOT ReflectionUnionType (null is ignored basically).
However, function test (AnyType|Type2|null $param) {}
will return ReflectionUnionType with 3 types, NOT 2 (null is not ignored this time).
To me, this is just wrong and logical error in PHP.
↑ and ↓ to navigate •
Enter to select •
Esc to close
Press Enter without
selection to search using Google