-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add support for PHP 8.4 Lazy Objects RFC with configuration flag #11853
Conversation
… expensive and could lead to errors. Adjust lifecycle test that uses transient properittes for assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, so happy it works this seamlessly :)
I agree with @GromNaN : the term proxy is now inaccurate; this uses the ghost strategy, no proxy is involved.
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
…t required anymore with native lazy objects.
@jaapio the docs build suddenly fails, what should we do? |
You need to update phpDocumentor/filesystem. As this is an unexpected breaking change. But it's fixed when you update the package. |
I made doctrine/.github#60 from my phone 📱 |
A rebase should fix the build. |
@@ -71,9 +76,26 @@ Configuration Options | |||
The following sections describe all the configuration options | |||
available on a ``Doctrine\ORM\Configuration`` instance. | |||
|
|||
Native Lazy Objects (***OPTIONAL***) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The triple stars are bizarre and render bizarrely, I'm going to file a PR against 2.x to fix that.
EDIT: #11885
The build should be fixed with #11884 |
Co-authored-by: Grégoire Paris <postmaster@greg0ire.fr>
…o ReflectionLazyGhost-3.4.x
Proxy Directory (***REQUIRED***) | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This setting is not required if you use native lazy objects with PHP 8.4 | ||
and will be removed in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proposition if you remove the REQUIRED from the title.
Proxy Directory (***REQUIRED***) | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
This setting is not required if you use native lazy objects with PHP 8.4 | |
and will be removed in the future. | |
Proxy Directory | |
~~~~~~~~~~~~~~~ | |
Required except if you use native lazy objects with PHP 8.4. | |
This setting will be removed in the future. |
Nice job, btw, is the 3.4 release somewhat dependent on merging of this PR? Because I have also PR that I want to be in 3.4 as optional and 4.0 as default #11814 (php nullability inheritance) but it didn't get a review in 2 months, so I'm wondering if someone could take a look so it can also get to next version. //edit: @greg0ire thanks for review! |
… < 8.4 (xabbuh) This PR was merged into the 6.4 branch. Discussion ---------- [DoctrineBridge] fix tests with Doctrine ORM 3.4+ on PHP < 8.4 | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT The solution implemented in #59887 does no longer work on PHP < 8.4 with the changes made in doctrine/orm#11853. Commits ------- 9be0d0a fix tests with Doctrine ORM 3.4+ on PHP < 8.4
This PR was merged into the 7.3 branch. Discussion ---------- [DoctrineBridge] Adjust non-legacy tests | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT These should be unneeded since doctrine/orm#11853 Commits ------- 682f453 [DoctrineBridge] Adjust non-legacy tests
Our goal is that we can completely replace all kinds of code for proxy generation and proxy usage with the new lazy objects feature of PHP 8.4: https://wiki.php.net/rfc/lazy-objects
In 3.4.x we can add support for optionally using lazy objects, and in 4.x we increase the requirement for PHP to 8.4 and automatically always use lazy objects.
The benefit of lazy objects is that we don't need code-generation anymore, and that it also allows us to treat partial objects as lazy objects that can load their missing properties only when accessed.
See #11659 for prerequisites of using new Reflection APIs.
Use:
To run tests with this
ENABLE_NATIVE_LAZY_OBJECTS=1 php vendor/bin/phpunit
.