Category
stdlib | language
Problem
Zend exposes an abstract ReflectionType base class; ReflectionNamedType, ReflectionUnionType, and ReflectionIntersectionType extend it. This compiler registers the concrete type classes in lib/VM/BuiltinClasses.php but does not register ReflectionType itself, so:
class_exists('ReflectionType') is false
is_subclass_of('ReflectionNamedType', 'ReflectionType') is false
instanceof ReflectionType checks in user/framework code fail
php-src reference
Repro (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "class T{function f(): int{}} \$m=new ReflectionMethod(T::class,\"f\"); \$t=\$m->getReturnType(); echo get_class(\$t),\" parent=\",get_parent_class(\$t),\" instanceof=\",var_export(\$t instanceof ReflectionType,true);"
php -r "class T{function f(): int{}} \$m=new ReflectionMethod(T::class,\"f\"); \$t=\$m->getReturnType(); echo get_class(\$t),\" parent=\",get_parent_class(\$t),\" instanceof=\",var_export(\$t instanceof ReflectionType,true);"
'
| Check |
Zend PHP 8.2 |
bin/vm.php (2026-06-06) |
class_exists('ReflectionType') |
true |
false |
get_parent_class($namedType) |
ReflectionType |
false |
$namedType instanceof ReflectionType |
true |
false |
Note: ReflectionMethod::getReturnType() is also missing here — tracked in #6597 (this issue is the type hierarchy slice). Pair with #5141 (hasReturnType) and #4650 (union/intersection getTypes()).
Scope (this repo)
| Component |
Path |
| Abstract class registration |
lib/VM/BuiltinClasses.php, lib/VM/ReflectionTypeSupport.php |
| Parent links |
Set ReflectionNamedType / union / intersection parent to ReflectionType |
| Shared methods |
allowsNull(), __toString() already on concrete classes — hoist to abstract base metadata |
Implement in lib/VM/ + reflection builtins; no new C runtime.
Done when
class_exists('ReflectionType') is true; concrete reflection type classes report parent ReflectionType
is_subclass_of('ReflectionNamedType', 'ReflectionType') and instanceof ReflectionType succeed on VM
- Compliance:
test/compliance/cases/stdlib/reflection_type_hierarchy.phpt matches Zend
- Does not regress existing reflection PHPTs
Strictness: php-src-strict
Category
stdlib|languageProblem
Zend exposes an abstract
ReflectionTypebase class;ReflectionNamedType,ReflectionUnionType, andReflectionIntersectionTypeextend it. This compiler registers the concrete type classes inlib/VM/BuiltinClasses.phpbut does not registerReflectionTypeitself, so:class_exists('ReflectionType')is falseis_subclass_of('ReflectionNamedType', 'ReflectionType')is falseinstanceof ReflectionTypechecks in user/framework code failphp-src reference
ext/reflection/php_reflection.c—register_reflection_type,ReflectionTypeabstract classext/reflection/php_reflection.stub.phpRepro (failure today)
bin/vm.php(2026-06-06)class_exists('ReflectionType')truefalseget_parent_class($namedType)ReflectionTypefalse$namedType instanceof ReflectionTypetruefalseNote:
ReflectionMethod::getReturnType()is also missing here — tracked in #6597 (this issue is the type hierarchy slice). Pair with #5141 (hasReturnType) and #4650 (union/intersectiongetTypes()).Scope (this repo)
lib/VM/BuiltinClasses.php,lib/VM/ReflectionTypeSupport.phpReflectionNamedType/ union / intersection parent toReflectionTypeallowsNull(),__toString()already on concrete classes — hoist to abstract base metadataImplement in
lib/VM/+ reflection builtins; no new C runtime.Done when
class_exists('ReflectionType')is true; concrete reflection type classes report parentReflectionTypeis_subclass_of('ReflectionNamedType', 'ReflectionType')andinstanceof ReflectionTypesucceed on VMtest/compliance/cases/stdlib/reflection_type_hierarchy.phptmatches ZendStrictness: php-src-strict