Problem
examples/003-MiniWebApp/src/Router.php declares:
private array $config;
public function __construct(array $config) { $this->config = $config; }
#169 tracks full PHP 8+ type features (unions, readonly, promotion). The reference app only needs simple typed properties on classes already supported by #58 / #145.
Without property type declarations, lint may accept untyped properties while runtime/JIT mis-handle typed slots.
Goal
VM + JIT + AOT support for typed properties with built-in types (array, string, int, bool) on class instances — no unions/readonly in v1.
Implementation hints
| Area |
Files |
Notes |
| Compiler |
lib/Compiler.php compileClassBody |
Read Property::type from php-cfg |
| VM object layout |
lib/VM/ object storage |
Store with type tag or validate on write |
| JIT |
lib/JIT/Builtin/Type/Object_.php |
Property offsets + type checks |
| Lint |
UnsupportedRegistry |
Map until implemented |
Acceptance criteria
docker run --rm -v "$(pwd):/compiler" -w /compiler php-compiler:22.04-dev \
php bin/vm.php -r 'class R{private array \$c; public function __construct(array \$c){\$this->c=\$c;} public function g(): int {return count(\$this->c);}} echo (new R([1]))->g();'
Prints 1. MiniWebApp Router compiles after #58 methods land.
Verification
./script/ci-local.sh --filter typed_propert
Dependencies
Links
Problem
examples/003-MiniWebApp/src/Router.phpdeclares:#169 tracks full PHP 8+ type features (unions, readonly, promotion). The reference app only needs simple typed properties on classes already supported by #58 / #145.
Without property type declarations, lint may accept untyped properties while runtime/JIT mis-handle typed slots.
Goal
VM + JIT + AOT support for typed properties with built-in types (
array,string,int,bool) on class instances — no unions/readonly in v1.Implementation hints
lib/Compiler.phpcompileClassBodyProperty::typefrom php-cfglib/VM/object storagelib/JIT/Builtin/Type/Object_.phpUnsupportedRegistryAcceptance criteria
Prints
1. MiniWebAppRoutercompiles after #58 methods land.Verification
Dependencies
Links
examples/003-MiniWebApp/src/Router.php