Skip to content

Conversation

welcoMattic
Copy link
Owner

@welcoMattic welcoMattic commented May 2, 2025

Temporary PR used to track progress.

Main goal of this branch is to track every code location where translation keys can be used, explicitly, or implicitly (where Translator service is called from Symfony code side).

Please use this fork, pull a branch from translation/improve-php-ast-extractor, and open here a PR to this translation/improve-php-ast-extractor branch.

FormType

  • Handle FormType configureOptions parsing to determine the translation_domain or abort the extraction for the current FormType class
  • Handle FormType translation_domain for every options
  • Handle FormType label option
  • Handle FormType help option
  • Handle FormType placeholder option
  • Handle FormType choices option ?
  • Handle FormType empty_value option ?
  • Handle FormType invalid_message option ?
  • Handle FormType attr.title option ?
  • Handle FormEvent Listener (they can be used to add fields)
  • Handle standalone forms in controllers (createFormBuilder calls)

What about *_translation_parameters options? Can they be read to extract some metadata?

Flash messages

  • Handle flash message in controller $this->addFlash method call

Enum

  • Add Support BackedStringEnum

@jprivet-dev
Copy link
Collaborator

I'm on "Handle FormType empty_value option ?" item.

@Kazadri
Copy link

Kazadri commented May 6, 2025

I will test if it's already ok with BackedEnum (Fix it if not) and add test in any case

@welcoMattic welcoMattic force-pushed the translation/improve-php-ast-extractor branch from b4127b2 to 1733c40 Compare May 9, 2025 12:58
@Kazadri
Copy link

Kazadri commented May 12, 2025

I will tackle the translation domain !

welcoMattic pushed a commit that referenced this pull request May 28, 2025
…h()` (simoheinonen)

This PR was merged into the 5.4 branch.

Discussion
----------

[MonologBridge] Fix PHP deprecation with `preg_match()`

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

```
preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated
```

Commits
-------

4d7a6f6 Passing null to parameter #2 ($subject) of type string is deprecated
welcoMattic pushed a commit that referenced this pull request May 28, 2025
* 5.4:
  do not mix named and positional arguments in data provider definitions
  session names must not be empty
  fix Contracts directory name in PHPUnit configuration
  Passing null to parameter #2 ($subject) of type string is deprecated
welcoMattic pushed a commit that referenced this pull request May 28, 2025
… not throw exception (lyrixx)

This PR was merged into the 5.4 branch.

Discussion
----------

[HttpKernel] Ensure `HttpCache::getTraceKey()` does not throw exception

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

We have such logs in our logs. It's in our raw PHP logs. They are not caught by monolog, it's too early

```
[11-Oct-2024 01:23:33 UTC] PHP Fatal error:  Uncaught Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException: Invalid method override "__CONSTRUCT". in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php:1234
Stack trace:
#0 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(728): Symfony\Component\HttpFoundation\Request->getMethod()
#1 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(207): Symfony\Component\HttpKernel\HttpCache\HttpCache->getTraceKey()
#2 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/Kernel.php(188): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle()
#3 /var/www/redirection.io/backend/blue/web/app.php(9): Symfony\Component\HttpKernel\Kernel->handle()
#4 {main}
  thrown in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php on line 1234

```

I managed to reproduced locally.
* Before the patch, without the http_cache, symfony returns a 405
* After the patch, without the http_cache, symfony returns a 405
* Before the patch, with the http_cache, symfony returns a 500, without any information (too early)
* After the patch, with the http_cache, symfony returns a 405

Commits
-------

a2ebbe0 [HttpKernel] Ensure HttpCache::getTraceKey() does not throw exception
@welcoMattic welcoMattic force-pushed the translation/improve-php-ast-extractor branch from fc5e0ad to eea087f Compare June 20, 2025 13:05
@welcoMattic welcoMattic changed the base branch from 7.3 to 7.4 June 20, 2025 13:05
welcoMattic pushed a commit that referenced this pull request Aug 18, 2025
welcoMattic pushed a commit that referenced this pull request Aug 18, 2025
…m (soyuka, rvanlaak)

This PR was merged into the 7.3 branch.

Discussion
----------

[ObjectMapper] read source metadata before transform

| Q             | A
| ------------- | ---
| Branch?       | 7.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | fixes symfony#61027
| License       | MIT

Commits
-------

c1e4adf [ObjectMapper] do not require mapping a target's required promoted property when not on source (#2)
50e177d [ObjectMapper] read source metadata before transform
welcoMattic pushed a commit that referenced this pull request Aug 18, 2025
* 7.3:
  [ObjectMapper] do not require mapping a target's required promoted property when not on source (#2)
  [GitHub] Update .github/PULL_REQUEST_TEMPLATE.md to remove SF 7.2 as it's not supported anymore
  [WebProfilerBundle] Fix toolbar not rendering after replacing it
  Add friendly name in the `to` field
  [ObjectMapper] read source metadata before transform
  [HtmlSanitizer] Fix force_attributes not replacing existing attribute in initial data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants