This PR was squashed before being merged into the 4.3-dev branch (closes#30664).
Discussion
----------
[Finder] Get filename without extension
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30655
| License | MIT
| Doc PR |
Commits
-------
821e55ab80 [Finder] Get filename without extension
This PR was merged into the 4.3-dev branch.
Discussion
----------
Alias for each assets package
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | ? <!-- 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 | <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | <!-- required for new features -->
Add autowiring by type + name on assets packages
```yaml
framework:
assets:
packages:
xxx:
base_urls: 'xxxx'
```
```php
<?php
class MyService
{
private $xxxPackage;
public function __construct(PackageInterface $xxxPackage)
{
$this->xxxPackage = $xxxPackage;
...
}
public function myMethod(): string
{
return $this->xxxPackage->getUrl('some-image.png');
}
}
```
instead of:
```php
<?php
class MyService
{
private $packages;
public function __construct(Packages $packages)
{
$this->packages = $packages;
...
}
public function myMethod(): string
{
return $this->packages->getPackage('xxx')->getUrl('some-image.png');
}
}
```
Commits
-------
e8b9856ec3 Alias for each assets package
This PR was squashed before being merged into the 4.3-dev branch (closes#30706).
Discussion
----------
[PropertyInfo] Add possibility to extract private and protected properties in reflection extractor
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30248
| License | MIT
| Doc PR | TODO
This PR add the possibility to extract private and protected properties from a class by passing a new argument to the `ReflectionExtractor`
This new argument consist of flag that filters properties, so someone will also be able to use the `ReflectionExtractor` only for private property
```php
new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PRIVATE | ReflectionExtractor::ALLOW_PROTECTED)
```
Flags method was prefered over a list of bool to avoid too many parameters and also be close to the reflection API of PHP
Commits
-------
05e487f3b2 [PropertyInfo] Add possibility to extract private and protected properties in reflection extractor
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DI] Deprecate non-string default envs
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes-ish
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass? | no <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27680, https://github.com/symfony/symfony/pull/27470#discussion_r196678923
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
This is a failing test to further clarify the issues raised in #27680
So given https://github.com/symfony/symfony/issues/27680#issuecomment-399402480
> We should be sure this solves a real-world issue.
I think it solves a real bug :)
Commits
-------
2311437c9f [DI] Deprecate non-string default envs
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR adds a new `EventDispatcherInterface` in `Contracts`. This interface contains only one method: `dispatch($event, $eventName)`. That covers almost all use cases of the event dispatcher in components (some use add/removeListeners/Subscribers but they are a minority.)
While doing so, it allows dispatching any objects as events - not only instances of `Event`.
This allows decoupling e.g. `Messenger` from the `EventDispatcher` component.
Next steps could be about planning to remove the base `Event` class from some concrete event classes and/or moving `EventSubscriberInterface` to `symfony/contracts`. It would allow decoupling e.g. `Workflow` from the component - but that's too far away for now, let's think about it in 5.1.
Commits
-------
3c3db2f14a [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible
This PR was merged into the 4.3-dev branch.
Discussion
----------
Fixing bad return on getter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | not needed
My bad - this method is only to make the Symfony Serializer happy (not used in our code), so I missed it. Test added to be sure.
Commits
-------
f3b3b2f4f3 Fixing bad return on getter
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Validator] BIC remove unused sprintf and parameter
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
removed surplus parameter and sprintf as there are no placeholders in message template
Commits
-------
131e495269 [Validator] BIC remove unused sprintf and parameter
This PR was merged into the 4.3-dev branch.
Discussion
----------
Avoid dispatching SendMessageToTransportsEvent on redeliver
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes - I think so
| New feature? | no
| BC breaks? | no (feature only on master)
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | a lot, soon :)
This purpose of this event is to be a hook when a message is sent to a transport.
If that message is redelivered later, that's not the purpose of this hook (there
are Worker events for that) and could cause problems if the user unknowingly
tries to modify the Envelope in some way, not thinking about how this might
be a redelivery message.
Commits
-------
3ac6bf9f24 Avoid dispatching SendMessageToTransportsEvent on redeliver
This purpose of this event is to be a hook when a message is sent to a transport.
If that message is redelivered later, that's not the purpose of this hook (there
are Worker events for that) and could cause problems if the user unknowingly
tries to modify the Envelope in some way, not thinking about how this might
be a redelivery message.
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Messenger] Add missing information in messenger logs
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes-ish
| New feature? | yes-ish
| BC breaks? | no
| 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
| License | MIT
| Doc PR | n/a
When using `messenger:consume`, I get the following logs:
```
2019-03-25T11:39:05+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:05+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:05+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #1.
2019-03-25T11:39:05+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport"
2019-03-25T11:39:06+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:06+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:06+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #2.
2019-03-25T11:39:06+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport"
2019-03-25T11:39:09+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:09+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:09+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #3.
2019-03-25T11:39:09+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport"
```
So, an. error occurred, but I have no idea what's going on. The exception is in the context, but the context is not displayed by default. So, this PR fixes it.
Commits
-------
20664caf25 [Messenger] added missing information in messenger logs
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Validator] Add constraint on unique elements collection(Assert\Unique)
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no <!-- please add some, will be required by reviewers -->
| Fixed tickets | #26535
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest 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 the master branch.
-->
Commits
-------
d0eb13e55a Rebase and update to latest CS
fc66683cf2 Add UniqueCollection constraint and validator
This PR was squashed before being merged into the 4.3-dev branch (closes#27684).
Discussion
----------
[FrameworkBundle] Debug container environment variables
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| 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 -->
This PR is an attempt to ease debugging environment variables used by the container. Main purpose is to tell which are missing and show detailed usage information.
![image](https://user-images.githubusercontent.com/1047696/47601226-ae43c480-d9cd-11e8-926b-8c49069189fc.png)
![image](https://user-images.githubusercontent.com/1047696/47601234-d7645500-d9cd-11e8-9e3f-d1c2ad85dbc5.png)
Commits
-------
b813a05aa5 [FrameworkBundle] Debug container environment variables
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Form][Console] Use dumper
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| 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 -->
Continuation of #28898 for `debug:form`
Commits
-------
a94228edba [Form][Console] Use dumper
This PR was merged into the 4.3-dev branch.
Discussion
----------
Fix type hints for email attachments
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| 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
| License | MIT
| Doc PR | n/a
`createDataPart()` must return a `DataPart` instance, so `attachPart()` must only accept `DataPart` instances and `getAttachments()` is guaranteed to return an array of `DataPart` instances.
Commits
-------
8059c50e75 fixed type hints for email attachments
This PR was squashed before being merged into the 4.3-dev branch (closes#30559).
Discussion
----------
[HttpClient] Parse common API error formats for better exception messages
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | no
| New feature? | yes <!-- 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 | todo?
Use extra details provided by popular error formats following to improve HTTP exception messages.
The following formats are supported:
* Hydra (default in API Platform)
* RFC 7807 (followed by Symfony's [ConstraintViolationListNormalizer](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php) and supported by API Platform and Apigility)
* JSON:API (because it respects the semantic of the RFC 7807)
It allows to write code like the following (here in a test context):
```php
public function testBadRequest()
{
$this->expectException(ClientExceptionInterface::class);
$this->expectExceptionCode(400); // HTTP status code
$this->expectExceptionMessage(<<<ERROR
Validation Failed
users: This collection should contain 1 element or more.
users: The current logged in user must be part of the users owning this resource.
ERROR
);
$response = (HttpClient::create())->request('POST', 'http://example.com/api/projects', [
'json' => [
'name' => 'My project',
],
]);
$response->getContent();
}
```
Port of https://github.com/api-platform/core/pull/2608#issuecomment-472510732.
Commits
-------
96df4464a1 [HttpClient] Parse common API error formats for better exception messages
This PR was squashed before being merged into the 4.3-dev branch (closes#28898).
Discussion
----------
[Console] Add dumper
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| 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 | https://github.com/symfony/symfony-docs/issues/10502
This PR adds a new `Dumper` helper in the Console component. As there are 2 types of dumps
- debug purpose (e.g. `dd()`, `dump()`)
- output purpose (see #24208, #27684)
For the latter we cannot use the global system (debug) dumper, i.e. `VarDumper::dump()`, we need something tied to the current output and dependency free. Here it is:
```php
$io = new SymfonyStyle($input, $output);
$dumper = new Dumper($io);
$io->writeln($dumper([-0.5, 0, 1]));
$io->writeln($dumper(new \stdClass()));
$io->writeln($dumper(123));
$io->writeln($dumper('foo'));
$io->writeln($dumper(null));
$io->writeln($dumper(true));
```
With VarDumper comonent:
![image](https://user-images.githubusercontent.com/1047696/47069483-4cc26f80-d1ef-11e8-902e-2f9b0f040f25.png)
Without:
![image](https://user-images.githubusercontent.com/1047696/47069517-6663b700-d1ef-11e8-9328-ae1db0b83d7e.png)
> https://github.com/symfony/symfony/pull/27684#discussion_r224054237 var-dumper is not a mandatory dep of fwb, can we do without?
Now we can :)
Commits
-------
fc7465c02c [Console] Add dumper
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] added CachingHttpClient
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
The proposed `CachingHttpClient` uses `HttpCache` from the HttpKernel component to provide an HTTP-compliant cache.
If this is accepted, it could replace the corresponding part in #30602
Commits
-------
dae5686722 [HttpClient] added CachingHttpClient
This PR was merged into the 4.3-dev branch.
Discussion
----------
[BrowserKit] Add support for HttpClient
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| 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 | part of #30502
| License | MIT
| Doc PR | not yet
When combining the power of the new HttpClient component with the BrowserKit and Mime components, we can makes something really powerful... a full/better/awesome replacement for https://github.com/FriendsOfPHP/Goutte.
So, this PR is about integrating the HttpClient component with BrowserKit to give users a high-level interface to ease usages in the most common use cases.
Scraping websites can be done like this:
```php
use Symfony\Component\BrowserKit\HttpBrowser;
use Symfony\Component\HttpClient\HttpClient;
$client = HttpClient::create();
$browser = new HttpBrowser($client);
$browser->request('GET', 'https://example.com/');
$browser->clickLink('Log In');
$browser->submitForm('Sign In', ['username' => 'me', 'password' => 'pass']);
$browser->clickLink('Subscriptions')->filter('table tr:nth-child(2) td:nth-child(2)')->each(function ($node) {
echo trim($node->text())."\n";
});
```
And voilà! Nice, isn't?
Want to add HTTP cache? Sure:
```php
use Symfony\Component\HttpKernel\HttpCache\Store;
$client = HttpClient::create();
$store = new Store(sys_get_temp_dir().'/http-cache-store');
$browser = new HttpBrowser($client, $store);
// ...
```
Want logging and debugging of HTTP Cache? Yep:
```php
use Psr\Log\AbstractLogger;
class EchoLogger extends AbstractLogger
{
public function log($level, $message, array $context = [])
{
echo $message."\n";
}
}
$browser = new HttpBrowser($client, $store, new EchoLogger());
```
The first time you run your code, you will get an output similar to:
```
Request: GET https://twig.symfony.com/
Response: 200 https://twig.symfony.com/
Cache: GET /: miss, store
Request: GET https://twig.symfony.com/doc/2.x/
Response: 200 https://twig.symfony.com/doc/2.x/
Cache: GET /doc/2.x/: miss, store
```
But then:
```
Cache: GET /: fresh
Cache: GET /doc/2.x/: fresh
```
Limit is the sky here as you get the full power of all the Symfony ecosystem.
Under the hood, these examples leverage HttpFoundation, HttpKernel (with HttpCache),
DomCrawler, BrowserKit, CssSelector, HttpClient, Mime, ...
Excited?
P.S. : Tests need to wait for the HttpClient Mock class to land into master.
Commits
-------
b5b2a2557c Add tests for HttpBrowser
dd55845706 [BrowserKit] added support for HttpClient
This PR was merged into the 4.3-dev branch.
Discussion
----------
[FrameworkBundle] Update Client class to KernelBrowser
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
I updated recently the WebTestCase with a check to provide a better/more clear exception message (see #30479). After that change @fabpot renamed different `Client` classes in components to a clearer name (for ex Client in HttpKernel is now KernelBrowser etc.). This PR aims to replace the Client in WebTestCase to the new name class name.
Commits
-------
28b6dd243e Replace class with new name.
This PR was merged into the 4.3-dev branch.
Discussion
----------
Allow user to set the project dir
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | <!-- symfony/symfony-docs#... required for new features -->
Currently, the project directory is defined by the location of the composer.json file.
That file is not required in production, which therefore [breaks the method getProjectDir](https://github.com/symfony/symfony/issues/23950) (who sends back null).
The offered solution, while working, requires the developer to implement it, and uses inheritance override, while a more aesthetic solution could be used.
This does not fix the behaviour, but allows the developer to pass the project dir as a parameter.
While this solution does not include BC break or anything, it is important to notice that it includes
**an optional parameter**.
[Object instantiation in the framework bundle recipe](https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/4.2/public/index.php#L23) could be updated as follow (in another PR):
```php
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
```
```php
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG'], dirname(__DIR__));
```
Commits
-------
c40017d63c Allow user to set the project dir
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] Add a ScopingHttpClient
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR is a follow up of #30592 by @XuruDragon, with two main differences:
- I think `ScopingHttpClient` might be a better name for what is called a `ConditionalHttpClient` there,
- the `FrameworkBundle` part is removed so that it can be submitted separately later on.
With a `ScopingHttpClient`, you can add some default options conditionally based on the requested URL and a regexp that it should match. This allows building clients that add e.g. credentials based on the requested scheme/host/path.
When the requested URL is a relative one, a default index can be provided - whose corresponding default options (the `base_uri` one especially) will be used to turn it into an absolute URL.
Regexps are anchored on their left side.
E.g. this defines a client that will send some github token when a request is made to the corresponding API, and will not send those credentials if any other host is requested, while also turning relative URLs to github ones:
```php
$client = HttpClient::create();
$githubClient = new ScopingClient($client, [
'http://api\.github\.com/' => [
'base_uri' => 'http://api.github.com/',
'headers' => ['Authorization: token '.$githubToken],
],
], 'http://api\.github\.com/');
```
Of course, it's possible to define several regexps as keys so that one can create a client that is authenticated against several hosts/paths.
Commits
-------
1ee0a1147a [HttpClient] Add a ScopingHttpClient
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Security] undeprecate the RoleHierarchyInterface
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/22048#discussion_r260247046
| License | MIT
| Doc PR |
Instead of deprecating the interface it is sufficient to deprecate its
getReachableRoles() method and add a new getReachableRoleNames() method
in Symfony 5.
Commits
-------
2d3f2b7a74 undeprecate the RoleHierarchyInterface
This PR was merged into the 4.3-dev branch.
Discussion
----------
Fixing a bug where messenger:consume could send message to wrong bus
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | arguably, yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30631
| License | MIT
| Doc PR | Not needed
This fixes#30631, where you can run `messener:consume` and accidentally sent received messages into the wrong bus.
The fix (done via middleware) is to attach a "bus name" to the `Envelope` and use it when the message is received to find that bus.
Commits
-------
ef077cf26c Fixing a bug where a transport could receive a message and dispatch it to a different bus
This PR was merged into the 4.3-dev branch.
Discussion
----------
Dispatching two events when a message is sent & handled
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | none
| License | MIT
| Doc PR | TODO
Alternative to #30646. This uses a more generic system, so you could do anything when a message is sent. The main use-case is when a message is dispatched by a 3rd party.
I didn't try to add *exhaustive* events everywhere: I added an event for a very specific use-case:
When a message is dispatched by a 3rd party, being able to add stamps (e.g. `DelayStamp` or a future `AmqpRoutingKeyStamp` before the message is sent. Example:
```php
class MailerMessageSendToTransportEventSubscriber implements EventSubscriberInterface
{
public function onSendMessage(SendMessageToTransportsEvent $event)
{
$envelope = $event->getEnvelope();
if (!$envelope->getMessage() instanceof SomeMailerMessage) {
return;
}
$event->setEnvelope($envelope->with(new AmpqRoutingKeyStamp('mailer-route')));
}
public static function getSubscribedEvents()
{
return [SendMessageToTransportsEvent::class => 'onSendMessage'];
}
}
```
Along with #30557, we will now have the following events, regarding async messages:
* Event when a message is sent to transports (this PR)
* Event when a message is received from transport, but before handling it
* Event when a message is received from transport and after handling it
Commits
-------
a7ad1b4ccc Dispatching two events when a message is sent & handled
Currently, the project directory is defined by the location of the composer.json file.
That file is not required in production, which therefore breaks the method getProjectDir (who sends back null).
This does not fix the behaviour, but allows the developer to pass the project dir as a parameter.
Instead of deprecating the interface it is sufficient to deprecate its
getReachableRoles() method and add a new getReachableRoleNames() method
in Symfony 5.
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Workflow] Deprecate MultipleStateMarkingStore and SingleStateMarkingStore in favor of MethodMarkingStore
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
4d58beb7c8 [Workflow] Deprecate MultipleStateMarkingStore and SingleStateMarkingStore in favor of MethodMarkingStore
This PR was merged into the 4.3-dev branch.
Discussion
----------
Make MethodMarkingStore final
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Made `MethodMarkingStore` final as proposed in https://github.com/symfony/symfony/pull/29146#issuecomment-475574327.
Commits
-------
bbf582bce5 Make MethodMarkingStore final
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Workflow] Added support for many inital places
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | #30080
| License | MIT
| Doc PR |
Commits
-------
1af1bf29ef Added support for many inital places
* 4.2:
[Phpunit] fixed support for PHP 5.3
Response prepare method update
[Workflow] Added missing license header
Fix case when multiple loaders are providing paths for the same namespace
Check if Client exists when test.client does not exist, to provide clearer exception message
throw TypeErrors to prepare for type hints in 5.0
[Form] Preventing validation of children if parent with Valid constraint has no validation groups
[Form] Added ResetInterface to CachingFactoryDecorator
Remove deprecated usage
[Tests] fixed compatbility of assertEquals(): void
Fixed usage of TranslatorInterface in form extension (fixes#30591)
[Intl][4.2] Fix test
[Intl] Fix test
[Validator] Add the missing translations for the Arabic (ar) locale
[Intl] Add compile binary
Fix DebugCommand when chain loader is involved
[Form] Fixed some phpdocs
* 3.4:
[Phpunit] fixed support for PHP 5.3
Response prepare method update
[Workflow] Added missing license header
Check if Client exists when test.client does not exist, to provide clearer exception message
[Form] Preventing validation of children if parent with Valid constraint has no validation groups
[Tests] fixed compatbility of assertEquals(): void
[Intl] Fix test
[Validator] Add the missing translations for the Arabic (ar) locale
[Intl] Add compile binary
[Form] Fixed some phpdocs
This PR was squashed before being merged into the 4.3-dev branch (closes#30448).
Discussion
----------
[Finder] Ignore paths from .gitignore #26714
| Q | A
| ------------- | ---
| Branch? | master for features
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #26714
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest 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 the master branch.
-->
Implementation of feature request #26714
Finder::ignoreVCS() is great at ignoring file patterns for the files created by popular VCS systems.
However, it would be great to be able to instruct Finder to actually exclude the paths excluded by .gitignore.
So if we have .gitignore:
vendor/
cache/
Finder::create()
->files()
->ignoreVCS(true) // <--- Ignores `.git`
->ignoreVCSIgnored(true); // <--- Ignores vendor/ and cache/
Commits
-------
9491393dc2 [Finder] Ignore paths from .gitignore #26714
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] improve MockResponse
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
While working with `MockHttpClient`, we figured out these would be useful:
- `MockResponse::getRequestOptions()` to get the options that were used when doing the request
- relax the format of the `raw_headers` info and allow it to be defined as name=>value(s) pairs.
Commits
-------
26f6e28160 [HttpClient] improve MockResponse
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Routing] Exposed "utf8" option, defaults "locale" and "format" in configuration
| 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#11126
A sibling to #30501, everything is in the title :).
Commits
-------
2911490c80 [Routing] Exposed "utf8" option, defaults "locale" and "format" in configuration
This PR was merged into the 4.3-dev branch.
Discussion
----------
[EventDispatcher] swap arguments of dispatch() to allow registering events by FQCN
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
PR green and ready. From UPGRADE files:
EventDispatcher
---------------
* The signature of the `EventDispatcherInterface::dispatch()` method should be updated to `dispatch($event, string $eventName = null)`, not doing so is deprecated
HttpKernel
----------
* Renamed `FilterControllerArgumentsEvent` to `ControllerArgumentsEvent`
* Renamed `FilterControllerEvent` to `ControllerEvent`
* Renamed `FilterResponseEvent` to `ResponseEvent`
* Renamed `GetResponseEvent` to `RequestEvent`
* Renamed `GetResponseForControllerResultEvent` to `ViewEvent`
* Renamed `GetResponseForExceptionEvent` to `ExceptionEvent`
* Renamed `PostResponseEvent` to `TerminateEvent`
Security
---------
* The `ListenerInterface` is deprecated, turn your listeners into callables instead.
* The `Firewall::handleRequest()` method is deprecated, use `Firewall::callListeners()` instead.
Commits
-------
75369dabb8 [EventDispatcher] swap arguments of dispatch() to allow registering events by FQCN
This PR was squashed before being merged into the 4.3-dev branch (closes#30605).
Discussion
----------
[Cache] added DSN support for rediss in AbstractAdapter and RedisTrait
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/issues/30573
| License | MIT
A fix for this issue: https://github.com/symfony/symfony/issues/30573
Support for "rediss:" in DSN added.
Commits
-------
7e2852dd44 [Cache] added DSN support for rediss in AbstractAdapter and RedisTrait
This PR was squashed before being merged into the 3.4 branch (closes#30479).
Discussion
----------
Check if Client exists when test.client does not exist, to provide clearer exception message
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30420
| License | MIT
The `DotEnv` component does not overwrite by using environment variables declared in `.env` files.
In the `FrameworkExtension` will be checked if the framework.test config is set to a non-false value, if so it will load the `test.xml` file which contains the definition for the `test.client` service.
When running `php bin/phpunit` it will use `phpunit.xml.dist` but because we defined `APP_ENV` in our system it will not load `test.xml` so when creating a client to do functional tests, we'll get an exception which isn't correct: `You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit"`
This PR aims to add a clearer exception message which indicates what really should be done to fix the error message.
Commits
-------
b429950af6 Check if Client exists when test.client does not exist, to provide clearer exception message
This PR was merged into the 4.2 branch.
Discussion
----------
[Form] Added ResetInterface to CachingFactoryDecorator
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #29259
| License | MIT
| Doc PR | ~
I don't know if this should be considered a feature and target master, but I tend to see it as a bug fix.
Commits
-------
4ddf5a14eb [Form] Added ResetInterface to CachingFactoryDecorator
This PR was merged into the 4.2 branch.
Discussion
----------
[Workflow] Remove deprecated usage
| Q | A
| ------------- | ---
| Branch? | master for features / 3.4 up to 4.2 for bug fixes <!-- see below -->
| Bug fix? | no
| New feature? |no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| License | MIT
This is a little improvement suggestion because string usage is deprecated while it's still the default value. `null` is also deprecated but is required for BC.
Commits
-------
eeb3c29fab Remove deprecated usage
This PR was merged into the 4.3-dev branch.
Discussion
----------
throw TypeErrors to prepare for type hints in 5.0
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Commits
-------
10afb99e3f throw TypeErrors to prepare for type hints in 5.0
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] add MockHttpClient
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR introduces `MockHttpClient` and `MockResponse`, to be used for testing classes that need an HTTP client without making actual HTTP requests.
`MockHttpClient` is configured via its constructor: you provide it either with an iterable or a callable, and these will be used to provide responses as the consumer requests them.
Example:
```php
$responses = [
new MockResponse($body1, $info1),
new MockResponse($body2, $info2),
];
$client = new MockHttpClient($responses);
$response1 = $client->request(...); // created from $responses[0]
$response2 = $client->request(...); // created from $responses[1]
```
Or alternatively:
```php
$callback = function ($method, $url, $options) {
return new MockResponse(...);
};
$client = new MockHttpClient($callback);
$response = $client->request(...); // calls $callback internal
```
The responses provided to the client don't have to be instances of `MockResponse` - any `ResponseInterface` works (e.g. `$this->getMockBuilder(ResponseInterface::class)->getMock()`).
Using `MockResponse` allows simulating chunked responses and timeouts:
```php
$body = function () {
yield 'hello';
yield ''; // the empty string is turned into a timeout so that they are easy to test
yield 'world';
};
$mockResponse = new Mockresponse($body);
```
Last but not least, the implementation simulates the full lifecycle of a properly behaving `HttpClientInterface` contracts implementation: error handling, progress function, etc. This is "proved" by `MockHttpClientTest`, who implements and passes the reference test suite in `HttpClientTestCase`.
Commits
-------
8fd7584158 [HttpClient] add MockHttpClient
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Messenger] Support for handling messages after current bus is finished
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/10015
This is a replacement for #27844. We achieve the same goals without introducing the new concept of "recorder".
```php
class CreateUserHandler
{
private $em;
private $eventBus;
public function __construct(MessageBus $eventBus, EntityManagerInterface $em)
{
$this->eventBus = $eventBus;
$this->em = $em;
}
public function __invoke(CreateUser $command)
{
$user = new User($command->getUuid(), $command->getName(), $command->getEmail());
$this->em->persist($user);
$message = new UserCreatedEvent($command->getUuid();
$this->eventBus->dispatch((new Envelope($message))->with(new DispatchAfterCurrentBus()));
}
}
```
Note that this `DispatchAfterCurrentBusMiddleware` is added automatically as the first middleware.
2019-03-13: I updated the PR description.
Commits
-------
903355fbcc Support for handling messages after current bus is finished
This PR was squashed before being merged into the 4.3-dev branch (closes#29538).
Discussion
----------
[Workflow] Add colors to workflow dumps
Fixes#28874
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #28874, replaces #28933
| License | MIT
| Doc PR | TODO, requires https://github.com/symfony/symfony-docs/pull/9476
Fetch data with the `MetadataStore` from #26092 in order to add colors to the dumps.
Example of configuration:
```yaml
transitions:
submit:
from: start
to: travis
metadata:
title: transition submit title
dump_style:
label: 'My custom label'
arrow_color: '#0088FF'
label_color: 'Red'
```
This code was developed as a bundle, examples can be found on its repository: https://github.com/alexislefebvre/SymfonyWorkflowStyleBundle
Commits
-------
60ad109533 [Workflow] Add colors to workflow dumps
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DI] Add an url EnvProcessor
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/11128
This PR add a new env processor `url` to convert an URL (or DSN) into an array.
The main goal is to simplify the project configuration and reduce the number of env variable when working with bundle which are not able to deal with DSN
(pick some random project in symfony/recipes-contrib: https://github.com/symfony/recipes-contrib/blob/master/facile-it/mongodb-bundle/0.6/manifest.json or https://github.com/symfony/recipes-contrib/blob/master/wouterj/eloquent-bundle/1.0/manifest.json)
```yaml
# before
MONGODB_HOST=localhost
MONGODB_PORT=27017
MONGODB_USER=
MONGODB_PASSWORD=
MONGODB_DB=symfony
mongo_db_bundle:
data_collection: '%kernel.debug%'
clients:
default:
hosts:
- { host: '%env(MONGODB_HOST)%', port: '%env(int:MONGODB_PORT)%' }
username: '%env(MONGODB_USER)%'
password: '%env(MONGODB_PASSWORD)%'
connectTimeoutMS: 3000
connections:
default:
database_name: '%env(MONGODB_DB)%'
# after
MONGODB_DSN=mongodb://localhost:27017/symfony
mongo_db_bundle:
data_collection: '%kernel.debug%'
clients:
default:
hosts:
- { host: '%env(key:host:url:MONGODB_DSN)%', port: '%env(key:port:url:MONGODB_DSN)%' }
username: '%env(key:user:url:MONGODB_DSN)%'
password: '%env(key:pass:url:MONGODB_DSN)%'
connectTimeoutMS: 3000
connections:
default:
database_name: '%env(key:path:url:MONGODB_DSN)%'
```
Added also a `query_string` processor to parse query string
```
DATABASE_DSN=mysql://localhost/db?charset=utf8
foo:
bar:
charset: '%env(key:charset:query_string🔑query:url:DATABASE_DSN)%'
```
Commits
-------
f253c9b7ca Add an url EnvProcessor
This PR was merged into the 4.3-dev branch.
Discussion
----------
[FrameworkBundle] Add integration of http-client component
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR adds the integration of the HttpClient component on FrameworkBundle.
By default, two services are provided, one implementing SFC-HttpClient, and another PSR18:
* `http_client` + its autowiring alias for `Symfony\Contracts\HttpClient\HttpClientInterface`)
This service is automatically set to the best HTTP client available with the configuration given under the `framework.http_client` key.
* `psr18.http_client` + its autowiring alias for `Psr\Http\Client\ClientInterface`). To make it work, one needs to provide autowiring aliases for `ResponseFactoryInterface` and `StreamFactoryInterface`, which are provided by [the recipe](https://github.com/symfony/recipes-contrib/blob/master/nyholm/psr7/1.0/config/packages/nyholm_psr7.yaml) for `nyholm/psr7` (but could be overriden by apps when using something else).
* one can also configure the default options, and "scoped" clients. For example:
```yaml
http_client:
default_options:
capath: '...'
clients:
github_client:
default_options:
base_uri: 'https://api.github.com'
```
This definition create a `github_client` service implementing SFC-HttpClient and a `psr18.github_client` one implementing PSR18, +2 corresponding named autowiring aliases: `HttpClientInterface $githubClient`, and `ClientInterface $githubClient`.
Commits
-------
f2d2cf3021 work with attributes for xml config
0023a71260 [FrameworkBundle] Add integration of http-client component
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DI] fix casting AutowiringFailedException to string when its callback throws
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30571
| License | MIT
| Doc PR | -
ping @weaverryan
Commits
-------
d57a148b8b [DI] fix casting AutowiringFailedException to string when its callback throws
This PR was squashed before being merged into the 4.3-dev branch (closes#30450).
Discussion
----------
[Profiler] Render the performance graph with SVG
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | Part 1, 3 and 4 of #27262
| License | MIT
| Doc PR | n/a
Following a suggestion by @ogizanagi in #27262,
Here's a proposal to render the Request Graph, from the performance profiler panel, with SVG instead of canvas.
Some benefits of the SVG format:
- The text labels are searchable and can be selected.
- It renders well on high DPI monitors.
- [Colors and text styles](https://github.com/symfony/symfony/issues/27262#issuecomment-388868068) can be defined with CSS just like the rest of the page.
In addition, SVG allow us to consider (and easily implement) interactives features such as:
- Zoom in and time navigation (thanks to the viewport).
- Highlight hovered line (or other DOM related events).
Preview:
![screenshot_2019-03-08 symfony profiler 1](https://user-images.githubusercontent.com/1846873/54036727-a33f4300-41bc-11e9-8be7-b1de10d4afd9.png)
Filtered events example:
![capture d ecran 2019-03-08 a 17 22 47](https://user-images.githubusercontent.com/1846873/54041039-00d88d00-41c7-11e9-9590-23e809415c34.png)
### Progress :
- [x] Render request events in SVG
- [x] Show labels with duration and memory
- [x] Show specific markers at start / end of lines
- [x] Re-render graph when window resize
- [x] Re-render graph when threshold change.
- [x] Generate graph legend with only existing categories (part 1. of #27262 )
- [x] Show sub-request area with hatched pattern
- [x] Allow to hide categories by clicking them on the legend (part 3. of #27262 )
- [x] Handle text overflow on long labels.
- [x] Ensure JS code is compatible with all supported browsers (used [classes](https://caniuse.com/#feat=es6-class) and [arrow functions](https://caniuse.com/#feat=arrow-functions).
- ~Add left-padding to sub-request graph?~
Commits
-------
a69a718ec9 [Profiler] Render the performance graph with SVG
This PR was squashed before being merged into the 4.3-dev branch (closes#30549).
Discussion
----------
[HttpClient] Make exceptions public
| 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 | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | n/a
Makes it easier to implement the interface. See api-platform/core#2608
Commits
-------
928d774e4a [HttpClient] Make exceptions public
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Serializer] Normalize constraint violation parameters
| Q | A
| ------------- | ---
| Branch? | master <!-- see below -->
| Bug fix? | no
| New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- 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?
Adding violation constraints' parameters to the normalized data, as these are valuable for an API client.
I used `parameters` for now, as it's the name used in `ConstraintViolationInterface::getParameters()`, but what about `placeholders` or `context`?
Commits
-------
32c90ebc8e [Serializer] Normalize constraint violation parameters
This PR was squashed before being merged into the 4.3-dev branch (closes#28330).
Discussion
----------
[MonologBridge] Add monolog processors adding route and command info
| 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#10244
This PR adds two simple processors that add context to every log entry.
RouteProcessor adds routing information:
`app.INFO: Some log text {"someContext":"ctx"} {"route":{"controller":"App\\Controller\\SomeController::number","route":"index","route_params":[]}`
ConsoleCommandProcessors adds current command information:
`app.INFO: Some log text {"someContext":"ctx"} {"command":{"name":"app:some-command","arguments":{"command":"app:some-command","some-argument":10}}}`
For ConsoleCommandProcessor I've decided against including command options by default, because there's a lot of default ones:
`"options":{"help":false,"quiet":false,"verbose":false,"version":false,"ansi":false,"no-ansi":false,"no-interaction":false,"env":"dev","no-debug":false}`. This behavior can be changed with a constructor argument.
Commits
-------
669f6b2726 [MonologBridge] Add monolog processors adding route and command info
This PR was merged into the 3.4 branch.
Discussion
----------
[Intl] Add compile binary
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no-ish
| 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 -->
Compile the Intl data by invoking a single command, and make it work out-of-the-box. (Split from #28831)
```bash
$ src/Symfony/Component/Intl/Resources/bin/compile
```
run in repository root because of
b7e798ef74/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php (L141)
3.4 is ok, 4.2 is not because of #28833 but new locales are introduced in https://github.com/symfony/symfony/pull/28977/files#diff-f52da32e1ee6b93598814090d0749aa6R1
So as long as 3.4 is supported, but branches above add filters etc. during generation we're risking this discrepancy. I suggest after merge in upper branches to re-run `compile` (potential for automating, but run if needed :))
Commits
-------
426b92f4a8 [Intl] Add compile binary
* 4.2:
Fix Cache error while using anonymous class
[Cache] fix LockRegistry
Update validators.cs.xlf
Make translations consistent with other translations.
Correct language code for ukrainian language in security translations.
Fix return type of Request::getRequestFormat
[Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DependencyInjection] Add ability to define an index for service in an injected service locator argument
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | in progress / symfony/symfony-docs#...
It's more or less the same thing then the PR #30257 but for a service locator argument
Add a simple way to specify an index based on a tag attribute to simplify retrieving a specific service when injecting a service locator as argument into services, but also a way to fallback to a static method on the service class.
Yaml:
```yaml
services:
foo_service:
class: Foo
tags:
- {name: foo_tag, key: foo_service}
foo_service_tagged:
class: Bar
arguments:
- !tagged_locator
tag: 'foo_tag'
index_by: 'key'
default_index_method: 'static_method'
```
XML:
```xml
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/serviceshttp://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="foo" class="Foo">
<tag name="foo_tag" key="foo_service" />
</service>
<service id="foo_tagged_iterator" class="Bar" public="true">
<argument type="tagged_locator" tag="foo_tag" index-by="key" default-index-method="static_method" />
</service>
</services>
</container>
```
PHP:
```php
// config/services.php
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
$container->register(Foo::class)
->addTag('foo_tag', ['key' => 'foo_service']);
$container->register(App\Handler\HandlerCollection::class)
// inject all services tagged with app.handler as first argument
->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('app.handler', 'key')));
```
Usage:
```php
// src/Handler/HandlerCollection.php
namespace App\Handler;
use Symfony\Component\DependencyInjection\ServiceLocator;
class HandlerCollection
{
public function __construct(ServiceLocator $serviceLocator)
{
$foo = $serviceLocator->get('foo_service'):
}
}
```
Tasks
* [x] Support PHP loader/dumper
* [x] Support YAML loader/dumper
* [x] Support XML loader/dumper (and update XSD too)
* [x] Add tests
* [x] Documentation
Commits
-------
cb3c56bc0c Support indexing tagged locators by FQCN as fallback
250a2c8332 [DI] Allow tagged_locator tag to be used as an argument
This PR was squashed before being merged into the 4.3-dev branch (closes#30469).
Discussion
----------
Create a hyperlink to interfaces/classes that can be autowired
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
Added hyperlink to definition of interfaces/classes that can be used for autowiring.
But I need help with:
- the aliases are becoming hyperlinks too, but shouldn't.
It's outputting `<fg=yellow;href=phpstorm://open?file=filepath&line=17>Symfony\Contracts\Translation\TranslatorInterface</> <fg=cyan>(translator.default)</>`
- it currently works with phpstorm because it's hardcoded but it should work with framework.ide option, but don't know what the best approach is to support that config option.
Commits
-------
a3dfcee406 Create a hyperlink to interfaces/classes that can be autowired
This PR was merged into the 4.3-dev branch.
Discussion
----------
[DI] add ReverseContainer: a locator that turns services back to their ids
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
This PR introduces a `ReverseContainer`, which is a class you can type hint for to get it as a service.
When you have a `ReverseContainer` at hand, you can then use it to know the service id of an object (if the object is not found, `null` is returned):
`$id = $reverseContainer->getId($someObject);`
You can also call `$reverseContainer->getService($id);` and get the service in return.
To be reversible, a service must either be public or be tagged with `container.reversible`.
I'm using this feature to serialize service references in a message, then send them through a Messenger bus, allowing the handler on the other side to use that referenced service to process the message. More specifically, my use case is sending messages for early cache expiration events through a bus and have a worker compute the soon-to-expire value in the background. The reversible services are the computation callbacks and the cache pools I need to compute the value for.
Commits
-------
ac1e4291e8 [DI] add ReverseContainer: a locator that turns services back to their ids
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
Discussing with @simensen, we figured out the currently logged messages are not precise enough.
Logging is a cross-cutting concern: splitting it in a dedicated middleware means losing details - or building complexity.
Let's make things simple and log the best messages depending on the internal situation.
While the component is experimental, removing the `LoggingMiddleware` altogether would break FrameworkBundle 4.2 when it is used with Messenger 4.3. Not worth the trouble when it's two lines to deprecate IMHO.
Commits
-------
2bff625abe [Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware
This PR was squashed before being merged into the 4.3-dev branch (closes#30547).
Discussion
----------
[HttpClient] Add new bearer option
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes<!-- 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
Add a new "auth_bearer" option to set the corresponding flavor of the `Authorization` header as defined in RFC 6750 and used in OAuth (and others).
Also rename "auth" to "auth_basic" for consistency as discussed with @nicolas-grekas.
Commits
-------
f79ef21458 [HttpClient] Add new bearer option
* 3.4:
Make translations consistent with other translations.
Correct language code for ukrainian language in security translations.
Fix return type of Request::getRequestFormat
[Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
This PR was merged into the 3.4 branch.
Discussion
----------
Correct language code for ukrainian language
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | yes
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
Correct language code for [ukrainian language](https://en.wikipedia.org/wiki/Ukrainian_language) is **uk**, not **ua**. Similar bug was earlier addressed in #5972, but somehow it appeared here again. Possible BC break in case someone relies on "ua" version being present, but I think that is a minor problem.
Commits
-------
b86fa9312b Correct language code for ukrainian language in security translations.
This PR was merged into the 3.4 branch.
Discussion
----------
[Validator] Improve Bulgarian translations.
| Q | A
| ------------- | ---
| Branch? | 3.4 <!-- see below -->
| 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 | none <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | none <!-- required for new features -->
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
- Bug fixes must be submitted against the lowest 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 the master branch.
-->
This pull request is an improvement on top of #30227 and improves translations in the following ways:
- Make consistent how `This` word is translated.
- Make consistent how `This value` is translated.
- Fix capitalization rules for abbreviations.
- Change `email` to `имейл` (this is a word in the official Bulgarian dictionary).
- Removes unnecessary words in brackets.
Feel free to comment and criticize I'm not a professional translator.
Commits
-------
d15c76cd53 Make translations consistent with other translations.
This PR was merged into the 3.4 branch.
Discussion
----------
[Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
This is slimmed down version of: https://github.com/symfony/symfony/pull/28269 _(many of the fixes there are already part of 3.4)_
Does:
- Adds test coverage for Predis with RedisCluster
- Removes usage of key versioning when on RedisCluster, besides performance aspect of that it simplifies / aligning clear() handling across all clients
- reuse doDelete() from clear to make sure we call singular del calls when in predis cluster
Commits
-------
dacf17962b [Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Form] Fix debug form when using partial type name
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
Since https://github.com/symfony/symfony/pull/29452 (4.3) we have the possibility of passing a partial type name. This fixes the case where `debug:form dateTime` doesn't work as expected:
```bash
In FormRegistry.php line 89:
[Symfony\Component\Form\Exception\InvalidArgumentException]
Could not load type "dateTime": class does not implement "Symfony\Component\Form\FormTypeInterface".
```
Commits
-------
22b20cab10 Fix debug:form dateTime
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
---
Just some cleaning. See
https://github.com/symfony/symfony/pull/29146#issuecomment-44418654
Commits
-------
a608797165 [Workflow] Move code from ValidateWorkflowsPass to the FrameworkExtension
This PR was merged into the 4.3-dev branch.
Discussion
----------
[BrowserKit] Rename Client to Browser
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
`Client` is very generic and used in 3 places: BrowserKit, HttpKernel, and FramewrokBundle. Each Client extends another one. So, to make things clearer, I'd like to rename Client to Browser like this:
Symfony\Component\BrowerKit\Client -> AbstractBrowser
Symfony\Component\HttpKernel\Client -> HttpKernelBrowser
Symfony\Bundle\FrameworkBundle\Client -> KernelBrowser
The next PR will introduce an `HttpBrowser` based on the new HttpClient component :)
Commits
-------
dbe4f8605b renamed Client to Browser
This PR was merged into the 4.2 branch.
Discussion
----------
[Messenger] Fix README about BC promise
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | -
| License | MIT
| Doc PR | -
We don't have a BC *break* policy :)
Should be applied to MIME and HttpClient when merging into master.
Commits
-------
9b2af69403 Fix README about BC promise
This PR was merged into the 4.3-dev branch.
Discussion
----------
[HttpClient] yield a last chunk for completed responses also
| 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 | -
When a response completed, streaming it again yields no chunks right now.
This PR makes it yield a `LastChunk` - or an `ErrorChunk` when applicable.
The reasoning for the previous behavior was that streams should yield only activity from the network.
But this looks more complex to use in practice. The proposed behavior is simpler to reason about I think.
Commits
-------
e11ef7ed12 [HttpClient] yield a last chunk for completed responses also
* 4.2:
[Cache] Only delete one key at a time when on Predis + Cluster
[Validator] Add missing translations for Swedish locale
[Process] fix using argument $php of new PhpProcess()
[Routing] removed a useless var
[Routing] Fixed XML options resolution
This is slimmed down version of: https://github.com/symfony/symfony/pull/28269 _(many of the fixes here are already part of 3.4)_
Adds:
- Test coverage for Predis with RedisCluster
- Removes usage of key versioning when on RedisCluster, besides performance aspect of that simplify / aligning clear() handling across cases
* 3.4:
[Cache] Only delete one key at a time when on Predis + Cluster
[Validator] Add missing translations for Swedish locale
[Routing] removed a useless var
[Routing] Fixed XML options resolution
This PR was merged into the 3.4 branch.
Discussion
----------
[Cache] Only delete one key at a time when on Predis + Cluster
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| License | MIT
Makes sure deletes when on Predis Cluster is only done one by one as it's not able to send the keys to right cluster node like RedisCluster can.
_This is backport of logic from 4.x to fix this. With one tweak; make sure to only do this when on cluster so not all Predis users pay the penalty for it._
Commits
-------
f5ece20a83 [Cache] Only delete one key at a time when on Predis + Cluster