This PR was merged into the 5.1 branch.
Discussion
----------
[Validator] Fix PhpUnitBridge version constraint
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | N/A
This PR allows Validator 5.1 and PhpUnitBridge 5.1 to be installed alongside each other.
Commits
-------
1055a7f29b [Validator] Fix PhpUnitBridge version constraint.
This PR was squashed before being merged into the 5.1 branch.
Discussion
----------
Fix symfony/amazon-mailer constraint
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#38000
| License | MIT
| Doc PR |
See #38000
~~symfony/valdiator left - I need to understand why~~
Commits
-------
15643642a3 Fix symfony/amazon-mailer constraint
This PR was merged into the 5.2-dev branch.
Discussion
----------
Remove unneeded code
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | n/a<!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | n/a
Commits
-------
5ed8ebe50e Remove unneeded code
This PR was merged into the 5.2-dev branch.
Discussion
----------
[PropertyAccess] fix the deprecation message
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
a9cbac77eb fix the deprecation message
* 5.1:
Fix CS
[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
[FrameworkBundle] Do not pass the base uri twice to scoped http clients
* 4.4:
Fix CS
[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
[FrameworkBundle] Do not pass the base uri twice to scoped http clients
This PR was merged into the 5.2-dev branch.
Discussion
----------
[Workflow] Expose the Metadata Store in the DIC
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix#37955
| License | MIT
| Doc PR |
I did not updated the CHANGELOG, because IMHO it not worth it
Commits
-------
aa7a444c86 [Workflow] Expose the Metadata Store in the DIC
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[Translation] Add support for calling 'trans' with ICU formatted messages
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | maybe, see https://github.com/symfony/symfony/issues/37228
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#37228
| License | MIT
| Doc PR | symfony/symfony-docs#13875
Motivation:
```
$apples = [0 => 'No apples', 1 => '1 apple', '# apples'];
echo _m($apples, ['count' => 0]); // Outputs 'No apples'
echo _m($apples, ['count' => 2]); // Outputs '2 apples'
```
where `_m` is a wrapper my application is using, but we obviously don't want to replicate many of the effort of the translation component, so it relies on `trans`.
This wrapper itself could be integrated into Symfony, if deemed appropriate.
See #37228
Commits
-------
d2ec41f4ef [Translation] Add support for calling 'trans' with ICU formatted messages
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
The current message is `TypeError: Argument 4 passed to Symfony\Component\HttpClient\Response\MockResponse::fromRequest() must implement interface Symfony\Contracts\HttpClient\ResponseInterface, instance of Generator given`.
I lost some time with this because I was passing a callable that returns a \Generator instead of passing the resulting \Generator directly. We could support that case but I guess with the added exception message, it is clear we don't support it at all.
Commits
-------
564dce39f8 [HttpClient][MockHttpClient][DX] Throw when the response factory callable does not return a valid response
This PR was merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] Do not pass the base uri twice to scoped http clients
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
I looked at my dumped scoped http client PHP file and I noticed the base uri was passed two times. I thought there was a bug somewhere in my configuration. Actually, we only need to pass it as the method argument here.
Commits
-------
e2fce0d89f [FrameworkBundle] Do not pass the base uri twice to scoped http clients
This PR was squashed before being merged into the 5.2-dev branch.
Discussion
----------
[Translation] Translatable objects
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | None
| License | MIT
| Doc PR | symfony/symfony-docs#... - Will be added if this gets approval
**Scenario**
When writing business logic, this code typically lives within services. With complex situations, there can be lots of business logic exceptions or messages being created. In order to have the best user experience, we try to display detailed messages to the end user so if it's an error with some data, they know what they need to do to correct the situation. Sometimes this is through a message on a page, an email, etc. In some cases a generic message might be displayed and we log the message instead or send the message in an email to a 3rd party.
The service shouldn't need to care how the message is going to be handled, but just needs to create it in a way that it can be translated if needed.
**Options**
Translating when the message is created. There are two issues with this approach. Autowiring the translator interface to services that will display an error isn't ideal as it will increase the dependencies the service has. The larger issue is that because we would be throwing an exception that contains a string or passing a message that's a string (what the translator returns), if we have generic twig templates that run the translator function on a message, we're doing a double translation and the debug toolbar will indicate that there is a missing message and turn red. This makes finding missing translations much more difficult as we have to determine if there are any false positives and turns the red indicator into white noise.
Translating when displaying on a template. This option is possible, but adds complexity to our templates. Each time we display a message, we need to have some kind of logic that checks to see if it should be ran through the translator as-is or we need to get the data from the object and pass into the translator.
**Proposed Solution**
Adding a Phrase object that we can create and pass around reduces the template complexity and adds a nice way to create objects that can be translated at any point. This something that will be very familiar with Magento developers and other platforms also have similar solutions.
**TODO**
- [x] Determine if overwriting the parameters should be allowed (currently implemented this way)
- [x] Determine the name of the translatable class, currently `Phrase` as `Message` will likely get confused with Messenger
- [x] Determine if there should be a global function to allow quickly creating these. Similar to `__()` in Magento
- [ ] Add docs
- [x] Add tests
Happy to get as much feedback as possible. I know a feature like this would be very welcomed by my team.
Commits
-------
dc6b3bf62d [Translation] Translatable objects