Commit Graph

47414 Commits

Author SHA1 Message Date
Fabien Potencier
a536342a96 bug #34114 [Console] SymonfyStyle - Check value isset to avoid PHP notice (leevigraham)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] SymonfyStyle - Check value isset to avoid PHP notice

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34093
| License       | MIT
| Doc PR        | n/a

This PR addresses the issue when a default value is not a valid choice. Currently this would throw a notice which outputs to the console.

This fix is a similar implementation to the `QuestionHelper`: https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Console/Helper/QuestionHelper.php#L63

Example console command and output can be found in the issue: #34093

Commits
-------

c9072c70ef Check value isset to avoid PHP notice
2020-02-03 10:58:05 +01:00
Nicolas Grekas
774a16150f Fix merge 2020-02-03 09:39:20 +01:00
Nicolas Grekas
a9b5fd23ef Merge branch '3.4' into 4.4
* 3.4:
  [Config] dont catch instances of Error
2020-02-03 09:22:04 +01:00
Nicolas Grekas
78641e0e88 bug #35557 [Config] dont catch instances of Error (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Config] dont catch instances of Error

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35445, fix #35256
| License       | MIT
| Doc PR        | -

Commits
-------

e94c3fb87d [Config] dont catch instances of Error
2020-02-03 09:12:41 +01:00
Nicolas Grekas
e94c3fb87d [Config] dont catch instances of Error 2020-02-03 09:11:57 +01:00
Nicolas Grekas
5da9cf315f minor #35561 [HttpClient] dont display any content when none has been collected (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpClient] dont display any content when none has been collected

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

36536c94d2 [HttpClient] dont display any content when none has been collected
2020-02-03 09:08:19 +01:00
Nicolas Grekas
a2d6d11085 bug #35562 [HttpClient] fix HttpClientDataCollector when handling canceled responses (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix HttpClientDataCollector when handling canceled responses

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35458
| License       | MIT
| Doc PR        | -

Commits
-------

303f9e5be5 [HttpClient] fix HttpClientDataCollector when handling canceled responses
2020-02-03 09:07:24 +01:00
Nicolas Grekas
6bb6473489 minor #35559 [FrameworkBundle] remove mention of the old Controller class (nicolas-grekas)
This PR was merged into the 5.0 branch.

Discussion
----------

[FrameworkBundle] remove mention of the old Controller class

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

This class is gone in 5.0.

Commits
-------

6620f8afd9 [FrameworkBundle] remove mention of the old Controller class
2020-02-03 09:06:11 +01:00
Nicolas Grekas
303f9e5be5 [HttpClient] fix HttpClientDataCollector when handling canceled responses 2020-02-02 18:41:51 +01:00
Nicolas Grekas
36536c94d2 [HttpClient] dont display any content when none has been collected 2020-02-02 18:36:34 +01:00
Nicolas Grekas
94bc1f7d3b [HttpKernel] allow using public aliases to reference controllers 2020-02-02 17:43:53 +01:00
Nicolas Grekas
6620f8afd9 [FrameworkBundle] remove mention of the old Controller class 2020-02-02 17:28:58 +01:00
Nicolas Grekas
00b6846978 feature #34871 [HttpClient] Allow pass array of callable to the mocking http client (Koc)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpClient] Allow pass array of callable to the mocking http client

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | not yet

For the now MockHttpClient allows pass closure as response factory. It useful for tests to perform assertions that expected request was sent. But If we are sending multiple sequental requests then it became a little bit tricky to perform assertions:

```php
<?php

$requestIndex = 0;
$expectedRequest = function ($method, $url, $options) use (&$requestIndex) {
    switch (++$requestIndex) {
        case 1:
            $this->assertSame('GET', $method);
            $this->assertSame('https://example.com/api/v1/customer', $url);

            return new MockResponse(CustomerFixture::CUSTOMER_RESPONSE);

        case 2:
            $this->assertSame('POST', $method);
            $this->assertSame('https://example.com/api/v1/customer/1/products', $url);
            $this->assertJsonStringEqualsJsonFile(CustomerFixture::CUSTOMER_PRODUCT_PAYLOAD, $options['json']);

            return new MockResponse();

        default:
            throw new \InvalidArgumentException('Too much requests');
    }
};

$client = new MockHttpClient($expectedRequest);
static::$container->set('http_client.example', $client);

$commandTester->execute(['--since' => '2019-01-01 00:05:00', '--until' => '2019-01-01 00:35:00']);

$this->assertSame(2, $requestIndex, 'All expected requests was sent.');
```

This PR introduces possibility to define multiple callable response factories and `getSentRequestsCount` method to make sure that each factory was called:

```php
<?php

$expectedRequests = [
    function ($method, $url, $options) {
        $this->assertSame('GET', $method);
        $this->assertSame('https://example.com/api/v1/customer', $url);

        return new MockResponse(CustomerFixture::CUSTOMER_RESPONSE);
    },
    function ($method, $url, $options) {
        $this->assertSame('POST', $method);
        $this->assertSame('https://example.com/api/v1/customer/1/products', $url);
        $this->assertJsonStringEqualsJsonFile(CustomerFixture::CUSTOMER_PRODUCT_PAYLOAD, $options['json']);

        return new MockResponse();
    },
];

$client = new MockHttpClient($expectedRequest);
static::$container->set('http_client.example', $client);

$commandTester->execute(['--since' => '2019-01-01 00:05:00', '--until' => '2019-01-01 00:35:00']);

$this->assertSame(2, $client->getSentRequestsCount(), 'All expected requests was sent.');
```

Also it adds a lot of tests.

Commits
-------

a36797d60e Allow pass array of callable to the mocking http client
2020-02-02 12:07:05 +01:00
Wouter J
f462285381 Show both missing packages in the same error message 2020-02-01 19:46:42 +01:00
Nicolas Grekas
985f64b5af Merge branch '5.0'
* 5.0:
  [Bridge/PhpUnit] dont conflict with phpunit 4.8
2020-02-01 16:58:03 +01:00
Nicolas Grekas
4cce23d9ca [Bridge/PhpUnit] dont conflict with phpunit 4.8 2020-02-01 16:57:56 +01:00
Nicolas Grekas
fb732df025 [FrameworkBundle] CS fix 2020-02-01 11:06:44 +01:00
Nicolas Grekas
ec8163d55f Merge branch '5.0'
* 5.0:
  Update PR template
  bumped Symfony version to 5.0.5
  updated VERSION for 5.0.4
  updated CHANGELOG for 5.0.4
  bumped Symfony version to 4.4.5
  updated VERSION for 4.4.4
  updated CHANGELOG for 4.4.4
2020-02-01 11:02:10 +01:00
Nicolas Grekas
bf6d38412a Merge branch '4.4' into 5.0
* 4.4:
  Update PR template
  bumped Symfony version to 4.4.5
  updated VERSION for 4.4.4
  updated CHANGELOG for 4.4.4
2020-02-01 11:01:49 +01:00
Nicolas Grekas
6f29d8d508 Merge branch '3.4' into 4.4
* 3.4:
  Update PR template
2020-02-01 11:01:17 +01:00
Nicolas Grekas
e02e74d036 Update PR template 2020-02-01 11:00:56 +01:00
Grégoire Pineau
a1e4222ee8 feature #30704 [PropertyInfo] Add accessor and mutator extractor interface and implementation on reflection (joelwurtz, Korbeil)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[PropertyInfo] Add accessor and mutator extractor interface and implementation on reflection

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30248, partially: #22190, #18016, #5013, #9336, #5219,
| License       | MIT
| Doc PR        | TODO

This PR brings accessor / mutator extraction on the PropertyInfo component,

There is no link to existing code, as IMO it should be in another PR as this will add a dependency on property access to the property info component and not sure this is something wanted (although, it will reduce a lot of code base on the property access component as a lot of code seems to be duplicated)

Code is extracted from #30248 also there is some new features (that can be removed if not wanted)

 * Allow extracting private accessor / mutator (will do a new PR that improve private extraction on reflection latter)
 * Allow extracting static accessor / mutators
 * Allow extracting constructor mutators

Current implementation try to be as close as the PropertyAccess implementation and i did not reuse some methods already available in the class as there is some differences in implementation, but maybe it will be a good time to make this consistent (Looking forward to your input) ?

Things that should be done in a new PR:

 * Linking property info to property access to remove a lot of duplicate code
 * Add a new system that allow adding Virtual Property based on this extractor

Commits
-------

0a92dab753 Rebase, fix tests, review & update CHANGELOG
fc250863a8 [PropertyInfo] Add accessor and mutator extractor interface and implementation on reflection
2020-01-31 15:04:25 +01:00
Fabien Potencier
5a96cf1df8 bumped Symfony version to 5.0.5 2020-01-31 13:54:52 +01:00
Fabien Potencier
03e6126338
Merge pull request #35541 from fabpot/release-5.0.4
released v5.0.4
2020-01-31 13:49:53 +01:00
Fabien Potencier
3c21b0270c updated VERSION for 5.0.4 2020-01-31 13:49:38 +01:00
Fabien Potencier
dca60a125e updated CHANGELOG for 5.0.4 2020-01-31 13:49:30 +01:00
Fabien Potencier
e3561cc2a3 bumped Symfony version to 4.4.5 2020-01-31 13:48:55 +01:00
Fabien Potencier
488093b6fb
Merge pull request #35540 from fabpot/release-4.4.4
released v4.4.4
2020-01-31 13:45:22 +01:00
Fabien Potencier
eac640a21a updated VERSION for 4.4.4 2020-01-31 13:45:06 +01:00
Fabien Potencier
f7021e4bd4 updated CHANGELOG for 4.4.4 2020-01-31 13:44:59 +01:00
Fabien Potencier
9d7e622e5b bug #35538 [FrameworkBundle] fixed suggesting deprecated WebServerBundle (jrushlow)
This PR was squashed before being merged into the 5.1-dev branch (closes #35538).

Discussion
----------

[FrameworkBundle] fixed suggesting deprecated WebServerBundle

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35495
| License       | MIT
| Doc PR        |

Removed suggestion to install `symfony/web-server-bundle` in console missing packages suggestions. The web server bundle was deprecated and no longer works with Symfony 5.x, .

Commits
-------

134129b5ad [FrameworkBundle] fixed suggesting deprecated WebServerBundle
2020-01-31 13:35:48 +01:00
Jesse Rushlow
134129b5ad [FrameworkBundle] fixed suggesting deprecated WebServerBundle 2020-01-31 13:35:43 +01:00
Nicolas Grekas
9b0a75cdf3 Merge branch '5.0'
* 5.0:
  Bump phpunit-bridge cache
2020-01-31 10:56:46 +01:00
Nicolas Grekas
ec587f431a Merge branch '4.4' into 5.0
* 4.4:
  Bump phpunit-bridge cache
2020-01-31 10:56:42 +01:00
Nicolas Grekas
3a69b8c53d Merge branch '4.3' into 4.4
* 4.3:
  Bump phpunit-bridge cache
2020-01-31 10:56:34 +01:00
Nicolas Grekas
6514fa3cc7 Merge branch '3.4' into 4.3
* 3.4:
  Bump phpunit-bridge cache
2020-01-31 10:56:21 +01:00
Nicolas Grekas
b2339b5e32 Bump phpunit-bridge cache 2020-01-31 10:55:33 +01:00
Nicolas Grekas
44e86a3f96 Merge branch '5.0'
* 5.0:
  [DI] fix CheckTypeDeclarationsPass
2020-01-31 10:49:48 +01:00
Nicolas Grekas
ecf3a53069 Merge branch '4.4' into 5.0
* 4.4:
  [DI] fix CheckTypeDeclarationsPass
2020-01-31 10:49:43 +01:00
Nicolas Grekas
103c460e4c [DI] fix CheckTypeDeclarationsPass 2020-01-31 10:49:27 +01:00
Nicolas Grekas
c3ad3eef65 Merge branch '5.0'
* 5.0:
  [Validator] fix access to uninitialized property when getting value
  [HttpClient] Fix regex bearer
  [Translator] Default value for 'sort' option in translation:update should be 'asc'
  [HttpKernel] Fix stale-if-error behavior, add tests
  [Intl] Provide more locale translations
  [Mailer] Fix STARTTLS support for Postmark and Mandrill
  [Messenger] Check for all serialization exceptions during message dec…
  [Messenger] Fix bug when using single route with XML config
  Fix exception message in Doctrine Messenger
  [DI]  CheckTypeDeclarationsPass now checks if value is type of parameter type
  [SecurityBundle] fix security.authentication.provider.ldap_bind arguments
  Improved error message when no supported user provider is found
  Mysqli doesn't support the named parameters used by PdoAdapter
  Added debug argument to decide if debug page should be shown or not
  Mysqli doesn't support the named parameters used by PdoStore
  Properly handle phpunit arguments for configuration file
  [Mailer] add tests for http transports
2020-01-31 10:20:53 +01:00
Nicolas Grekas
b0fc56477a Merge branch '4.4' into 5.0
* 4.4:
  [Validator] fix access to uninitialized property when getting value
  [HttpClient] Fix regex bearer
  [Translator] Default value for 'sort' option in translation:update should be 'asc'
  [HttpKernel] Fix stale-if-error behavior, add tests
  [Intl] Provide more locale translations
  [Mailer] Fix STARTTLS support for Postmark and Mandrill
  [Messenger] Check for all serialization exceptions during message dec…
  [Messenger] Fix bug when using single route with XML config
  Fix exception message in Doctrine Messenger
  [DI]  CheckTypeDeclarationsPass now checks if value is type of parameter type
  [SecurityBundle] fix security.authentication.provider.ldap_bind arguments
  Improved error message when no supported user provider is found
  Mysqli doesn't support the named parameters used by PdoAdapter
  Added debug argument to decide if debug page should be shown or not
  Mysqli doesn't support the named parameters used by PdoStore
  Properly handle phpunit arguments for configuration file
  [Mailer] add tests for http transports
2020-01-31 10:13:47 +01:00
Nicolas Grekas
f24320dd10 Merge branch '4.3' into 4.4
* 4.3:
  [Validator] fix access to uninitialized property when getting value
  [HttpClient] Fix regex bearer
  [HttpKernel] Fix stale-if-error behavior, add tests
  Improved error message when no supported user provider is found
  Properly handle phpunit arguments for configuration file
2020-01-31 10:11:17 +01:00
Nicolas Grekas
0f13d5a5fc Merge branch '3.4' into 4.3
* 3.4:
  [Validator] fix access to uninitialized property when getting value
  [HttpKernel] Fix stale-if-error behavior, add tests
  Improved error message when no supported user provider is found
2020-01-31 10:10:37 +01:00
Nicolas Grekas
e39d66eeee bug #35530 [HttpClient] Fix regex bearer (noniagriconomie)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Fix regex bearer

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34919
| License       | MIT
| Doc PR        | none

Small fix related to https://github.com/symfony/symfony/issues/34919#issuecomment-571145590

Commits
-------

cd0db78ab5 [HttpClient] Fix regex bearer
2020-01-31 10:08:14 +01:00
Fabien Potencier
aeea451433 bug #35532 [Validator] fix access to uninitialized property when getting value (greedyivan)
This PR was squashed before being merged into the 3.4 branch (closes #35532).

Discussion
----------

[Validator] fix access to uninitialized property when getting value

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35454
| License       | MIT
| Doc PR        |

In PHP 7.4, the type-hinted property is [uninitialized](https://wiki.php.net/rfc/typed_properties_v2#uninitialized_and_unset_properties) by default. So it needs to be checked before use.

Commits
-------

1edecf77c1 [Validator] fix access to uninitialized property when getting value
2020-01-31 09:56:30 +01:00
Ivan Grigoriev
1edecf77c1 [Validator] fix access to uninitialized property when getting value 2020-01-31 09:56:24 +01:00
Fabien Potencier
09bdaf5553 feature #35525 [Mailer] Randomize the first transport used by the RoundRobin transport (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Mailer] Randomize the first transport used by the RoundRobin transport

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #33723 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

When not using Messenger, and so sending only one message, the RoundRobin class does not work as the first transport is always used. This PR randomizes the first transport used by the class to mitigate that problem.

Commits
-------

6ebe83c14e [Mailer] Randomize the first transport used by the RoundRobin transport
2020-01-31 09:29:43 +01:00
Fabien Potencier
1bb485b1c7 feature #35116 [Validator] Add alpha3 option to country constraint (maxperrimond)
This PR was squashed before being merged into the 5.1-dev branch (closes #35116).

Discussion
----------

[Validator] Add alpha3 option to country constraint

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/12857

A following of #33791 and #32988 to add `alpha3` option also to `Country` constraint in the validator component.

Commits
-------

d6f34a5df6 [Validator] Add alpha3 option to country constraint
2020-01-31 09:29:05 +01:00
maxime.perrimond
d6f34a5df6 [Validator] Add alpha3 option to country constraint 2020-01-31 09:29:00 +01:00