Skip to content

[VarExporter] Leverage native lazy objects #59890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2025

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Mar 2, 2025

Q A
Branch? 7.3
Bug fix? no
New feature? yes
Deprecations? no
Issues -
License MIT

Let's leverage native lazy objects.

Instead of keeping/updating LazyGhostTrait and LazyProxyTrait, I'm deprecating them in favor of using native lazy proxies directly.

There is one use case that is not covered by native lazy objects: lazy decorators - aka lazy proxies built against an interface or an internal class. For this use case, we keep ProxyHelper::generateLazyProxy().

@carsonbot carsonbot added this to the 7.3 milestone Mar 2, 2025
@nicolas-grekas nicolas-grekas force-pushed the ve-native-lazy-objects branch 2 times, most recently from ae65a7a to 3b27972 Compare March 3, 2025 09:45
@nicolas-grekas nicolas-grekas force-pushed the ve-native-lazy-objects branch 2 times, most recently from 0bbd405 to 7badfb5 Compare March 14, 2025 16:44
@nicolas-grekas

This comment was marked as outdated.

@nicolas-grekas nicolas-grekas force-pushed the ve-native-lazy-objects branch 2 times, most recently from 9852544 to 1d14933 Compare March 15, 2025 13:04
nicolas-grekas added a commit that referenced this pull request Mar 15, 2025
This PR was merged into the 7.3 branch.

Discussion
----------

Various cleanups

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Found while working on #59890

Commits
-------

18390f1 Various cleanups
@nicolas-grekas nicolas-grekas force-pushed the ve-native-lazy-objects branch from 1d14933 to aaf3d4a Compare March 15, 2025 13:25
@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Mar 15, 2025

Self-review:

Status: needs work

@stof
Copy link
Member

stof commented Mar 17, 2025

Be careful. Doctrine ORM 2.x is not EOL yet and it already supports using var-exporter (but will probably not receive a backport of the support for native lazy objects). This might impact the deprecation plan.

@nicolas-grekas nicolas-grekas force-pushed the ve-native-lazy-objects branch 4 times, most recently from 6b9b1fd to e382b2f Compare March 21, 2025 15:56
@nicolas-grekas
Copy link
Member Author

Doctrine ORM 2.x is not EOL yet and it already supports using var-exporter (but will probably not receive a backport of the support for native lazy objects). This might impact the deprecation plan.

I don't think this should impact us: ppl have a way to fix the deprecation: upgrade. The day where 2.x will be EOLed is close anyway.

After many error-n-trial, I just pushed what I think is the implementation that works. First I thought we could use hooks to proxy all properties, but it happens those are not really compatible with references, so that we have to keep using magic accessors to proxy them.

Status: needs review

@nicolas-grekas nicolas-grekas force-pushed the ve-native-lazy-objects branch from 3c5d516 to a00855a Compare March 22, 2025 17:11
@nicolas-grekas nicolas-grekas merged commit 4bcf132 into symfony:7.3 Mar 22, 2025
7 of 10 checks passed
@nicolas-grekas nicolas-grekas deleted the ve-native-lazy-objects branch March 22, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants