class Base { public static function id(): string { return 'base'; } }
class Child extends Base {
public static function chain(): string {
return static::id(); // must be 'child' when called as Child::chain()
}
}
VM called-class resolution (#1231) → JIT lowering → #1858 parent:: parity → self-host spine units
No GitHub Actions.
Summary
Resolve
static::to the called class (late static binding) in inheritance hierarchies — including return-value chains wherestatic::foo()propagates through nested calls.Context
docs/unsupported-syntax.mdanddocs/capabilities-syntax.mdlist LSB as partial.parent::/static::static dispatch).parent::may land separately; return chain throughstatic::still fails on master.Problem
Today: VM may resolve
static::at compile time to the declaring class, or JIT skips with stub policy.Implementation hints
lib/Compiler.phpClass_::SCOPE_STATIConStaticCall— bind called class from runtime receiverlib/VM.phpresolveStaticCall($calledClass, $method)usingget_called_class()semanticsstatic::in return position does not constant-fold to declaring classlib/JIT.php,lib/JIT/Builtin/SelfHostBuiltinPolicy— stub or deopt until VM greentest/compliance/cases/language/late_static_binding*.phptstatic::class(#740 ✅ closed)test/selfhost/lib/Search before coding
Unblock order
Acceptance criteria
Child::chain()returns'child'in VM (./script/ci-fast.sh --filter LateStatic)return static::…()in web-safe fixtures passes compliance PHPT@group llvmsubsetphp script/capability-syntax.phprow updatedVerification (local / Docker only)
./script/ci-fast.sh --filter LateStatic docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \ ./script/ci-fast.sh --filter LateStaticNo GitHub Actions.
Dependencies
parent::static dispatch (parallel)static::class(do not conflate)Links