-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translation] Add PhpAstExtractor
#46161
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
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/PhpAstExtractor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/PhpAstExtractor.php
Outdated
Show resolved
Hide resolved
8d74433
to
68fb1ef
Compare
I've rewrite the first draft by inspiring from https://github.com/php-translation/extractor. |
PhpAstExtractor
c0889ab
to
9617446
Compare
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.
here are some random nodes :)
src/Symfony/Component/Translation/Extractor/PhpAstExtractor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/PhpAstExtractor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/AbstractVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/AbstractVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/AbstractVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/TranslatableMessageVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/ConstraintVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/TranslatableMessageVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/TranslatableMessageVisitor.php
Outdated
Show resolved
Hide resolved
9617446
to
16d5c42
Compare
4d6aa0a
to
c6d51fb
Compare
src/Symfony/Component/Translation/Extractor/PhpAstExtractor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/TransMethodVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/Visitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Tests/Extractor/PhpAstExtractorTest.php
Outdated
Show resolved
Hide resolved
c6d51fb
to
3c9b1ef
Compare
4d28eb2
to
3ef1703
Compare
0c6c5f0
to
b0cc363
Compare
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.
Missing update to UPGRADE-6.2.md ;)
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/Extractor/Visitor/AbstractVisitor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Translation/DependencyInjection/TranslatorPass.php
Outdated
Show resolved
Hide resolved
b0cc363
to
911caea
Compare
7039d75
to
c044b85
Compare
c044b85
to
5d4a81f
Compare
Thank you @welcoMattic. |
…welcoMattic) This PR was merged into the 6.2 branch. Discussion ---------- [Translation] Add new cases covered by PhpAstExtractor In symfony/symfony#46161, we rewrite the PHP Translation extractor. It covers more cases, like named arguments. Documentation needed to be updated consequently. Commits ------- 5029cb2 Add new cases covered by PhpAstExtractor
This PR was merged into the 6.2 branch. Discussion ---------- [Translation] Deprecate PhpStringTokenParser | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | | License | MIT | Doc PR | Following #46161, we could deprecate PhpStringTokenParser, as it's only used by PhpExtractor (which is now deprecated). Commits ------- d415129 Deprecate PhpStringTokenParser
After discussions with @stof and @nicolas-grekas at SymfonyLive Paris 2022, it appears clear that we need a brand new PhpExtractor in Translation to support various syntax, especially PHP8 new syntax (named arguments for example).
In order to make this new extractor sustainable, performant and maintainable, it must be based on AST. That's why this PR adds a new optional dependency on nikic/php-parser.
The tests suite is the same as PhpExtractorTest, in addition to new cases for newly supported syntax.
NB: I was inspired by https://github.com/php-translation/extractor design, with adaptations for Symfony.
To-do: