Skip to content

[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

Merged
merged 1 commit into from
Oct 20, 2022

Conversation

welcoMattic
Copy link
Member

@welcoMattic welcoMattic commented Apr 25, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #44899, #42285, #45972, #45039
License MIT
Doc PR symfony/symfony-docs#17369

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:

@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch from 8d74433 to 68fb1ef Compare April 25, 2022 17:29
@welcoMattic
Copy link
Member Author

I've rewrite the first draft by inspiring from https://github.com/php-translation/extractor.

@OskarStark OskarStark changed the title [Translation] Add PhpAstExtractor [Translation] Add PhpAstExtractor Apr 25, 2022
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch 3 times, most recently from c0889ab to 9617446 Compare April 25, 2022 21:04
Copy link
Member

@nicolas-grekas nicolas-grekas left a 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 :)

@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch from 9617446 to 16d5c42 Compare April 26, 2022 07:51
@welcoMattic welcoMattic modified the milestones: 6.1, 6.2 Apr 26, 2022
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch 5 times, most recently from 4d6aa0a to c6d51fb Compare April 26, 2022 09:59
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch from c6d51fb to 3c9b1ef Compare April 26, 2022 12:58
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch 3 times, most recently from 4d28eb2 to 3ef1703 Compare September 26, 2022 09:14
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch 3 times, most recently from 0c6c5f0 to b0cc363 Compare October 19, 2022 08:49
Copy link
Member

@nicolas-grekas nicolas-grekas left a 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 ;)

@nicolas-grekas nicolas-grekas added the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Oct 19, 2022
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch from b0cc363 to 911caea Compare October 19, 2022 12:39
@welcoMattic welcoMattic requested a review from jderusse as a code owner October 19, 2022 12:39
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch 2 times, most recently from 7039d75 to c044b85 Compare October 19, 2022 12:45
@welcoMattic welcoMattic force-pushed the translation/php-ast-extractor branch from c044b85 to 5d4a81f Compare October 19, 2022 12:50
@fabpot
Copy link
Member

fabpot commented Oct 20, 2022

Thank you @welcoMattic.

@fabpot fabpot merged commit 38678dc into symfony:6.2 Oct 20, 2022
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Oct 20, 2022
…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
welcoMattic added a commit that referenced this pull request Oct 20, 2022
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
@fabpot fabpot mentioned this pull request Oct 24, 2022
@welcoMattic welcoMattic deleted the translation/php-ast-extractor branch October 24, 2022 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" Status: Reviewed Translation
Projects
None yet
7 participants