Skip to content

feat(php): map transparent proxies to real classes - #395

Closed
sidux wants to merge 11 commits into
PHPantom-dev:mainfrom
sidux:feat/php-transparent-proxy-metadata
Closed

sidux wants to merge 11 commits into
PHPantom-dev:mainfrom
sidux:feat/php-transparent-proxy-metadata

Conversation

@sidux

@sidux sidux commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Why

Generated runtime proxies often appear in configuration while their useful declarations live on the parent class. Navigating into cache artifacts is noisy, and treating proxy and real names as unrelated splits references and member metadata. The mapping must stay opt-in and generic because proxy layouts and marker contracts vary by package.

Summary

  • add configurable proxy paths and marker-interface rules
  • parse generated proxy metadata statically without loading or executing cache files
  • map resource navigation, class references, member references, and declaration lenses back to the real class
  • rebuild affected resource symbol maps when proxy configuration or generated files change

Dependency

Validation

  • cargo clippy --all-targets -- -D warnings
  • cargo test: 14,117 passed; 12 ignored

@codecov-commenter

codecov-commenter commented Aug 27, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 90.65421% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/proxy_metadata.rs 93.39% 21 Missing ⚠️
src/indexing/watch.rs 52.38% 10 Missing ⚠️
src/resource_navigation.rs 76.31% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

sidux added 7 commits August 30, 2026 17:12
Use the coarse reference index for conclusive zero counts and cache bounded exact member locations for non-zero lenses. Refresh-capable clients avoid eager resolve storms while older clients retain lazy resolution.
Stop reference counts and CodeLens resolves from repeating the full workspace walk for every declaration. Internal annotation requests share the initial index, including callers queued behind it, while an explicit Find References command keeps its single refresh for files created without watcher notifications.
@sidux
sidux force-pushed the feat/php-transparent-proxy-metadata branch from d1d9871 to 1ee7d8d Compare August 30, 2026 15:33
sidux added 3 commits August 30, 2026 17:40
Resolve fully-qualified classes and Class::member references from arbitrary YAML and XML positions without schema-specific rules.
Feed schema-free class and member occurrences into Find References and CodeLens, including transparent-proxy metadata aliases.
Discover opt-in generated subclasses by path and marker interface, then canonicalize external metadata without changing PHP type resolution.
@sidux
sidux force-pushed the feat/php-transparent-proxy-metadata branch from 1ee7d8d to 4b6ed79 Compare August 30, 2026 15:54
@AJenbo AJenbo added this to the Sprint 7 milestone Sep 8, 2026
The reference CodeLens and YAML/XML navigation this branch was built on
landed upstream (PHPantom-dev#392, PHPantom-dev#394), so this applies only the proxy change on
top of main.

- In YAML/XML a proxy name counts as a reference to its real class
  inside upstream's reworked class search.
- Proxy paths are recognised before the watcher's exclusion filter,
  since they usually live in ignored cache directories.
- Startup proxy indexing moved to backend/startup.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AJenbo

AJenbo commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Could you provide a sample setup where I can see how the code this acts on looks

@AJenbo AJenbo modified the milestones: Sprint 7, Sprint 7.5 Sep 28, 2026
@sidux

sidux commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

Good question. The intent was to handle generated proxies in general: ProxyManager (friendsofphp/proxy-manager-lts) subclasses such as the ones openclassrooms/service-proxy creates, and Doctrine's Proxies\__CG__ entities. The idea was that when metadata named the generated class, navigation and references would land on the real one.

Building the sample showed that nothing in the project actually names those classes. service-proxy keeps the real class on the service definition and creates the proxy at runtime through a factory, and Doctrine mappings always name the real entity. The generated names only exist at runtime.

What we really needed was the relation between those services and their events, and #402 covers that from the real classes: it reads the final wiring from the generated container, and the #[Event] / #[Listen] attributes through configurable rules in .phpantom.toml. So this mapping has nothing left to do, and I'll close this PR. Thanks for asking for a concrete case.

@sidux sidux closed this Sep 28, 2026
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.

3 participants