Skip to content

[ObjectMapper] Remove deprecated LazyGhostTrait test #61191

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

Conversation

santysisi
Copy link
Contributor

@santysisi santysisi commented Jul 21, 2025

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

This PR removes the testMapInitializesLazyObject test, which relies on the LazyFoo fixture that uses the LazyGhostTrait. This trait has been deprecated since Symfony 7.3( and removed in this version ), and it's now recommended to use native PHP lazy objects instead.

The behavior previously tested by testMapInitializesLazyObject is already covered by testMapInitializesNativePhp84LazyObject, using native PHP methods. Therefore, maintaining both tests is redundant.

Additionally, the removed test is currently failing in the 8.0 branch pipelines, due to incompatibility with the deprecated LazyGhostTrait ( since this trait was removed in this branch)

@santysisi santysisi force-pushed the fix/remove-test-testMapInitializesLazyObject branch from d885541 to 200b231 Compare July 21, 2025 22:27
@@ -371,14 +370,6 @@ public static function objectMapperProvider(): iterable
yield [new ObjectMapper(new ReflectionObjectMapperMetadataFactory(), PropertyAccess::createPropertyAccessor())];
}

public function testMapInitializesLazyObject()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we need to rewrite the test instead to not use the LazyGhostTrait. The code that is tested by this method is still present: https://github.com/symfony/symfony/blob/8.0/src/Symfony/Component/ObjectMapper/ObjectMapper.php#L320-L321

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LazyObjectInterface is still used by interface-based proxies. That's likely what we need also on lower branches since it should allow writing code that'll work with all version. ProxyHelper::generateLazyProxy(null, [SomeInterace::class])

@nicolas-grekas
Copy link
Member

See #61197 instead. Thanks for proposing.

nicolas-grekas added a commit that referenced this pull request Jul 22, 2025
…as-grekas)

This PR was merged into the 7.3 branch.

Discussion
----------

[ObjectMapper] Fix test using LazyObjectInterface

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

Instead of #61191 and #61192

Commits
-------

168b3a3 [ObjectMapper] Fix test using LazyObjectInterface
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.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy