Commit Graph

48056 Commits

Author SHA1 Message Date
Christian Flothmann
c0ee02bf19 feature #36088 [Form] Added "collection_entry" block prefix to CollectionType entries (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Form] Added "collection_entry" block prefix to CollectionType entries

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

Allows to use global `collection_entry_row`, `collection_entry_label`, `collection_entry_widget` and `collection_entry_errors` themes after dynamic `_form_name_collection_name_entry_* ` ones.

Commits
-------

2ff1f886d7 [Form] Added "collection_entry" block prefix to CollectionType entries
2020-03-17 16:32:28 +01:00
Jules Pietri
2ff1f886d7
[Form] Added "collection_entry" block prefix to CollectionType entries 2020-03-17 10:07:29 +01:00
Nicolas Grekas
c650fe6dfc minor #35945 Leverage PHP8's get_debug_type() (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Leverage PHP8's get_debug_type()

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

See https://github.com/symfony/polyfill/pull/226 for background.

We might have to port part of the patch to 4.4 when we'll work on having it support PHP 8, but that's not needed for now.

Commits
-------

daf1c6605e Leverage PHP8's get_debug_type()
2020-03-16 18:33:00 +01:00
Nicolas Grekas
daf1c6605e Leverage PHP8's get_debug_type() 2020-03-16 17:46:21 +01:00
Fabien Potencier
34583b7562 feature #35936 [String] Add AbstractString::containsAny() (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[String] Add AbstractString::containsAny()

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

We decided to not have a `contains()` method because we didn't know how to handle the case where several needles are passed. But https://wiki.php.net/rfc/str_contains made me reconsider this idea and I think `containsAny()` works great. WDYT?

Commits
-------

de79ae7f35 [String] Add AbstractString::containsAny()
2020-03-16 17:24:27 +01:00
Fabien Potencier
313d865456 Merge branch '5.0'
* 5.0:
  [Notifier] Add tests for AbstractChannel and ChannelPolicy
2020-03-16 17:00:50 +01:00
Fabien Potencier
f4d564c0a1 minor #36096 Fix quotes in exception messages (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Fix quotes in exception messages

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| 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

Commits
-------

6c37f66f3f Fix quotes in exception messages
2020-03-16 15:38:57 +01:00
Fabien Potencier
6c37f66f3f Fix quotes in exception messages 2020-03-16 15:27:25 +01:00
Fabien Potencier
16ed2b9f7d minor #35847 [Notifier] Add unit tests (jschaedl)
This PR was merged into the 5.0 branch.

Discussion
----------

[Notifier] Add unit tests

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

- [x] `AbstractChannel`
- [x] `ChannelPolicy`
- [x] `RecipientTest` (done in PR #35773)
- [x] `EmailRecipientTest` (done in PR #35773)
- [x] `SmsRecipientTest` (done in PR #35773)
- [x] `Transports` (see PR #35834)

Commits
-------

022c1707e2 [Notifier] Add tests for AbstractChannel and ChannelPolicy
2020-03-16 14:29:03 +01:00
Fabien Potencier
1866a2a88c Merge branch '5.0'
* 5.0:
  Fix quotes in exception messages
  Fix quotes in exception messages
  Fix quotes in exception messages
  Fix quotes in exception messages
  Fix quotes in exception messages
2020-03-16 14:12:54 +01:00
Fabien Potencier
4efa287574 minor #36095 Quotes in exceptions messages (fabpot)
This PR was squashed before being merged into the 5.0 branch.

Discussion
----------

Quotes in exceptions messages

| Q             | A
| ------------- | ---
| Branch?       | 5.0 <!-- see below -->
| Bug fix?      | no
| 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

Commits
-------

bc60b9c5e4 Fix quotes in exception messages
42df4f434b Fix quotes in exception messages
2020-03-16 14:11:08 +01:00
Fabien Potencier
bc60b9c5e4 Fix quotes in exception messages 2020-03-16 14:02:39 +01:00
Fabien Potencier
42df4f434b Fix quotes in exception messages 2020-03-16 13:36:05 +01:00
Fabien Potencier
e903750b9c Merge branch '4.4' into 5.0
* 4.4:
  Fix quotes in exception messages
  Fix quotes in exception messages
  Fix quotes in exception messages
2020-03-16 13:10:54 +01:00
Fabien Potencier
4a7fcda332 minor #36091 Fix quotes in exception messages (fabpot)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

Fix quotes in exception messages

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| 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

Commits
-------

aab0e40cd2 Fix quotes in exception messages
1ae2da01ff Fix quotes in exception messages
2020-03-16 13:04:38 +01:00
Fabien Potencier
aab0e40cd2 Fix quotes in exception messages 2020-03-16 12:24:17 +01:00
Fabien Potencier
1ae2da01ff Fix quotes in exception messages 2020-03-16 10:45:04 +01:00
Fabien Potencier
09ee51aa4d Merge branch '3.4' into 4.4
* 3.4:
  Fix quotes in exception messages
2020-03-16 09:56:54 +01:00
Fabien Potencier
e29cdb7076 minor #36090 Fix quotes in exception messages (fabpot)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix quotes in exception messages

| Q             | A
| ------------- | ---
| Branch?       | 3.4 <!-- see below -->
| 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 #36067 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

48102d96f3 Fix quotes in exception messages
2020-03-16 09:43:14 +01:00
Fabien Potencier
48102d96f3 Fix quotes in exception messages 2020-03-16 09:31:04 +01:00
Fabien Potencier
eda7aad51e Merge branch '5.0'
* 5.0:
  [FrameworkBundle] start session on flashbag injection
  [Validator] Remove commas in translations
  [Console] Fallback to default answers when unable to read input
2020-03-16 07:35:57 +01:00
Fabien Potencier
af72aa1d08 Merge branch '4.4' into 5.0
* 4.4:
  [FrameworkBundle] start session on flashbag injection
  [Validator] Remove commas in translations
  [Console] Fallback to default answers when unable to read input
2020-03-16 07:35:48 +01:00
Fabien Potencier
74011262dd Merge branch '3.4' into 4.4
* 3.4:
  [FrameworkBundle] start session on flashbag injection
  [Validator] Remove commas in translations
2020-03-16 07:35:38 +01:00
Fabien Potencier
78b11a591d bug #36063 [FrameworkBundle] start session on flashbag injection (William Arslett)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] start session on flashbag injection

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix [#33084](https://github.com/symfony/symfony/issues/33084)
| License       | MIT

This PR addresses an issue whereby if the FlashBag is injected into the application using the default service configuration, we cannot rely that the session has been started. This behaviour is in contradiction to [the docs](https://symfony.com/doc/current/session.html#avoid-starting-sessions-for-anonymous-users):

> Sessions are automatically started whenever you read, write or even check for the existence of data in the session.

This is because symfony ensures the session has been started on calls to getFlashBag() which is normally how the flashbag will be accessed but this is not called if you inject the FlashBag directly into the container.

I have addressed this issue by changing the way the Flashbag service is built so that it uses Session as a factory service and getFlashBag as a factory method. This means that anywhere in symfony where FlashBag is injected can now rely on the fact the session is started.

I have also added a new functional test to verify this behaviour.

Commits
-------

e8b4d35616 [FrameworkBundle] start session on flashbag injection
2020-03-16 07:35:10 +01:00
William Arslett
e8b4d35616 [FrameworkBundle] start session on flashbag injection 2020-03-16 07:35:04 +01:00
Fabien Potencier
b4f03d0c3b feature #35744 [Validator] Add AtLeastOne constraint and validator (przemyslaw-bogusz)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Validator] Add AtLeastOne constraint and validator

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

This constraint allows you to apply a collection of constraints to a value, and it will be considered valid, if it satisfies at least one of the constraints from the collection.

Some examples:

```php
    /**
     * @Assert\AtLeastOne({
     *     @Assert\Length(min=5),
     *     @Assert\EqualTo("bar")
     * })
     */
    public $name = 'foo';

    /**
     * @Assert\AtLeastOne({
     *     @Assert\All({@Assert\GreaterThanOrEqual(10)}),
     *     @Assert\Count(20)
     * })
     */
    public $numbers = ['3', '5'];

    /**
     * @Assert\All({
     *     @Assert\AtLeastOne({
     *          @Assert\GreaterThanOrEqual(5),
     *          @Assert\LessThanOrEqual(3)
     *     })
     * })
     */
    public $otherNumbers = ['4', '5'];
```

The respective default messages would be:
`name: This value should satisfy at least one of the following constraints: [1] This value is too short. It should have 5 characters or more. [2] This value should be equal to "bar".`

`numbers: This value should satisfy at least one of the following constraints: [1] Each element of this collection should satisfy its own set of constraints. [2] This collection should contain exactly 20 elements.`

`otherNumbers[0]: This value should satisfy at least one of the following constraints: [1] This value should be greater than or equal to 5. [2] This value should be less than or equal to 3.`

But of course you could also create a simple custom message like `None of the constraints are satisfied`.

Commits
-------

e6209a697c [Validator] Add AtLeastOne constraint and validator
2020-03-16 07:29:24 +01:00
Przemysław Bogusz
e6209a697c [Validator] Add AtLeastOne constraint and validator 2020-03-16 07:29:18 +01:00
Fabien Potencier
06a1a1b5bc feature #35729 [Form] Correctly round model with PercentType and add a rounding_mode option (VincentLanglet)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Form] Correctly round model with PercentType and add a rounding_mode option

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #35296
| License       | MIT
| Doc PR        | symfony/symfony-docs#13138

Commits
-------

d97565dcee [Form] Correctly round model with PercentType and add a rounding_mode option
2020-03-16 07:22:47 +01:00
Vincent Langlet
d97565dcee [Form] Correctly round model with PercentType and add a rounding_mode option 2020-03-16 07:22:42 +01:00
Fabien Potencier
e0bddeeef0 feature #35733 [Form] Added a "choice_filter" option to ChoiceType (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Form] Added a "choice_filter" option to ChoiceType

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes
| Tickets       | Fix #32657
| License       | MIT
| Doc PR        | symfony/symfony-docs#13223

Finally opening this PR for a very old branch, based on both #34550 (merged) and #30994 (merged).

~Until #30994 is merged, this PR should better be reviewed by commits. Thanks!~

Commits
-------

ed2c312609 [Form] Added a "choice_filter" option to ChoiceType
2020-03-16 07:19:38 +01:00
Fabien Potencier
0fb0371029 bug #36069 [DI] skip untyped properties in AutowireRequiredPropertiesPass (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[DI] skip untyped properties in AutowireRequiredPropertiesPass

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

Commits
-------

048d09213e [DI] skip untyped properties in AutowireRequiredPropertiesPass
2020-03-16 07:13:08 +01:00
Fabien Potencier
693cf11b8e feature #36003 [ErrorHandler][FrameworkBundle] better error messages in failing tests (guillbdx)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[ErrorHandler][FrameworkBundle] better error messages in failing tests

| Q             | A
| ------------- | ---
| Branch?       | master for features
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #32752
| License       | MIT
| Doc PR        |

Purpose of this PR is to enhance tests by giving a way to report an exception that occured during the processing of the request.

The ErrorHandler will add an X-Debug-Exception, and the assertThat() method of WebTestCase will throw an exception if this header exists and status code is 5xx.

In practice, this adds the "Caused by" section in this example:

```
Time: 374 ms, Memory: 20.00 MB

There was 1 failure:

1) App\Tests\Controller\HomeControllerTest::testC
Failed asserting that the Response has header "Content-Type" with value "application/json".

/srv/symfony/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php:132
/srv/symfony/src/Symfony/Bundle/FrameworkBundle/Test/BrowserKitAssertionsTrait.php:66
/srv/blog/tests/Controller/HomeControllerTest.php:29

Caused by
Exception: This a test exception. in /the/file.php:139
Stack trace:
[...]
```

Commits
-------

0da9469ee2 [ErrorHandler][FrameworkBundle] better error messages in failing tests
2020-03-16 07:11:56 +01:00
Guillaume Pédelagrabe
0da9469ee2 [ErrorHandler][FrameworkBundle] better error messages in failing tests 2020-03-16 07:11:50 +01:00
Fabien Potencier
bd1aaf1f98 bug #36031 [Console] Fallback to default answers when unable to read input (ostrolucky)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] Fallback to default answers when unable to read input

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

Alternative to https://github.com/symfony/symfony/pull/36027.

This fixes linked issues without having to revert fix for #30726. Successfully tested with composer script, `docker run` and `docker run -it`.

Commits
-------

8ddaa20b29 [Console] Fallback to default answers when unable to read input
2020-03-16 07:07:59 +01:00
Fabien Potencier
1897e03d7f feature #36034 [PhpUnitBridge] Deprecate @expectedDeprecation annotation (hkdobrev)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[PhpUnitBridge] Deprecate @expectedDeprecation annotation

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

Addresses https://github.com/orgs/symfony/projects/1#card-32934769 as a follow-up to #35192.

Deprecating `@expectedDeprecation` annotation on tests in favour of the `expectDeprecation()` method similar to other PHPUnit deprecations of annotations in favour of methods.

Commits
-------

36a57cc7c2 [PhpUnitBridge] Deprecate @expectedDeprecation annotation
2020-03-16 07:05:20 +01:00
Haralan Dobrev
36a57cc7c2 [PhpUnitBridge] Deprecate @expectedDeprecation annotation 2020-03-16 07:05:14 +01:00
Fabien Potencier
d5c4ba980b feature #35924 [HttpClient] make HttpClient::create() return an AmpHttpClient when amphp/http-client is found but curl is not or too old (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpClient] make `HttpClient::create()` return an `AmpHttpClient` when `amphp/http-client` is found but curl is not or too old

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

Follows #35115

Let's use `amphp/http-client` by default, after `curl` and before `fopen()`.

Commits
-------

7991685e04 [HttpClient] made `HttpClient::create()` return an `AmpHttpClient` when `amphp/http-client` is found but curl is not or too old
2020-03-16 07:03:39 +01:00
Fabien Potencier
7a4be744fd minor #36021 [Validator] Remove commas in translations (przemyslaw-bogusz)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[Validator] Remove commas in translations

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

These translations were originally modified in #21335.

Commits
-------

5688f97bad [Validator] Remove commas in translations
2020-03-16 06:59:27 +01:00
Przemysław Bogusz
5688f97bad [Validator] Remove commas in translations 2020-03-16 06:59:20 +01:00
Jules Pietri
ed2c312609
[Form] Added a "choice_filter" option to ChoiceType 2020-03-15 16:49:24 +01:00
Fabien Potencier
df1caaeaa6 minor #36087 Add missing dots at the end of exception messages (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Add missing dots at the end of exception messages

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| 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

Commits
-------

c46d7027e5 Add missing dots at the end of exception messages
2020-03-15 16:07:38 +01:00
Fabien Potencier
c46d7027e5 Add missing dots at the end of exception messages 2020-03-15 15:54:58 +01:00
Fabien Potencier
d6dd06ba89 Merge branch '5.0'
* 5.0:
  Add missing dots at the end of exception messages
  Add missing dots at the end of exception messages
  [DI][Form] Fixed test suite (TimeType changes & unresolved merge conflict)
  Fix bad merge
  Add missing dots at the end of exception messages
2020-03-15 15:51:35 +01:00
Nicolas Grekas
f37d901426 minor #36086 [UID] remove unused property (Tobion)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[UID] remove unused property

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

leftover from https://github.com/symfony/symfony/pull/36074

Commits
-------

901e62a98f remove unused uuid property
2020-03-15 15:48:33 +01:00
Fabien Potencier
040bf90355 minor #36085 Add missing dots at the end of exception messages (fabpot)
This PR was merged into the 5.0 branch.

Discussion
----------

Add missing dots at the end of exception messages

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| 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

Commits
-------

81cf96749b Add missing dots at the end of exception messages
2020-03-15 15:46:24 +01:00
Tobias Schultze
901e62a98f remove unused uuid property
leftover from https://github.com/symfony/symfony/pull/36074
2020-03-15 15:41:40 +01:00
Fabien Potencier
81cf96749b Add missing dots at the end of exception messages 2020-03-15 15:37:05 +01:00
Fabien Potencier
20a19884ac Merge branch '4.4' into 5.0
* 4.4:
  Add missing dots at the end of exception messages
  [DI][Form] Fixed test suite (TimeType changes & unresolved merge conflict)
  Fix bad merge
  Add missing dots at the end of exception messages
2020-03-15 15:33:06 +01:00
Fabien Potencier
3543bf67b6 minor #36081 Add missing dots at the end of exception messages (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

Add missing dots at the end of exception messages

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| 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

Commits
-------

6dad402e97 Add missing dots at the end of exception messages
2020-03-15 15:29:03 +01:00
Fabien Potencier
6dad402e97 Add missing dots at the end of exception messages 2020-03-15 15:17:26 +01:00