This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] make middlewares truly lazy on a bus
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Right now, as soon as a message is dispatched on a bus, all its handlers are instantiated.
This PR fixes it by leveraging `IteratorAggregate` when possible (implemented by DI's `RewindableGenerator`).
Commits
-------
6a5d7a1aac [Messenger] make middlewares truly lazy on a bus
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] make Envelope first class citizen for middleware handlers
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR sits on top of #28909 so that only the 2nd commit should be reviewed for now, until I rebase it.
This idea has already been proposed and rejected in #27322.
Yet, now that I've reviewed in depth the component, I politely but strongly suggest to reconsider.
Middleware handlers are the central piece of the routing layer.
When `dispatch()` accepts `object|Envelope`, it's because it sits on the outer boundary of the component. `handle()` on the contrary plugs inside its core routing logic, so that it's very legitimate to require them to deal with `Envelope` objects. Yes, some middleware care only about the message inside. That's fine calling `getMessage()` for them.
Right now, we built a complex magic layer that acts as a band-aid *just* to save this call to `getMessage()`. For middleware that want the envelope, we require an additional interface that magically *changes* the expected argument. That's very fragile design: it breaks the `L` in `SOLID`...
Looking at the diff stat, this is most natural.
Commits
-------
ae46a436e7 [Messenger] make Envelope first class citizen for middleware handlers
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] made dispatch() and handle() return void
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Middlewares and dispatchers should not return any value. Forwarding back the results from handlers breaks the scope of the component. The canonical example of some bad design this can lead to is `ChainHandler`: how can the caller know that there is one in the chain and that it should expect an array as a return value? More generally, how can a caller know what to expect back from a call to dispatch()? I think we should not allow such broken designs.
Instead, we should favor east-oriented design: if one needs a command bus, one would have to dispatch a proper command object - and if a result is expected back, it should be done via a setter on the dispatched command - or better, a callback set on the command object. This way we play *by the rules* of the type-system, not against.
Commits
-------
f942ffcb1b [Messenger] made dispatch() and handle() return void
This PR was merged into the 4.2-dev branch.
Discussion
----------
Fix debug:container which crash when the service class has no doc comment
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
The console command container:debug have now the ability to display service description, based on phpdoc comments of the service class. But the command currently crash when selecting a service with a class without phpdoc description.
This PR fixes this issue.
Commits
-------
aed0a5a38a [FrameworkBundle] Fix debug:container which crash when the service class has no doc comment
This PR was squashed before being merged into the 3.4 branch (closes#28893).
Discussion
----------
[TwigBundle] Fix usage of TwigBundle without FrameworkBundle
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
According to the composer.json (https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/composer.json), the FrameworkBundle shouldn't be required to use the bundle (which can be useful in tests of other bundles for instance). However, it is not the case, mainly due to issues with direct references to unavailable services.
I target 3.4 because 812fbb444f is the main reason for the issue. We may have added additional problems in 4.0 and 4.1.
Commits
-------
246a905f93 [TwigBundle] Fix usage of TwigBundle without FrameworkBundle
This PR was merged into the 4.2-dev branch.
Discussion
----------
[TwigBundle] Deprecating support for legacy templates directories
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/10500
go ahead with https://github.com/symfony/symfony/pull/28810#issuecomment-430245394
- [x] Fix tests
Commits
-------
8b390f346f Deprecating support for legacy templates directories
This PR was merged into the 2.8 branch.
Discussion
----------
[DependencyInjection] Skip empty proxy code
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28852
| License | MIT
Fix https://github.com/symfony/symfony/issues/28852
@nicolas-grekas I'm not sure which branch this should be applied to, please let me know.
Commits
-------
baf6f8cc34 Skip empty proxy code
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Serializer] fix MetadataAwareNameConverter break denormalization
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
During denormalization of an object, the `normalize` function of the `MetadataAwareNormalizer` is called to find the serialized name of constructor arguments. This do not work if the constructor argument is not in the serialized representation of the object (for example given with a `default_constructor_arguments` option ).
**Checklist**
- [x] Add test to cover the bug
Commits
-------
faf8b009dc [Serializer] fix MetadataAwareNameConverter break denormalization
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Messenger] rename "envelope items" and move them in the "Stamp" namespace
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Right now, envelope items are scattered in different sub namespaces and use the "Configuration" suffix.
This makes them hard to discover.
This PR creates a new `Stamp` namespace and moves all "envelope items" there, renaming them to use the "stamp" terminology.
From the changelog:
* `Envelope`'s constructor and `with` method now accept `StampInterface` objects as variadic parameters
* Renamed `EnvelopeItemInterface` to `StampInterface`
* Renamed and moved `ReceivedMessage`, `ValidationConfiguration` and `SerializerConfiguration` in the `Stamp` namespace
* Removed the `WrapIntoReceivedMessage` (it's untested and unused)
Commits
-------
0ad2cb906d [Messenger] rename "envelope items" and move them in the "Stamp" namespace
This PR was merged into the 2.8 branch.
Discussion
----------
[Security] Fix "exclude-from-classmap"
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
The "/Tests/" directory doesn't exist in the Security Component, tests are located within the Security components folders and none of the tests were being excluded in an --classmap-authoritative dump of the autoload.
Commits
-------
7b256a985d [Security] Fix "exclude-from-classmap"
The "/Tests/" directory doesn't exist in the Security Component, tests are located within the Security components folders and none of the tests were being excluded in an --classmap-authoritative dump of the autoload.
This PR was squashed before being merged into the 4.2-dev branch (closes#28916).
Discussion
----------
[Form] Fix @method annotation
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Same as #28915 for 4.2 (these are the only occurrences for interfaces)
Actually provides a use case for https://github.com/symfony/symfony/pull/28902#issuecomment-430904459🎉
Commits
-------
13f0db718e [Form] Fix @method annotation
This PR was squashed before being merged into the 4.1 branch (closes#28915).
Discussion
----------
[Config] Fix @method annotation
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | yes
| New feature? | no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
```
@method [[static] return type] [name]([[type] [parameter]<, ...>]) [<description>]
```
I dont think this was intended to be the method description, which will be taken into account after #28902
Let me know if there's a better description, other then `Gets the child node definitions` :)
Commits
-------
0d7a961338 [Config] Fix @method annotation
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Cache] Fix outdated CHANGELOG line
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | N/A
Unless it was kept on purpose, for `Symfony\Contracts\Cache\CacheInterface` discoverability? In which case I'd add the FQCN.
Commits
-------
4e89a4bc03 [Cache] Fix outdated CHANGELOG line
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Serializer] Improve perf a bit by not using a signaling exception when not needed
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
And disabling unneeded autoload calls for interface_exists checks meanwhile.
Commits
-------
2a2914e208 [Serializer] Improve perf a bit by not using a signaling exception when not needed
This PR was merged into the 2.8 branch.
Discussion
----------
Convert InsufficientAuthenticationException to HttpException with 401 status code
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed ticket | #8467
| License | MIT
I was trying to implement the `json_login` authentication and test it with an API Platform project. When I call a secured endpoint without authentication, an InsufficientAuthenticationException is thrown with a 500 status code instead of a 401.
After some researches with @dunglas, there is no default `entrypoint` on the security firewall. As one already exists for `form_login` in the FormLoginFactory, this component might need a default one to convert this 500 exception to a correct 401 HTTP error.
This fixes https://github.com/symfony/symfony/issues/25806#issuecomment-368461952.
Commits
-------
4503ac8e9f Convert InsufficientAuthenticationException to HttpException
This PR was squashed before being merged into the 2.8 branch (closes#28840).
Discussion
----------
add missing double-quotes to extra_fields output message
| Q | A
| ------------- | ---
| Branch? | 2.8
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
When using the extra_fields_message option on FormTypes to include the extra_fields items in the message, the output included some superfluous (or, perhaps, missing?) quotes. This resulted in some strange output: `This form should not contain extra fields: notes1\", \"notes2\", \"notes3`.
This PR removes the quotes and instead implodes the extra_fields array using merely ', ' as the glue, resulting in the output: `This form should not contain extra fields: notes1, notes2, notes3`.
Commits
-------
9e7414159c add missing double-quotes to extra_fields output message
This PR was merged into the 4.2-dev branch.
Discussion
----------
[HttpKernel] Introduce KernelInterface::getProjectDir()
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | not yet
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | https://github.com/symfony/symfony/pull/28897#issuecomment-430523336
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Removes the last call to getParameter('kernel.project_dir') during runtime in core. Yay :)
cc @fabpot @nicolas-grekas
Commits
-------
b046f414e7 [HttpKernel] Introduce KernelInterface::getProjectDir()
This PR was merged into the 4.2-dev branch.
Discussion
----------
[Form][TwigBridge] Add help_attr
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Add help_attr to the form_help method.
Commits
-------
42d54b73c3 Add help_attr
This PR was squashed before being merged into the 4.1 branch (closes#28838).
Discussion
----------
[DI] Default undefined env to empty string during compile
| Q | A
| ------------- | ---
| Branch? | 4.1
| Bug fix? | yes
| New feature? | no
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | #28827
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Instead of using `null` for undefined envs, use `""` instead. We already default the type to string, so actually providing a string value makes sense. During runtime it will always be string also.
Commits
-------
38a8ab92fa [DI] Default undefined env to empty string during compile