DevEx: PSR-4 static class discovery for AOT project build (#1803)#3744
Merged
Conversation
Expand the AOT project graph by scanning entry/includes for class references and resolving them through phpc.json autoload.psr-4, so projects no longer need hand-maintained includes[] for every PSR-4 class file. Co-authored-by: Cursor <cursoragent@cursor.com>
1a0da85 to
48a980b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AutoloadDiscovery+StaticClassReferenceScannerto walk PHPCfg for compile-time class references (new, static calls,::class, extends/implements) and resolve them viaphpc.jsonautoload.psr-4.ProjectGraph::resolve()sophpc build --project/--dry-runincludes PSR-4 class files without listing every path inincludes[].phpc lint --projectsurfaces unresolved PSR-4 targets with class name + expected path.test/fixtures/aot/projects/psr4_static/(entry usesApp\Greeter, noincludes[]).Lane note
No eligible Lane A language issues were open without an existing PR (#3114 has PR #3152; #3540 is invalid PHP syntax). Claimed #1803 (Lane A,
MOST IMPORTANT, AOT/DevEx).php-src reference
N/A — build-tooling (Composer PSR-4 autoload pattern).
Test plan
vendor/bin/phpunit --filter ProjectGraphTestphpc build --project --dry-run test/fixtures/aot/projects/psr4_static→src/Greeter.php,public/index.phpphp bin/compile.php --project test/fixtures/aot/projects/psr4_static -o /tmp/psr4_static && /tmp/psr4_staticCloses #1803
Made with Cursor