Category
bootstrap | stdlib (tooling)
Problem
#155 ✅ shipped VM-side PSR-4 autoload parsing in phpc.json for phpc serve. #1762 tracks dynamic require $path discovery for phpc build --project.
There is no middle step: static class references (new Router(), type hints, Router::class) in the entry TU should expand the AOT link graph without hand-maintaining every file in includes[].
003-MiniWebApp today lists explicit includes[] in phpc.json — workable but brittle for larger apps and self-host bundles (#1492).
php-src reference
N/A (build-tooling). Behavioral reference: Composer PSR-4 autoload + static analysis patterns in php-src build scripts.
Repro (failure today)
examples/003-MiniWebApp/phpc.json lists ~15 explicit includes[] entries. Removing a class file from the list but keeping a new ThatClass() reference in public/index.php causes link/compile failure or missing symbol at AOT execute.
Minimal fixture (to add)
test/fixtures/aot/projects/psr4_static/
phpc.json
public/index.php # <?php use App\Greeter; echo (new Greeter())->hi();
src/Greeter.php # namespace App; class Greeter { public function hi(): string { return 'hi'; } }
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/compile.php --project test/fixtures/aot/projects/psr4_static -o /tmp/psr4_static 2>&1'
| Expected (after fix) |
Today |
/tmp/psr4_static runs, prints hi |
Graph missing src/Greeter.php unless manually in includes[] |
Scope (this repo)
| Layer |
Files |
Notes |
| Manifest |
lib/Web/ProjectManifest.php |
Reuse #155 PSR-4 prefix map |
| Graph BFS |
lib/AOT/ProjectGraph.php or AutoloadDiscovery.php |
Entry → static requires → referenced class names → PSR-4 paths |
| Compiler metadata |
lib/Compiler.php |
v1: syntactic scan for new Class, Class::, extends/implements |
| Lint |
bin/lint.php, phpc lint --project |
Actionable error for unresolved class → file |
| Link |
lib/AOT/Linker.php |
Multi-.o already works (#752) |
| Tests |
test/unit/ProjectGraphTest.php, fixture above |
|
| Docs |
docs/phpc-json.md |
Autoload discovery tier |
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter ProjectGraphTest'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/compile.php --project test/fixtures/aot/projects/psr4_static -o /tmp/psr4_static && /tmp/psr4_static'
Dependencies
Links
Category
bootstrap|stdlib(tooling)Problem
#155 ✅ shipped VM-side PSR-4 autoload parsing in
phpc.jsonforphpc serve. #1762 tracks dynamicrequire $pathdiscovery forphpc build --project.There is no middle step: static class references (
new Router(), type hints,Router::class) in the entry TU should expand the AOT link graph without hand-maintaining every file inincludes[].003-MiniWebApp today lists explicit
includes[]inphpc.json— workable but brittle for larger apps and self-host bundles (#1492).php-src reference
N/A (build-tooling). Behavioral reference: Composer PSR-4 autoload + static analysis patterns in
php-srcbuild scripts.Repro (failure today)
examples/003-MiniWebApp/phpc.jsonlists ~15 explicitincludes[]entries. Removing a class file from the list but keeping anew ThatClass()reference inpublic/index.phpcauses link/compile failure or missing symbol at AOT execute.Minimal fixture (to add)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/compile.php --project test/fixtures/aot/projects/psr4_static -o /tmp/psr4_static 2>&1'/tmp/psr4_staticruns, printshisrc/Greeter.phpunless manually inincludes[]Scope (this repo)
lib/Web/ProjectManifest.phplib/AOT/ProjectGraph.phporAutoloadDiscovery.phplib/Compiler.phpnew Class,Class::, extends/implementsbin/lint.php,phpc lint --projectlib/AOT/Linker.php.oalready works (#752)test/unit/ProjectGraphTest.php, fixture abovedocs/phpc-json.mdDone when
phpc build --project test/fixtures/aot/projects/psr4_static -o /tmp/applinks and/tmp/appprintshiphpc lint --projectreports missing PSR-4 target with class + expected pathincludes[]rows (follow-up PR, not blocking close)./script/ci-local.sh --filter ProjectGraphTestgreen (orci-fastsubset)require $vartier (out of scope here)Verification
Dependencies
Links
examples/003-MiniWebApp/phpc.json