Skip to content

[Translation] Rework PhpAstExtractor tests organization for future improvements #60854

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

Open
wants to merge 8 commits into
base: 7.4
Choose a base branch
from

Conversation

welcoMattic
Copy link
Member

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? no
Issues Fix #...
License MIT

This PR is the first in a series that tend to improve PhpAstExtractor (covering more extractions cases, ease test writting for new cases, etc).

I've worked with @Jean-Beru, @Kazadri and @jprivet-dev in the past few weeks on various new cases to increase the number of "locations" from where the extractor can extract translation keys.

As we were working on my own Symfony fork, I'm opening the PR.
But to be honest my colleague @Jean-Beru did the large majority of the work here. Thanks to him 👏!

To avoid a big PR containing multiple new small features, we need to open and hopefully merge this one first to ease the tests writting for next new Visitors.


NB: I'm not sure to qualify or not this PR as New feature?

@carsonbot carsonbot added this to the 7.4 milestone Jun 20, 2025
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor-tests-rework branch 2 times, most recently from 19b3d28 to 2ed841f Compare June 20, 2025 14:11
@@ -0,0 +1,47 @@
This template is used for translation message extraction tests
<?php new TranslatableMessage('translatable single-quoted key'); ?>
Copy link
Member

Choose a reason for hiding this comment

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

isn't this missing a use statement ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed. Also TransMethodVisitor has be updated to check the full classname.

@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor-tests-rework branch from 2ed841f to 23ead95 Compare June 20, 2025 14:38
@OskarStark OskarStark changed the title [Translation] Rework PhpAstExtractor tests organization for future improvements [Translation] Rework PhpAstExtractor tests organization for future improvements Jun 23, 2025
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