Skip to content

DevEx: PSR-4 static class discovery for AOT project build (#1803)#3744

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-1803-psr4-static-discovery
May 30, 2026
Merged

DevEx: PSR-4 static class discovery for AOT project build (#1803)#3744
PurHur merged 1 commit into
masterfrom
agent/issue-1803-psr4-static-discovery

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 30, 2026

Summary

  • Add AutoloadDiscovery + StaticClassReferenceScanner to walk PHPCfg for compile-time class references (new, static calls, ::class, extends/implements) and resolve them via phpc.json autoload.psr-4.
  • Integrate into ProjectGraph::resolve() so phpc build --project / --dry-run includes PSR-4 class files without listing every path in includes[].
  • phpc lint --project surfaces unresolved PSR-4 targets with class name + expected path.
  • Fixture: test/fixtures/aot/projects/psr4_static/ (entry uses App\Greeter, no includes[]).

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 ProjectGraphTest
  • phpc build --project --dry-run test/fixtures/aot/projects/psr4_staticsrc/Greeter.php, public/index.php
  • Full AOT link on fixture (LLVM): php bin/compile.php --project test/fixtures/aot/projects/psr4_static -o /tmp/psr4_static && /tmp/psr4_static

Closes #1803

Made with Cursor

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>
@PurHur PurHur force-pushed the agent/issue-1803-psr4-static-discovery branch from 1a0da85 to 48a980b Compare May 30, 2026 11:07
@PurHur PurHur merged commit 927165a into master May 30, 2026
@PurHur PurHur deleted the agent/issue-1803-psr4-static-discovery branch May 30, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DevEx: phpc.json autoload phase 2 — static class discovery for AOT project build

1 participant