Commit Graph

41215 Commits

Author SHA1 Message Date
Grégoire Pineau
292021b146 [Messenger] Fixed DIC config when the messenger is not installed 2019-04-06 11:33:46 +02:00
Samuel ROZE
8f8c82e009 Make the in-memory transport resettable 2019-04-06 11:30:57 +02:00
Fabien Potencier
a45235e4b6 minor #30880 minor: remove the logger as it seems uneeded (Simperfit)
This PR was merged into the 4.3-dev branch.

Discussion
----------

minor: remove the logger as it seems uneeded

| Q             | A
| ------------- | ---
| Branch?       | master for features
| 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        | not needed
<!--
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.
-->

It seems that the logger is not used in here cc @nicolas-grekas, to close if it's the wanted code.
#euchackaton

Commits
-------

4fc603327d minor: remove the logger as it seems uneeded
2019-04-06 11:28:56 +02:00
Amrouche Hamza
4fc603327d
minor: remove the logger as it seems uneeded 2019-04-06 11:23:31 +02:00
Gary PEGEOT
fe759205c5 Add a "null://" transport 2019-04-06 11:18:10 +02:00
Fabien Potencier
0c8e8a50b0 bug #30878 [Console] Fix inconsistent result for choice questions in non-interactive mode (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] Fix inconsistent result for choice questions in non-interactive mode

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  |no
| BC breaks?    | no
| Deprecations? | n/a
| Tests pass?   | yes
| Fixed tickets | #30774
| License       | MIT
| Doc PR        | n/a

Commits
-------

198b895eac [Console] Fix inconsistent result for choice questions in non-interactive mode
2019-04-06 11:16:33 +02:00
Robin Chalas
198b895eac [Console] Fix inconsistent result for choice questions in non-interactive mode 2019-04-06 10:49:15 +02:00
Vincent Touzet
8f81f55a46 [Messenger] test DoctrineTransport on travis and appveyor 2019-04-05 16:21:26 +02:00
Nicolas Grekas
8977f74018 minor #30873 [HttpClient] Adjust logger messages and levels (lyrixx)
This PR was squashed before being merged into the 4.3-dev branch (closes #30873).

Discussion
----------

[HttpClient] Adjust logger messages and levels

| 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
-------

098a7ac1af [HttpClient] Adjust logger messages and levels
2019-04-05 16:18:36 +02:00
Grégoire Pineau
098a7ac1af [HttpClient] Adjust logger messages and levels 2019-04-05 16:18:29 +02:00
Fabien Potencier
d45ecefe0c minor #30869 [Validator] Define null return type for Constraint::getDefaultOption() (jaikdean)
This PR was submitted for the 4.2 branch but it was merged into the 3.4 branch instead (closes #30869).

Discussion
----------

[Validator] Define null return type for Constraint::getDefaultOption()

| 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        |

The `Constraint::getDefaultOption()` method is documented with a return type of `string`, but has no `return` statement. This behaviour is expected, as the return value is compared against `null` elsewhere in the code, but the docblock causes problems with static analysis when extending this class.

This PR corrects the documented return type to `string|null` and adds an explicit `return null`.

Commits
-------

03987f2ba5 Define null return type for Constraint::getDefaultOption()
2019-04-05 14:51:33 +02:00
Jaik Dean
03987f2ba5 Define null return type for Constraint::getDefaultOption() 2019-04-05 14:51:27 +02:00
Fabien Potencier
09e8d74627 feature #30537 [HttpClient] logger integration (antonch1989, nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] logger integration

| 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 | #30502   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        |

Commits
-------

26d15c8bbe [HttpClient] log requests, responses and pushes when they happen
fc6ba7efad [HttpClient] logger integration
2019-04-05 14:49:12 +02:00
Nicolas Grekas
26d15c8bbe [HttpClient] log requests, responses and pushes when they happen 2019-04-05 13:59:27 +02:00
Fabien Potencier
da4db91e13 minor #30864 [Messenger] fixing unused variable names (weaverryan)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] fixing unused variable names

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/30757/files#r272061245
| License       | MIT
| Doc PR        | n/a

Typo on the variable name - variables aren't needed anyways.

Cheers!

Commits
-------

f7ec2d388a fixing unused variable names
2019-04-04 14:57:32 +02:00
Ryan Weaver
f7ec2d388a fixing unused variable names 2019-04-04 07:32:05 -04:00
Anton Chernikov
fc6ba7efad [HttpClient] logger integration 2019-04-04 13:03:55 +02:00
Fabien Potencier
4dfb741330 bug #30858 [Messenger] Setup the doctrine transport when consuming (vincenttouzet)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] Setup the doctrine transport when consuming

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Currently there is an error when the table does not exists and we run the `messenger:consume` command.

This is because all queries made in the `get` method of the `Connection` are in a transaction. Therefore the table is not created.

To avoid this error I added a call to the `setup` method before starting the transaction.

I needed to add the SchemaSynchronizer as construct parameter for the tests

Commits
-------

b2f3b53253 [Messenger] Setup the doctrine transport when consuming
2019-04-04 10:38:26 +02:00
Vincent Touzet
b2f3b53253 [Messenger] Setup the doctrine transport when consuming 2019-04-03 23:16:34 +02:00
Fabien Potencier
de7d7a9ceb feature #30853 [Twig] Remove TemplatedEmail::template() (fabpot)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Twig] Remove TemplatedEmail::template()

| 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
| License       | MIT
| Doc PR        | n/a

I propose to remove `TemplatedEmail::template()` for several reasons:

 * There is no real benefit over using `textTemplate` and `htmlTemplate` (ok, you only have one template instead of two... but the text template can only be automatically created based on the HTML one, so...);

 * It means having more than one way to do the same thing (do I set the subject on the object directly or in the template for instance);

 * A major drawback that is not easy to spot: the template is HTML, so the `subject` and `text` block must be carefully crafted to avoid avoid HTML escaping.

Commits
-------

5e61b75893 [Twig] removed TemplatedEmail::template()
2019-04-03 20:46:31 +02:00
Fabien Potencier
5e61b75893 [Twig] removed TemplatedEmail::template() 2019-04-03 20:45:56 +02:00
Fabien Potencier
574097fd6a feature #30757 [Messenger] Adding MessageCountAwareInterface to get transport message count (weaverryan)
This PR was squashed before being merged into the 4.3-dev branch (closes #30757).

Discussion
----------

[Messenger] Adding MessageCountAwareInterface to get transport message count

| 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        | symfony/symfony-docs#11236

This adds a new optional interface that receivers should implement to give an approximate number of the messages "waiting" to be handled. Why? Because, with this, you could design a system that dynamically adds/removes worker processes if a specific transport is getting slammed and needs help. Creating that system could be something we discuss for core later, but this at least makes it possible - and means it could be implemented by the user or in a bundle... which I might do if we don't get it in core ;).

Commits
-------

fc5b0cf570 [Messenger] Adding MessageCountAwareInterface to get transport message count
2019-04-03 16:45:30 +02:00
Ryan Weaver
fc5b0cf570 [Messenger] Adding MessageCountAwareInterface to get transport message count 2019-04-03 16:45:22 +02:00
Fabien Potencier
9ed2f2b71f feature #28929 [HttpKernel][Framework] Locale aware services (neghmurken)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpKernel][Framework] Locale aware services

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Added a `LocaleAwareInterface` (and also a new service tag `kernel.locale_aware`) to be implemented on services that require the current locale at request time.
Also, refactored the actual Translator service to implement the overmentioned interface

Todo :

* [ ] Documention PR (will be written after some feedback)

Commits
-------

b9ac645d8b Locale aware service registration
2019-04-03 16:26:10 +02:00
Fabien Potencier
25db9e26c9 bug #30825 [Routing] Fix: annotation loader ignores method's default values (voronkovich)
This PR was merged into the 4.2 branch.

Discussion
----------

[Routing] Fix: annotation loader ignores method's default values

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? |no
| Tests pass?   | yes
| Fixed tickets | no
| License       | MIT
| Doc PR        | no

In some cases annotation loader ignores method param's default values.
For example this code won't work as expected:
```php
/**
 * @Route("/hello/{name<\w++>}", methods="GET", name="hello")
 */
public function hello(Request $request, string $name = 'World'): Response
{
    // If you try to open "/hello" path an exception (No route found for "GET /hello") will be thrown.
    return $this->json([
        'hello' => \sprintf('Hello, %s!', $name),
    ]);
}
```

Commits
-------

9b37793cbe [Routing] Fix: annotation loader ignores method's default values
2019-04-03 16:10:24 +02:00
Oleg Voronkovich
9b37793cbe [Routing] Fix: annotation loader ignores method's default values 2019-04-03 15:26:22 +02:00
Fabien Potencier
757ae748b7 fixed typo 2019-04-03 15:17:57 +02:00
Fabien Potencier
be66c44079 feature #29306 [DomCrawler] Optionally use html5-php to parse HTML (tgalopin)
This PR was squashed before being merged into the 4.3-dev branch (closes #29306).

Discussion
----------

[DomCrawler] Optionally use html5-php to parse HTML

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | WIP
| Fixed tickets | https://github.com/symfony/symfony/issues/29280, https://github.com/symfony/symfony/issues/28596
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/10700

This PR introduces the possibility to parse HTML content in the Crawler using the html5-php library (https://github.com/Masterminds/html5-php). This allows for better support of HTML5 and fix many unexpected behaviors and inconsistencies of the native DOM extension.

Commits
-------

4050ec4257 [DomCrawler] Optionally use html5-php to parse HTML
2019-04-03 15:17:25 +02:00
Titouan Galopin
4050ec4257 [DomCrawler] Optionally use html5-php to parse HTML 2019-04-03 15:17:16 +02:00
neghmurken
b9ac645d8b Locale aware service registration 2019-04-03 15:10:14 +02:00
Fabien Potencier
4ad54dad28 feature #30255 [DependencyInjection] Invokable Factory Services (zanbaldwin)
This PR was squashed before being merged into the 4.3-dev branch (closes #30255).

Discussion
----------

[DependencyInjection] Invokable Factory Services

| 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#11014

> Failing test is in the Twig bridge, and outside of the the scope of this PR.

Allow referencing invokable factory services, just as route definitions reference invokable controllers.
This functionality was also added for service configurators for consistency.

## Example

```php
<?php

namespace App\Factory;

class ServiceFactory
{
    public function __invoke(bool $debug)
    {
        return new Service($debug);
    }
}
```

```yaml
services:
    App\Service:
        # Prepend with "@" to differentiate between service and function.
        factory: '@App\Factory\ServiceFactory'
        arguments: [ '%kernel.debug%' ]
```

```xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services
               http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <!-- ... -->
        <service id="App\Service"
                 class="App\Service">
            <factory service="App\Factory\ServiceFactory" />
        </service>
    </services>
</container>
```

```php
<?php

use App\Service;
use App\Factory\ServiceFactory;
use Symfony\Component\DependencyInjection\Reference;

$container->register(Service::class, Service::class)
    ->setFactory(new Reference(ServiceFactory::class));
```

Commits
-------

23cb83f726 [DependencyInjection] Invokable Factory Services
2019-04-03 14:19:39 +02:00
Zan Baldwin
23cb83f726 [DependencyInjection] Invokable Factory Services 2019-04-03 14:19:31 +02:00
Fabien Potencier
248aff57d0 minor #30525 [PropertyInfo] Use a single cache item per method (deviantintegral)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[PropertyInfo] Use a single cache item per method

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29977
| License       | MIT
| Doc PR        | none

Replaces https://github.com/symfony/symfony/pull/30523 with a rebase to master.

This PR changes how property metadata is cached, significantly reducing the number of calls made between PHP and the backend cache. Instead of storing one cache item per method and set of arguments, a single cache item is stored per method. This matches well with real-world use, where most properties in an object will need to be inspected.

Note that the absolute numbers in the above PR are best case. In production environments where memcache is on a remote server, we were seeing multiple seconds consumed by memcache calls.

Commits
-------

2a4f8a11d4 [PropertyInfo] Use a single cache item per method
2019-04-03 13:59:42 +02:00
Fabien Potencier
8da76862fa feature #30843 [HttpClient] Add ScopingHttpClient::forBaseUri() + tweak MockHttpClient (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] Add ScopingHttpClient::forBaseUri() + tweak 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 allows creating scoped HTTP clients in one line:

```php
$client = ScopingHttpClient::forBaseUri($client, 'http://example.com');
```

`$client` now resolves relative URLs using the provided base URI.

If one also adds default options as 3rd argument, these will be applied conditionally when a URL matching the base URI is requested.

This PR also tweaks `MockHttpClient` to make it return `MockResponse` on its own when no constructor argument is provided, easing tests a bit.

Commits
-------

2b9b8e5707 [HttpClient] Add ScopingHttpClient::forBaseUri() + tweak MockHttpClient
2019-04-03 12:40:25 +02:00
Fabien Potencier
78afdd1c5f feature #30844 [Cache] add logs on early-recomputation and locking (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Cache] add logs on early-recomputation and locking

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

847a9bb86d [Cache] add logs on early-recomputation and locking
2019-04-03 12:38:27 +02:00
Fabien Potencier
69058e3873 minor #30847 [HttpKernel] Fix DebugHandlersListener constructor docblock (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Fix DebugHandlersListener constructor docblock

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

2e4020c430 [HttpKernel] Fix DebugHandlersListener constructor docblock
2019-04-03 12:28:32 +02:00
Fabien Potencier
4835136e7e bug #30846 [FrameworkBundle] fix HttpClient integration (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] fix HttpClient integration

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

HttpClient should be an optional dep.
Fixes compat of SecurityBundle 4.2 with FrameworkBundle 4.3 as spotted by the CI.

Commits
-------

3e7a47c0bf [FrameworkBundle] fix HttpClient integration
2019-04-03 12:15:50 +02:00
Fabien Potencier
99bf6c2417 feature #30520 [RouterDebugCommand] add link to Controllers (nicoweb)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[RouterDebugCommand] add link to Controllers

| Q             | A
| ------------- | ---
| Branch?       | master for features
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Adds a link to the controller method on your IDE from dev's terminal:

<img width="734" alt="pr-debug-router" src="https://user-images.githubusercontent.com/29813575/54141007-1f3bc400-4425-11e9-82d0-1b37498d4953.png">

Configuration in your `services.yaml`:

```yaml
parameters:
    debug.file_link_format: phpstorm://open?file=%%f&line=%%l
```

Commits
-------

e9fca21d6b [RouterDebugCommand] add link to Controllers
2019-04-03 12:12:27 +02:00
Fabien Potencier
539f4ca162 feature #30212 [DI] Add support for "wither" methods - for greater immutable services (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] Add support for "wither" methods - for greater immutable services

| 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/10991

Let's say we want to define an immutable service while still using traits for composing its optional features. A nice way to do so without hitting [the downsides of setters](https://symfony.com/doc/current/service_container/injection_types.html#setter-injection) is to use withers. Here would be an example:

```php
 class MyService
{
    use LoggerAwareTrait;
}

trait LoggerAwareTrait
{
    private $logger;

    /**
     * @required
     * @return static
     */
    public function withLogger(LoggerInterface $logger)
    {
        $new = clone $this;
        $new->logger = $logger;

        return $new;
    }
}

$service = new MyService();
$service = $service->withLogger($logger);
```

As you can see, this nicely solves the setter issues.

BUT how do you make the service container create such a service? Right now, you need to resort to complex gymnastic using the "factory" setting - manageable for only one wither, but definitely not when more are involved and not compatible with autowiring.

So here we are: this PR allows configuring such services seamlessly.
Using explicit configuration, it adds a 3rd parameter to method calls configuration: after the method name and its parameters, you can pass `true` and done, you just declared a wither:
```yaml
services:
    MyService:
        calls:
            - [withLogger, ['@logger'], true]
```

In XML, you could use the new `returns-clone` attribute on the `<call>` tag.

And when using autowiring, the code looks for the `@return static` annotation and turns the flag on if found.

There is only one limitation: unlike services with regular setters, services with withers cannot be part of circular loops that involve calls to wither methods (unless they're declared lazy of course).

Commits
-------

f455d1bd97 [DI] Add support for "wither" methods - for greater immutable services
2019-04-03 12:09:58 +02:00
Robin Chalas
2e4020c430 [HttpKernel] Fix DebugHandlersListener constructor docblock 2019-04-03 12:07:21 +02:00
Nicolas Grekas
3e7a47c0bf [FrameworkBundle] fix HttpClient integration 2019-04-03 12:06:15 +02:00
nicoweb
e9fca21d6b [RouterDebugCommand] add link to Controllers 2019-04-03 11:55:14 +02:00
Nicolas Grekas
2b9b8e5707 [HttpClient] Add ScopingHttpClient::forBaseUri() + tweak MockHttpClient 2019-04-03 11:54:40 +02:00
Fabien Potencier
3f75092a74 minor #30839 Skip Glob brace test when GLOB_BRACE is unavailable (wouterj)
This PR was merged into the 3.4 branch.

Discussion
----------

Skip Glob brace test when GLOB_BRACE is unavailable

| 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        | n/a

From [PHP.net](https://www.php.net/glob):

 > Note: The GLOB_BRACE flag is not available on some non GNU systems, like Solaris.

This means running the testsuite in e.g. a php-alpine container fails atm. This test should be skipped in these environments.

Commits
-------

ce38fe3e58 Skip Glob brace test when GLOB_BRACE is unavailable
2019-04-03 11:53:01 +02:00
Nicolas Grekas
bce6124f8f feature #30674 [FrameworkBundle] change the way http clients are configured by leveraging ScopingHttpClient (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] change the way http clients are configured by leveraging 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 allows configuring scoped HTTP clients ("scoped_clients" replaces the previous "clients" options):

```yaml
framework:
  http_client:
    max_host_connections: 4
    default_options:
      # ...
    scoped_clients:
      github_client:
        base_uri: https://api.github.com
        headers:
          Authorization: token abc123
          # ...
```

The base URI is turned into a scoping regular expression so that the token will be sent only when the `github_client` service is requesting the corresponding URLs.
When the base URI is too restrictive, the `scope` option can be used explicitly to define the regexp that URLs must match before any other options are applied.

~All defined scopes are passed to a new `scoping_http_client` service, that can be used to hit endpoints with authentication pre-configured for several hosts. Its named autowiring alias is `HttpClientInterface $scopingClient` (this cannot be done with `http_client` as we want safe defaults, e.g. credentials should not be used implicitly when writing webhooks/crawlers.)~

Commits
-------

f1a26b9aea [FrameworkBundle] change the way http clients are configured by leveraging ScopingHttpClient
2019-04-03 11:36:15 +02:00
Nicolas Grekas
847a9bb86d [Cache] add logs on early-recomputation and locking 2019-04-03 11:22:57 +02:00
Nicolas Grekas
f455d1bd97 [DI] Add support for "wither" methods - for greater immutable services 2019-04-03 11:14:18 +02:00
Nicolas Grekas
f1a26b9aea [FrameworkBundle] change the way http clients are configured by leveraging ScopingHttpClient 2019-04-03 10:47:24 +02:00
Fabien Potencier
8f3d80fce7 minor #30842 [FrameworkBundle] Rename WebTestAssertions -> WebTestAssertionsTrait (vudaltsov)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] Rename WebTestAssertions -> WebTestAssertionsTrait

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/30813#issuecomment-479387271
| License       | MIT
| Doc PR        |

Renamed according to the Symfony coding standards.

Commits
-------

2ae30a7e3d Rename WebTestAssertions -> WebTestAssertionsTrait
2019-04-03 10:44:55 +02:00
Valentin Udaltsov
2ae30a7e3d Rename WebTestAssertions -> WebTestAssertionsTrait 2019-04-03 11:22:11 +03:00