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
----------
[FrameworkBundle] Deprecate the Templating component integration
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | yes
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
This PR deprecates the Templating component integration in FrameworkBundle. Only a few people use it because almost everybody use Twig or the serializer to output data. Removing this component will facilitate the maintenance.
Commits
-------
7169f4d3e2 [Templating] added more deprecation
224c891e10 [FrameworkBundle] Deprecate the Templating component integration
This PR was merged into the 4.3-dev branch.
Discussion
----------
[TwigBundle] Simplify code
| 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
| License | MIT
| Doc PR | n/a
<!--
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
-------
4d6967e756 [TwigBundle] simplified code
This PR was merged into the 3.4 branch.
Discussion
----------
[Tests] fixed compatbility of assertEquals(): void
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | ~
| License | MIT
| Doc PR | ~
Same as #30474.
Commits
-------
3f7bedc61f [Tests] fixed compatbility of assertEquals(): void
This PR was merged into the 4.2 branch.
Discussion
----------
Fixed usage of TranslatorInterface in form extension (fixes#30591)
| Q | A
| ------------- | ---
| Branch? | 4.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #30591
| License | MIT
This PR replaces the fixed usage of the deprecated TranslatorInterface in the form extension with a soft one accepting either the old or the new interface.
Commits
-------
d8092c7b7b Fixed usage of TranslatorInterface in form extension (fixes#30591)
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
----------
[HttpClient] changes minimal php version to use curl push function
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR |
Adding some changes to CurlHttpClient to avoid potential bugs in php < 7.2.17 or php < 7.3.4.
For more information check these bugs :
- https://bugs.php.net/bug.php?id=77747
- https://bugs.php.net/bug.php?id=77535
Resolve by the following commit by Nikic :
- 97f9fd6949
Commits
-------
01a663aea0 [HttpClient] changes minimal php version to use curl push function
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 merged into the 4.2 branch.
Discussion
----------
[Intl][4.2] Fix test
| Q | A
| ------------- | ---
| Branch? | 4.2
| 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 -->
Related to #30584 , the tests we're missing updated fixtures. My bad also 😅
Now fixed, while at it recompiled intl for 4.2 ✌️
Commits
-------
50b52cffdd [Intl][4.2] Fix test
This PR was merged into the 3.4 branch.
Discussion
----------
[Intl] Fix test
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| 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 -->
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
Creates some weird path, that breaks the next tests.
Commits
-------
226f522c4d [Intl] Fix test
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
This PR was submitted for the master branch but it was merged into the 3.4 branch instead (closes#30585).
Discussion
----------
[Validator] Add the missing translations for the Arabic (ar) locale
| Q | A
| ------------- | ---
| 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? | ? <!-- 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 -->
This pull request is for adding missing translations in validators.ar.xlf.
<!--
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
-------
5df08d67a7 [Validator] Add the missing translations for the Arabic (ar) locale
This PR was merged into the 4.3-dev branch.
Discussion
----------
Using AMQP auto-setup in all cases, not just in debug
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes and no
| New feature? | no
| BC breaks? | yes
| Deprecations? | no->
| Tests pass? | yes
| Fixed tickets | Related to #29476
| License | MIT
| Doc PR | TODO
Currently AMQP does auto-setup of queues/exchanges in dev-mode only. That's a problem for 2 reasons:
1) Behavior in prod is drastically different... and actually... there's not currently a way I know of (easily) to set things up on prod.
2) One of the properties of AMQP is that you typically DO want things to be set up at runtime, as you need them - you usually *do* want auto-setup.
This changes the behavior to auto-setup true always.
Commits
-------
503c20989c Using AMQP auto-setup in all cases, not just in debug