Commit Graph

45091 Commits

Author SHA1 Message Date
Thomas Calvet abef506e89 Deprecate things that prevent \Throwable from bubbling down 2019-11-05 18:23:20 +01:00
Nicolas Grekas 4cd3dc8d7f Merge branch '4.3' into 4.4
* 4.3: (26 commits)
  [Console] Fix #33915, Detect dimensions using mode CON if vt100 is supported
  [HttpKernel][DataCollectorInterface] Ease compatibility
  Add tests to ensure defaultLocale is properly passed to the URL generator
  [DependencyInjection] Fix broken references in tests
  [HttpClient] Retry safe requests when then fail before the body arrives
  Avoid using of kernel after shutdown
  Simplify PHP CS Fixer configuration
  [PropertyInfo] Fixed type extraction for nullable collections of non-nullable elements
  [FrameworkBundle] [HttpKernel] fixed correct EOL and EOM month
  [Serializer] Fix property name usage for denormalization
  Name test accordingly to the tested class
  Fix MockFileSessionStorageTest::sessionDir being used after it's unset
  bumped Symfony version to 4.3.7
  updated VERSION for 4.3.6
  updated CHANGELOG for 4.3.6
  bumped Symfony version to 3.4.34
  updated VERSION for 3.4.33
  update CONTRIBUTORS for 3.4.33
  updated CHANGELOG for 3.4.33
  [HttpClient] Fix perf issue when doing thousands of requests with curl
  ...
2019-11-05 17:11:08 +01:00
Nicolas Grekas 620e8942a2 bug #34085 [Console] Detect dimensions using mode CON if vt100 is supported (rtek)
This PR was merged into the 4.3 branch.

Discussion
----------

[Console] Detect dimensions using mode CON if vt100 is supported

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

This fixes color support detection for users of Win10 + git-bash.  If vt100 support is detected, the terminal will not try to use `stty` to test for dimensions. Calling such command implicitly disables vt100 support on STDOUT.

Commits
-------

fdeceff85e [Console] Fix #33915, Detect dimensions using mode CON if vt100 is supported
2019-11-05 16:00:49 +01:00
rtek fdeceff85e [Console] Fix #33915, Detect dimensions using mode CON if vt100 is supported 2019-11-05 16:00:28 +01:00
Nicolas Grekas e0c7ab0700 bug #34199 [HttpClient] Retry safe requests using HTTP/1.1 when HTTP/2 fails (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Retry safe requests using HTTP/1.1 when HTTP/2 fails

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

cURL support of HTTP/2 is not as robust as HTTP/1.1. When doing >1k requests, the stream can break for buggy reasons. New versions of cURL are fixed already, but let's make our logic more resilient anyway, and switch to HTTP/1.1 when a *safe* request fails for send/recv reasons.

Commits
-------

9f7cd66004 [HttpClient] Retry safe requests when then fail before the body arrives
2019-11-05 15:50:06 +01:00
Nicolas Grekas 448d0d6728 Merge branch '3.4' into 4.3
* 3.4:
  [DependencyInjection] Fix broken references in tests
  Avoid using of kernel after shutdown
  Simplify PHP CS Fixer configuration
  [FrameworkBundle] [HttpKernel] fixed correct EOL and EOM month
  Fix MockFileSessionStorageTest::sessionDir being used after it's unset
  bumped Symfony version to 3.4.34
  updated VERSION for 3.4.33
  update CONTRIBUTORS for 3.4.33
  updated CHANGELOG for 3.4.33
  [Stopwatch] Fixed a bug in stopwatch event getStartTime
  [Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods
  Adding some validations tags on validators.et.xlf
  add missing translation for 94 (it)
2019-11-05 15:48:09 +01:00
Nicolas Grekas a2bccc6910 minor #33950 [FrameworkBundle] Avoid using of kernel after shutdown in KernelTestCase (alexander-schranz)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Avoid using of kernel after shutdown in KernelTestCase

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

I had sadly something like this in my codebase:

```php
if (!static::$kernel) {
    static::bootKernel();
}
```

As the $kernel is never set again to null a old $kernel was still there. I would not only set the $container also the $kernel variable to null. ~~As this could be a BC Break I'm targeting master~~.

Commits
-------

49b58ed45e Avoid using of kernel after shutdown
2019-11-05 15:21:40 +01:00
Nicolas Grekas d056c17286 minor #34188 [PhpUnitBridge] Also search for composer.phar in git root folder (MaPePeR)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[PhpUnitBridge] Also search for composer.phar in git root folder

| Q             | A
| ------------- | ---
| Branch?       | 4.4 for features
| Bug fix?      | kindof
| New feature?  | addition to existing feature
| Deprecations? | no
| Tickets       | Related: https://github.com/symfony/symfony/issues/26637#issuecomment-390749681
| License       | MIT

When you don't have a system `composer` installation, but a `composer.phar` in the project folder, you cannot use the `simple-phpunit` script from a subfolder of the project with e.g. `../vendor/bin/simple-phpunit`.

This change also searches for the `composer.phar` in the current git root folder if it was not found at any other places to increase the likelihood of it being found.

Commits
-------

97fd204d16 [PhpUnitBridge] Also search for composer.phar in git root folder
2019-11-05 14:50:02 +01:00
MaPePeR 97fd204d16 [PhpUnitBridge] Also search for composer.phar in git root folder 2019-11-05 14:49:56 +01:00
Nicolas Grekas 1a573c387e minor #34230 [HttpKernel][DataCollectorInterface] Ease compatibility (fancyweb)
This PR was submitted for the 3.4 branch but it was merged into the 4.3 branch instead.

Discussion
----------

[HttpKernel][DataCollectorInterface] Ease compatibility

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/33065/files#r342109866
| License       | MIT
| Doc PR        | -

To ease data collectors being compatible from 4.3 to 5.0.

Commits
-------

761df46993 [HttpKernel][DataCollectorInterface] Ease compatibility
2019-11-05 14:42:35 +01:00
Thomas Calvet 761df46993 [HttpKernel][DataCollectorInterface] Ease compatibility 2019-11-05 14:42:27 +01:00
Nicolas Grekas dc8bb309b5 feature #34184 [VarDumper] display the method we're in when dumping stack traces (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[VarDumper] display the method we're in when dumping stack traces

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

This PR adds the line in blue:
![image](https://user-images.githubusercontent.com/243674/68152006-131bee00-ff43-11e9-8270-1d547732a7e5.png)

Without it, we're missing some context as the method is from a trait. This allows knowing which class is actually importing and using the method.

Commits
-------

23600cc8e1 [VarDumper] display the method we're in when dumping stack traces
2019-11-05 00:35:38 +01:00
Nicolas Grekas a56ac78269 bug #34192 [Routing] Fix URL generator instantiation (X-Coder264, HypeMC)
This PR was merged into the 4.3 branch.

Discussion
----------

[Routing] Fix URL generator instantiation

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

After merging my fix (PR https://github.com/symfony/symfony/pull/31023) from the 4.2 branch to 4.3 (which was master at the time) one code path which instantiates the url generator was missed. This new code path was added via https://github.com/symfony/symfony/pull/28865 and was missed during the merge because there was no merge conflict there as that code path didn't exist on 4.2.

So the current state on the 4.3 branch is:

- https://github.com/symfony/symfony/blob/v4.3.5/src/Symfony/Component/Routing/Router.php#L356 (default locale is properly passed to the constructor)

- https://github.com/symfony/symfony/blob/v4.3.5/src/Symfony/Component/Routing/Router.php#L372 (default locale is **NOT** properly passed to the constructor)

- https://github.com/symfony/symfony/blob/v4.3.5/src/Symfony/Component/Routing/Router.php#L378 (default locale is properly passed to the constructor)

I noticed this in my app because tests started to fail on the branch where we are upgrading our app from SF 4.2 to 4.3 due to this. This PR fixes the inconsistency (now the default locale is passed on all three places) which fixes the bug.

Commits
-------

9aa66e2f59 Add tests to ensure defaultLocale is properly passed to the URL generator
16c9bafee4 Fix URL generator instantiation
2019-11-04 21:23:21 +01:00
HypeMC 9aa66e2f59 Add tests to ensure defaultLocale is properly passed to the URL generator 2019-11-04 21:23:03 +01:00
Nicolas Grekas 9cebe4bc09 minor #34229 [DependencyInjection] Fix broken references in tests (Chi-teck)
This PR was submitted for the master branch but it was merged into the 3.4 branch instead.

Discussion
----------

[DependencyInjection] Fix broken references in tests

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  |no
| Deprications? | no
| License       | MIT

Commits
-------

bd1ead251c [DependencyInjection] Fix broken references in tests
2019-11-04 20:58:33 +01:00
Chi-teck bd1ead251c [DependencyInjection] Fix broken references in tests 2019-11-04 20:58:26 +01:00
Nicolas Grekas 23600cc8e1 [VarDumper] display the method we're in when dumping stack traces 2019-11-04 20:39:01 +01:00
Nicolas Grekas 9f7cd66004 [HttpClient] Retry safe requests when then fail before the body arrives 2019-11-04 16:10:28 +01:00
Fabien Potencier 14080ce5b5 minor #34197 [ErrorRenderer] Show generic message in non-debug mode (yceruto)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorRenderer] Show generic message in non-debug mode

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

I agree with @Tobion here https://github.com/symfony/symfony/pull/34158#issuecomment-548181099, so let's always show the detail message, but for 5xx errors we'll send a generic message instead.

/cc @dunglas wdyt?

Commits
-------

45f1a5ee06 Show generic message in non-debug mode
2019-11-04 13:48:39 +01:00
Fabien Potencier e4c661901e feature #33732 [Console] Rename some methods related to redraw frequency (javiereguiluz)
This PR was squashed before being merged into the 4.4 branch (closes #33732).

Discussion
----------

[Console] Rename some methods related to redraw frequency

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

In #26339 we added `preventRedrawFasterThan()` and `forceRedrawSlowerThan()`. While merging the docs for them (https://github.com/symfony/symfony-docs/pull/12364) I thought that the method names are a bit hard to understand.

In this PR I propose a renaming for your consideration. Thanks!

In the following example, we want to update the progress bar every 100 iterations, but not faster than 100ms or slower than 200ms.

**Before**

```php
$progressBar = new ProgressBar($output, 50000);
$progressBar->start();

$progressBar->setRedrawFrequency(100);
$progressBar->preventRedrawFasterThan(0.1);
$progressBar->forceRedrawSlowerThan(0.2);
```

**After**

```php
$progressBar = new ProgressBar($output, 50000);
$progressBar->start();

$progressBar->setRedrawFrequency(100);
$progressBar->maxRefreshInterval(0.1);
$progressBar->minRefreshInterval(0.2);
```

Commits
-------

e6ee7b07f3 [Console] Rename some methods related to redraw frequency
2019-11-04 13:46:19 +01:00
Javier Eguiluz e6ee7b07f3 [Console] Rename some methods related to redraw frequency 2019-11-04 13:46:13 +01:00
Nicolas Grekas 13dd18c8a6 feature #31587 [Routing][Config] Allow patterns of resources to be excluded from config loading (tristanbes)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing][Config] Allow patterns of resources to be excluded from config loading

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

The PR will fix the following RFC: #31516

Like resource loading for services, this PR offers a way to exclude patterns of resources like:

```yml
// config/routes/annotations.yaml
controllers:
    resource: ../../src/Controller/*
    type: annotation
    exclude: '../src/Controller/{DebugEmailController}.php'
```

All the annotation routes inside `Controller/` will be loaded in this example except all the one present inside the `Controller/DebugEmailController.php`

Commits
-------

332ff8811c [Routing][Config] Allow patterns of resources to be excluded from config loading
2019-11-04 11:53:20 +01:00
Nicolas Grekas 29fd51f272 feature #32256 [DI] Add compiler pass and command to check that services wiring matches type declarations (alcalyn, GuilhemN, nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] Add compiler pass and command to check that services wiring matches type declarations

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

PR replacing https://github.com/symfony/symfony/pull/27825.

It adds a `lint:container` command asserting the type hints used in your code are correct.

Commits
-------

8230a1543e Make it really work on real apps
4b3e9d4c96 Fix comments, improve the feature
a6292b917b [DI] Add compiler pass to check arguments type hint
2019-11-04 11:27:29 +01:00
Fabien Potencier e057a9c89f bug #34134 [Messenger] fix retry of messages losing the routing key and properties (Tobion)
This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] fix retry of messages losing the routing key and properties

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

Messages sent for retry in rabbitmq lost the routing key and properties like the priority. Now we read those original properties and sent the retry message with the same properties (unless those properties have already been set manually before).

Commits
-------

75c674debc [Messenger] fix retry of messages losing the routing key and properties
2019-11-04 07:59:16 +01:00
Fabien Potencier ee0988cb06 minor #34227 Simplify PHP CS Fixer configuration (keradus)
This PR was merged into the 3.4 branch.

Discussion
----------

Simplify PHP CS Fixer configuration

Possible after updating PHP CS Fixer on fabbot.io to 2.16

Commits
-------

0b0e5b50d5 Simplify PHP CS Fixer configuration
2019-11-03 20:59:03 +01:00
Alexander Schranz 49b58ed45e Avoid using of kernel after shutdown 2019-11-03 20:32:26 +01:00
Fabien Potencier 0af10ccd0d minor #34160 Adding some validations tags on validators.et.xlf (glodzienski)
This PR was merged into the 3.4 branch.

Discussion
----------

Adding some validations tags on validators.et.xlf

| Q             | A
| ------------- | ---
| Branch?       | 4.4 for features / 3.4 or 4.3 for bug fixes <!-- see below -->
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/30160
| License       | MIT

I saw an issue in the **Issues Page** and i want to help to improve the repository, even with a simple modification

Commits
-------

16bd71b5b1 Adding some validations tags on validators.et.xlf
2019-11-03 18:41:53 +01:00
Fabien Potencier 78bdf1a307 minor #34153 [Validator] add missing translation for 94 (it) (garak)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] add missing translation for 94 (it)

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

Italian translation for validator is missing last item (id 94)

Commits
-------

1dc7ce1159 add missing translation for 94 (it)
2019-11-03 18:21:08 +01:00
Fabien Potencier 9162892fd4 bug #34181 [Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods (TimoBakx)
This PR was merged into the 3.4 branch.

Discussion
----------

[Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods

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

When running multiple periods in StopwatchEvent (start multiple times and not stop them all), the getDuration() method would return unexpected values.

This was because at every stop, the last entry in the `started` array was removed, while the `getDuration` method was still expecting all the started events to still be there.

Now, when calling `getDuration`, the duration of all the finished periods are added together with the unfinished counts.

Commits
-------

af00d8deab [Stopwatch] Fixed bug in getDuration when counting multiple ongoing periods
2019-11-03 18:17:59 +01:00
Dariusz Ruminski 0b0e5b50d5 Simplify PHP CS Fixer configuration 2019-11-03 15:37:51 +01:00
Fabien Potencier 142bdddece bug #34165 [PropertyInfo] Fixed type extraction for nullable collections of non-nullable elements (happyproff)
This PR was squashed before being merged into the 4.3 branch (closes #34165).

Discussion
----------

[PropertyInfo] Fixed type extraction for nullable collections of non-nullable elements

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

When an annotation is declared as `int[]|null`, it is handled like `(int|null)[]|null`. So array values are also nullable.

Now this behavior is fixed that `int[]|null` is either a collection of integers only or null.

How to reproduce:
```php
class Dummy
{
    /** @var int[]|null */
    public $nullableCollectionOfNonNullableElements;
}

/** @var Type[] $types */
$types = (new PhpDocExtractor())->getTypes(Dummy::class, 'nullableCollectionOfNonNullableElements');

$collectionType = $types[0];
assert($collectionType->isCollection() === true); // OK
assert($collectionType->isNullable() === true); // OK
assert($collectionType->getCollectionValueType()->getBuiltinType() === Type::BUILTIN_TYPE_INT); // OK
assert($collectionType->getCollectionValueType()->isNullable() === false); // FAILED
```

Commits
-------

5e394c40f0 [PropertyInfo] Fixed type extraction for nullable collections of non-nullable elements
2019-11-03 13:19:19 +01:00
Stanislav Gamayunov 5e394c40f0 [PropertyInfo] Fixed type extraction for nullable collections of non-nullable elements 2019-11-03 13:19:12 +01:00
Fabien Potencier 767b265681 bug #34179 [Stopwatch] Fixed a bug in StopwatchEvent::getStartTime (TimoBakx)
This PR was merged into the 3.4 branch.

Discussion
----------

[Stopwatch] Fixed a bug in StopwatchEvent::getStartTime

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

When using a `StopwatchEvent` with an `$origin` that's smaller than the first start time, calling `getStartTime()` before ending the event will give `0` instead of the correct number.

The proposed fix in #34088 fixes this.

Commits
-------

b2b7eab949 [Stopwatch] Fixed a bug in stopwatch event getStartTime
2019-11-03 13:11:53 +01:00
Fabien Potencier a1b507974e bug #34203 [FrameworkBundle] [HttpKernel] fixed correct EOL and EOM month (erics86)
This PR was submitted for the master branch but it was merged into the 3.4 branch instead (closes #34203).

Discussion
----------

[FrameworkBundle] [HttpKernel] fixed correct EOL and EOM month

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

Commits
-------

613717d71f [FrameworkBundle] [HttpKernel] fixed correct EOL and EOM month
2019-11-03 13:06:46 +01:00
Eric Schildkamp 613717d71f [FrameworkBundle] [HttpKernel] fixed correct EOL and EOM month
* Added a hardcoded day 01 in order to output the proper month November
which is the correct EOL and EOM month.
* \DateTime::createFromFormat('mY') will output December for every month
where day 31 exists.
2019-11-03 13:06:33 +01:00
Fabien Potencier 08a218c79f bug #34218 [Security] Fix SwitchUserToken wrongly deauthenticated (chalasr)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Fix SwitchUserToken wrongly deauthenticated

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

Commits
-------

e47b31c43c [Security] Fix SwitchUserToken wrongly deauthenticated
2019-11-03 13:01:14 +01:00
Fabien Potencier 0c784d2879 feature #32061 Add new Form WeekType (dFayet)
This PR was merged into the 4.4 branch.

Discussion
----------

Add new Form WeekType

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #32029
| License       | MIT
| Doc PR        | <!--symfony/symfony-docs#...--> coming soon

----
#### Update

After the first try, I've updated the field to have more options, and be more "straight".
The field acts like the `DateTimeType` or `TimeType`,  various fields type (pure text, html5 type, select boxes), data validation, ....

For that I took the choice to update the `DateTimeToStringTransformer` and `DateTimeToArrayTransformer` to make them work with weeks format.

I was not sure if it was better to update them or create new ones, WDYT?

Before addind tests and docs, it would be nice to have your first thoughts/comments 😊

Do you need/want a small test repo?

Commits
-------

c4a2f026e0 Add new Form WeekType
2019-11-03 12:59:10 +01:00
Fabien Potencier ef66ad3890 feature #33954 Form theme: support Bootstrap 4 custom switches (romaricdrigon)
This PR was merged into the 4.4 branch.

Discussion
----------

Form theme: support Bootstrap 4 custom switches

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

Hello,

At the moment, Symfony form theme supports [custom checkboxes](https://getbootstrap.com/docs/4.3/components/forms/#checkboxes) through an extra class in `label_attr`.
Bootstrap4 introduced also [custom switches](https://getbootstrap.com/docs/4.3/components/forms/#switches), which has exactly the same HTML markup, but use a different class. This PR slightly modify `bootstrap_4_layout` to handle it.

![image](https://user-images.githubusercontent.com/919405/66651725-0eaa3100-ec34-11e9-8b68-94324730ac80.png)

Some reasons why I think supporting those have its place in Symfony:
 - those are getting common in UI right now, it is a common use case
 - it is complementary to normal checkboxes, and works the same way: required attribute, validation error, and so on are supported immediately
 - implementing it yourself in your form theme is actually tricky, because of the way checkbox are handled (ie., `form_label` called inside `form_widget` with a `{ widget: parent() }`). You have to overwrite the whole fragment, otherwise you get an infinite recursion.

Finally, some screenshots and code examples.

Custom checkbox (as at the moment):
![image](https://user-images.githubusercontent.com/919405/66652982-41a1f400-ec37-11e9-813f-4b39087e89e7.png)
```php
    ->add('test', CheckboxType::class, [
        'label_attr' => [
            'class' => 'checkbox-custom',
        ],
    ])
```
Custom switch (proposed):
![image](https://user-images.githubusercontent.com/919405/66652902-1919fa00-ec37-11e9-98f3-9340b01b2335.png)
```php
    ->add('test', CheckboxType::class, [
        'label_attr' => [
            'class' => 'switch-custom',
        ],
    ])
```

Commits
-------

99f59e262f Supporting Bootstrap 4 custom switches
2019-11-03 12:57:04 +01:00
Fabien Potencier 25baf75edb Fix CS 2019-11-03 12:51:47 +01:00
Fabien Potencier 71873fc770 feature #33854 [DI] Add ability to choose behavior of decorations on non existent decorated services (mtarld)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] Add ability to choose behavior of decorations on non existent decorated services

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

# Handling decorations on non existent decorated services
Handle decorations on non existent decorated services by either throwing the service not found exception, silently ignoring services (decorator & decorated) all together or leave the decorated service to null (current behavior)

Something almost similar to how missing services as parameters are handles.

## Yaml configuration
```yaml
decorator:
    decorates: decorated
    decoration_on_invalid: ignore
```
Available values: `exception`, `ignore`, `null`. `exception` if nothing is specified.

## Xml configuration
```xml
<service id="decorator" decorates="decorated" decoration-on-invalid="ignore" />
```
Available values: `exception`, `ignore`, `null`. `exception` if nothing is specified.

## Behavior
- `exception`: Throws a `ServiceNotFoundException` telling that the decorator's dependency is missing
- `ignore`: Remove decorator definition. Decorator and decorated will not be available at all.
- `null`: Keep decorator but set decorated to null. Therefore, decorator `__construct` should be written with a nullable decorated dependency (`public function __contruct(?DecoratedInterface $decorated) {}`) and check should be done in other methods

Commits
-------

f167c77eaf Handle non existent decorated services
2019-11-03 12:49:07 +01:00
Fabien Potencier 22976d0f54 bug #34035 [Serializer] Fix property name usage for denormalization (antograssiot)
This PR was squashed before being merged into the 4.3 branch (closes #34035).

Discussion
----------

[Serializer] Fix property name usage for denormalization

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

Using the `@SerializedName()` and passing it an existing property name affects the deserialization even if `@Groups()` are not supposed to be involved.

## How to reproduce

Given the following class
```php

class Foo
{
    /**
     * @Group("list")
     */
    private $bar;

    public function setBar($bar)
    {
        $this->bar = $bar;
    }
    public function getBar()
    {
        return $this->bar;
    }
    /**
     * @Groups({"list:export"})
     * @SerializedName("bar")
     */
    public function getBarForExport()
    {
        return $this->bar.' Rocks';
    }
}
```

This allow us to change the content of the property based on the normalization context.

```php
$obj = new Foo();
$obj->setBar('Api Platform');

$data = $normalizer->normalize($obj, null, ['groups' => ["list"]]);
// $data => ['bar' => 'Api Platform'] as expected

$data = $normalizer->normalize($obj, null, ['groups' => ["list:export"]]);
// $data => ['bar' => 'Api Platform Rocks'] as expected

$obj = $normalizer->denormalize(['bar' => 'Api Platform'], Foo::class, null, ['groups' => ['list']]);
// $obj->getBar()  would return null instead of 'Api Platform' as expected.
```

Commits
-------

8ca4a3f345 [Serializer] Fix property name usage for denormalization
2019-11-03 12:04:07 +01:00
Anto 8ca4a3f345 [Serializer] Fix property name usage for denormalization 2019-11-03 12:04:02 +01:00
Fabien Potencier 69c0fc6727 minor #34226 Name test accordingly to the tested class (OskarStark)
This PR was merged into the 4.3 branch.

Discussion
----------

Name test accordingly to the tested class

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained 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 branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

2ce086ab29 Name test accordingly to the tested class
2019-11-03 11:51:12 +01:00
Fabien Potencier 85bcd9d554 minor #34225 [HttpFoundation] MockFileSessionStorageTest::sessionDir being used after it's unset (HypeMC)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpFoundation] MockFileSessionStorageTest::sessionDir being used after it's unset

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

The `$sessionDir` property was used after being set to `null`.

Commits
-------

51b20dd895 Fix MockFileSessionStorageTest::sessionDir being used after it's unset
2019-11-03 11:46:27 +01:00
Oskar Stark 2ce086ab29
Name test accordingly to the tested class 2019-11-03 10:04:05 +01:00
HypeMC 51b20dd895 Fix MockFileSessionStorageTest::sessionDir being used after it's unset 2019-11-03 03:12:45 +01:00
Robin Chalas e47b31c43c [Security] Fix SwitchUserToken wrongly deauthenticated 2019-11-02 08:21:17 +01:00
Fabien Potencier bbbbb2189a minor #34215 Fix typo (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

Fix typo

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained 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 branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

327a13cac0 Fix typo
2019-11-01 17:43:39 +01:00
Fabien Potencier 327a13cac0 Fix typo 2019-11-01 17:09:13 +01:00
Romaric Drigon 99f59e262f Supporting Bootstrap 4 custom switches 2019-11-01 16:05:06 +01:00