This PR was merged into the 5.3-dev branch.
Discussion
----------
[Notifier] Fix HttpClient TransportException handling
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Right now, when exceptions are coming from HttpClient component, we always assume that there is a response and use it to throw a Notifier's `TransportException`.
But with this approach, `TransportExceptionInterface` and `DecodingExceptionInterface` aren't handled properly because they aren't containing a response at all.
This PR fix the exception handling when such exceptions are thrown.
Commits
-------
bb32beb488 [Notifier] Fix HttpClient TransportException handle
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Console] add option `--short` to the `list` command
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This PR is a follow up of https://github.com/symfony/symfony/pull/39851, triggered by @wouterj's comment at https://github.com/symfony/symfony/pull/39851#pullrequestreview-572147186.
This new option should enable creating fast shell auto-completion, by allowing the `list` command to run fast.
Commits
-------
81d5728f4a [Console] add option `--short` to the `list` command
This PR was merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle] do not fail when MercureBundle is not installed
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
8cdbdcb1c9 do not fail when MercureBundle is not installed
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Console] enable describing commands in ways that make the `list` command lazy
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#33804
| License | MIT
| Doc PR | -
This PR improves the way one can describe a command so that the `list` command can be made lazy:
- when provided using the `$defaultName` property or the `console.command` tag, the name of a command is now exploded using the `|` character. The first name in the list defines the name of the command, the other ones its aliases. When the first name is the empty string, the second name is used instead, and the command is declared as hidden.
- a new `$defaultDescription` static property and a new `description` tag attribute allow for defining the commands' description while registering them.
Together, this is enough to make the `list` command lazy, because this command only accesses each command's name, aliases, hidden-status, and description.
On the implementation side, this PR adds a `LazyCommand` class that proxies regular commands to make them lazy for the target purpose.
This PR will enable support for attributes for configuring a command name+description+etc.
e.g. using the concepts in #39804:
`#[CommandAutoTag(name: 'foo:bar', desc: 'boo', hidden: true)]#`
The attribute could very well split the `hidden` and `aliases` settings apart - while the underlying code and pre-PHP8 apps would use the compact form, because dealing with many static properties + methods would be a maintenance pain imho.
Commits
-------
8a1a1b8171 [Console] enable describing commands in ways that make the `list` command lazy
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Notifier] Add mercure bridge
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | Fix#36481
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/14840
Add a Notifier bridge for Mercure.
In this PR, Mercure is considered as a chatter (I'm still wondering if it's the most appropriate type).
The first approach for the DSN is `mercure://jwtToken@host:port/hubPath?topic=/foo/1&secure=false` with:
- `topic` optional (defaults to `null`)
- `secure` optional (defaults to `true`)
I'm not sure about the current way to deal with http/https. Maybe we can just replace the `mercure` scheme by `http|https`?
The notification representation is following [Activity Streams](https://www.w3.org/TR/activitystreams-core/#jsonld)
#SymfonyHackday
Commits
-------
19c6544f42 [Notifier] Add mercure bridge
* 5.2:
[HttpFoundation] Drop int return type from parseFilesize()
Added $translator->addLoader()
bug symfony/symfony#39878 [doctrine-bridge] Add username to UserNameNotFoundException
[Uid] Clarify the format returned by getTime()
fix spelling
Add check for constant in Curl client
Revert #38614, add assert to avoid regression
Fix container injection with TypedReference
Fix problem when SYMFONY_PHPUNIT_VERSION is empty string value
Update PHP CS Fixer config to v2.18
* 5.1:
[HttpFoundation] Drop int return type from parseFilesize()
Added $translator->addLoader()
bug symfony/symfony#39878 [doctrine-bridge] Add username to UserNameNotFoundException
[Uid] Clarify the format returned by getTime()
fix spelling
Add check for constant in Curl client
Revert #38614, add assert to avoid regression
Fix container injection with TypedReference
Fix problem when SYMFONY_PHPUNIT_VERSION is empty string value
Update PHP CS Fixer config to v2.18
* 4.4:
[HttpFoundation] Drop int return type from parseFilesize()
Added $translator->addLoader()
bug symfony/symfony#39878 [doctrine-bridge] Add username to UserNameNotFoundException
fix spelling
Add check for constant in Curl client
Revert #38614, add assert to avoid regression
Fix problem when SYMFONY_PHPUNIT_VERSION is empty string value
Update PHP CS Fixer config to v2.18
This PR was merged into the 4.4 branch.
Discussion
----------
[DoctrineBridge] Add username to UserNameNotFoundException
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix#39878 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- Never break backward compatibility (see https://symfony.com/bc).
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against branch 5.x.
-->
Adds username to UserNameNotFoundException when thrown from EntityUserProvider.
In other places there are no tests for this and I am not sure if the current setup even allows asserting if exceptions contain fields, besides the default ones.
Commits
-------
ee5b51af78 bug symfony/symfony#39878 [doctrine-bridge] Add username to UserNameNotFoundException
This PR was merged into the 4.4 branch.
Discussion
----------
[Translator] Added $translator->addLoader() to README example
For the example to work it needs the line with $translator->addLoader().
Fixed it for request at https://github.com/symfony/symfony/issues/39854#issuecomment-762283989
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- Never break backward compatibility (see https://symfony.com/bc).
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against branch 5.x.
-->
Commits
-------
ba29d2a2f0 Added $translator->addLoader()
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Form][Uid] Add UlidType and UuidType form types
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #36102
| License | MIT
| Doc PR |
Commits
-------
c84746bc1f add UlidType and UuidType form types
This PR was merged into the 5.1 branch.
Discussion
----------
[DependencyInjection] Fix container injection with TypedReference
| Q | A
| ------------- | ---
| Branch? | 5.1
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | fix #
| License | MIT
| Doc PR | -
When using `TypedReference`, the closure signature is `function (...): Type {` which does not matche the regular expresion that replace `$this` by `$container` + `use ($container)`
note: there is no issue in 4.4. At that time, dumped container use `$this->services` and looks like:
```
$instance->closures = [0 => function (): ?\stdClass {\n
return ($this->services['foo'] ?? null);\n
}];
```
Commits
-------
f8c14acd51 Fix container injection with TypedReference
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
Fix problem when SYMFONY_PHPUNIT_VERSION is empty string value
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? |
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
This should fix that when `SYMFONY_PHPUNIT_VERSION` is set again on empty:
```
SYMFONY_PHPUNIT_VERSION= vendor/bin/simple-phpunit
```
it does not error with:
```bash
Creating a "phpunit/phpunit" project at "./phpunit--1"
[UnexpectedValueException]
Could not parse version constraint .*: Invalid version string ".*"
```
Commits
-------
72ce010c0b Fix problem when SYMFONY_PHPUNIT_VERSION is empty string value
* 5.2:
[Security] Replace message data in JSON security error response
[Security] Replace message data in JSON security error response
[DI] Skip deprecated definitions in CheckTypeDeclarationsPass
[Messenger][AmazonSqs] Fix auto-setup for fifo queue
[DoctrineBridge] Take into account that indexBy="person_id" could be a db column name, for a referenced entity
* 5.1:
[Security] Replace message data in JSON security error response
[DI] Skip deprecated definitions in CheckTypeDeclarationsPass
[Messenger][AmazonSqs] Fix auto-setup for fifo queue
[DoctrineBridge] Take into account that indexBy="person_id" could be a db column name, for a referenced entity
* 4.4:
[Security] Replace message data in JSON security error response
[DI] Skip deprecated definitions in CheckTypeDeclarationsPass
[DoctrineBridge] Take into account that indexBy="person_id" could be a db column name, for a referenced entity
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[FrameworkBundle] Add renderForm() helper setting the appropriate HTTP status code
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | n/a
| License | MIT
| Doc PR | todo
A 422 HTTP status code should be returned after the submission of an invalid form. Some libraries including [Turbo](https://github.com/hotwired/turbo/pull/39) rely on this behavior and will not display the updated form (containing errors) unless this status code is present.
Rails also [recently switched to this behavior ](https://github.com/rails/rails/pull/41026) by default for the same reason.
I propose to introduce a new helper method rendering the form and setting the appropriate status code. It makes the code cleaner:
```php
// src/Controller/TaskController.php
// ...
use Symfony\Component\HttpFoundation\Request;
class TaskController extends AbstractController
{
public function new(Request $request): Response
{
$task = new Task();
$form = $this->createForm(TaskType::class, $task);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$task = $form->getData();
// ...
return $this->redirectToRoute('task_success');
}
return $this->renderForm('task/new.html.twig', $form);
}
}
```
Commits
-------
4c77e50e6a [FrameworkBundle] Add renderForm() helper setting the appropriate HTTP status code
This PR was merged into the 4.4 branch.
Discussion
----------
[DependencyInjection] Skip deprecated definitions in CheckTypeDeclarationsPass
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
When a definition uses a deprecated class , `CheckTypeDeclarationsPass` (with `$autoload = true`) will autoload the class, which triggers a deprecation notice. That breaks the CI in #39802 because the compiler pass is registered inside the SecurityBundle test suite.
I propose to stop checking deprecated definitions. Makes sense?
Commits
-------
531c81a06e [DI] Skip deprecated definitions in CheckTypeDeclarationsPass