Commit Graph

47374 Commits

Author SHA1 Message Date
Fabien Potencier
59f0980fd9 feature #35560 [HttpKernel] allow using public aliases to reference controllers (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpKernel] allow using public aliases to reference controllers

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

This PR allows referencing a controller with an alias when needed. The use case I'm targetting is using `@Route` annotations on methods of the `App\Kernel` and have them work. This PR allows it.

Sidekick of https://github.com/symfony/recipes/pull/735

Commits
-------

94bc1f7d3b [HttpKernel] allow using public aliases to reference controllers
2020-02-03 17:34:59 +01:00
Nicolas Grekas
ff4892b778 bug #35573 [HttpClient] make response stream functionality consistent (kbond)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[HttpClient] make response stream functionality consistent

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

There are three ways of creating a stream from a response:

1. Calling `$response->toStream()` (if the response supports this)
2. Calling `StreamWrapper::createResource($response)`
3. Calling `StreamWrapper::createResource($response, $httpClient)` (note the second argument)

Currently, the 3rd method creates a stream that is not rewindable (the other two are). The first commit adds tests showing the inconsistencies (1 test fails). The second commit is a fix to make the 3 ways consistent.

See https://twitter.com/nicolasgrekas/status/1224047079422599168 for reference.

Commits
-------

64f9111686 [HttpClient] make response stream functionality consistent
2020-02-03 16:32:52 +01:00
Kevin Bond
64f9111686 [HttpClient] make response stream functionality consistent 2020-02-03 16:32:43 +01:00
Robin Chalas
12ca64649b Merge branch '5.0'
* 5.0:
  [Phpunit] Fix running skipped tests expecting only deprecations
  Fix merge
  [Config] dont catch instances of Error
  [HttpClient] fix HttpClientDataCollector when handling canceled responses
  [FrameworkBundle] remove mention of the old Controller class
  [DependencyInjection] #35505 Fix typo in test name
  [Yaml][Inline] Fail properly on empty object tag and empty const tag
  Check non-null type for numeric type
  Check value isset to avoid PHP notice
  bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
2020-02-03 14:51:48 +01:00
Robin Chalas
5da1bcfb5c Merge branch '4.4' into 5.0
* 4.4:
  [Phpunit] Fix running skipped tests expecting only deprecations
  Fix merge
  [Config] dont catch instances of Error
  [HttpClient] fix HttpClientDataCollector when handling canceled responses
  [DependencyInjection] #35505 Fix typo in test name
  [Yaml][Inline] Fail properly on empty object tag and empty const tag
  Check non-null type for numeric type
  Check value isset to avoid PHP notice
  bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
2020-02-03 14:51:17 +01:00
Nicolas Grekas
ed7bb826fb Merge branch '3.4' into 4.4
* 3.4:
  [Phpunit] Fix running skipped tests expecting only deprecations
  [DependencyInjection] #35505 Fix typo in test name
  [Yaml][Inline] Fail properly on empty object tag and empty const tag
  Check non-null type for numeric type
  Check value isset to avoid PHP notice
  bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
2020-02-03 11:46:43 +01:00
Nicolas Grekas
af46fd6961 minor #35507 [DependencyInjection] Fix typo in test name (signor-pedro)
This PR was merged into the 3.4 branch.

Discussion
----------

[DependencyInjection] Fix typo in test name

Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer.

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes (technically)
| New feature?  | no
| Deprecations? | no
| Tickets       | #35505
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Commits
-------

9cbfad5853 [DependencyInjection] #35505 Fix typo in test name
2020-02-03 11:21:26 +01:00
Nicolas Grekas
f758eca8b7 bug #35332 [Yaml][Inline] Fail properly on empty object tag and empty const tag (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml][Inline] Fail properly on empty object tag and empty const tag

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

Rework of https://github.com/symfony/symfony/pull/35208 to not end up in `parseScalar` with an empty string or a boolean (and thus, avoid unfriendly error such as `Trying to access array offset on value of type bool`).

Ping @xabbuh

Commits
-------

bdf02c0a7e [Yaml][Inline] Fail properly on empty object tag and empty const tag
2020-02-03 11:17:31 +01:00
Nicolas Grekas
1f053f99e4 bug #35489 [PhpUnitBridge] Fix running skipped tests expecting only deprecations (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[PhpUnitBridge] Fix running skipped tests expecting only deprecations

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

If a test class has unsatisfied `@requires` and contains test methods expecting deprecation only, you get:

> Fatal error: Uncaught Error: Call to a member function beStrictAboutTestsThatDoNotTestAnything() on null in ./symfony/symfony-dev/vendor/symfony/phpunit-bridge/Legacy/SymfonyTestsListenerTrait.php:229

Spotted in #34925's build.

Commits
-------

6b02362c5b [Phpunit] Fix running skipped tests expecting only deprecations
2020-02-03 11:14:10 +01:00
Robin Chalas
6b02362c5b [Phpunit] Fix running skipped tests expecting only deprecations 2020-02-03 11:13:58 +01:00
Fabien Potencier
51444877d1 bug #35161 [FrameworkBundle] Check non-null type for numeric type (Arman-Hosseini)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Check non-null type for numeric type

$maxAge and $sharedAge can both be zero

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| License       | MIT

Commits
-------

2797867ae9 Check non-null type for numeric type
2020-02-03 11:04:11 +01:00
Fabien Potencier
6c96706381 bug #34059 [DomCrawler] Skip disabled fields processing in Form (sbogx)
This PR was merged into the 3.4 branch.

Discussion
----------

[DomCrawler] Skip disabled fields processing in Form

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

Commits
-------

c73b042044 bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
2020-02-03 11:01:18 +01:00
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
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