Commit Graph

47663 Commits

Author SHA1 Message Date
Nicolas Grekas 6d1657b720 [HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface 2020-02-11 14:51:01 +01:00
Nicolas Grekas 8c694d6157 [DomCrawler] fix leftover 2020-02-11 11:47:17 +01:00
Nicolas Grekas c895a400d9 bug #35672 [HttpClient] fix HttpClientDataCollector when handling canceled responses (thematchless)
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       | -
| License       | MIT
| Doc PR        | -

small addition to the already merged #35562

Commits
-------

7088ef78f7 [HttpClient] fix HttpClientDataCollector when handling canceled responses
2020-02-11 11:44:52 +01:00
Nicolas Grekas 1d34c8ca89 feature #35192 [PhpUnitBridge] Add the ability to expect a deprecation inside a test (fancyweb)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[PhpUnitBridge] Add the ability to expect a deprecation inside a test

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

Replaces https://github.com/symfony/symfony/pull/25757

Proposed implementation uses a dedicated trait for a better DX. Using `$this->expectDeprecation()` feels natural.

Unfortunately it is not currently possible to test the cases that should produce errors or risky, so there are some things that are not testable here. I plan to propose another feature for the PhpUnitBridge to be able to test those kind of things. If it's accepted, we will then be able to strenghten the tests of this one.

Commits
-------

a3a928050d [PhpUnitBridge] Add the ability to expect a deprecation inside a test
2020-02-11 11:38:57 +01:00
Thomas Calvet a3a928050d [PhpUnitBridge] Add the ability to expect a deprecation inside a test 2020-02-11 11:38:45 +01:00
Matthias Meyer 7088ef78f7
[HttpClient] fix HttpClientDataCollector when handling canceled responses 2020-02-11 11:10:58 +01:00
Robin Chalas bbeb49f32d minor #35671 [Messenger][Redis] Add missing changelog entry (chalasr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Messenger][Redis] Add missing changelog entry

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

Missed in #35384

Commits
-------

08fb0c4dfd [Messenger][Redis] Add missing changelog entry
2020-02-11 09:47:53 +01:00
Robin Chalas 08fb0c4dfd [Messenger][Redis] Add missing changelog entry 2020-02-11 09:47:07 +01:00
Fabien Potencier 1b52d6035a feature #35667 [DomCrawler] Rename UriExpander.php -> UriResolver (lyrixx)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[DomCrawler] Rename UriExpander.php -> UriResolver

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | refs https://github.com/symfony/symfony-docs/pull/13054#discussion_r377138605
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/13054 // don't open a new issue in doc repo

Commits
-------

3217f8182a [DomCrawler] Rename UriExpander.php -> UriResolver
2020-02-11 07:10:22 +01:00
Grégoire Pineau 3217f8182a [DomCrawler] Rename UriExpander.php -> UriResolver 2020-02-11 07:10:08 +01:00
Fabien Potencier e5ccf5d558 minor #35668 Updated ICU urls (oleg-andreyev)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Updated ICU urls

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

Updated `@see` links to icu4c project (PHP docs has outdated links also)

Commits
-------

7adece8cc7 Updated ICU urls
2020-02-11 06:40:00 +01:00
Oleg Andreyev 7adece8cc7
Updated ICU urls 2020-02-10 23:25:54 +02:00
Fabien Potencier a9eec7169a minor #35663 [Contracts] Split the global CHANGELOG in dedicated CHANGELOG per contract (lyrixx)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Contracts] Split the global CHANGELOG in dedicated CHANGELOG per contract

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

---

This is more in sync with what we do with other components + bundles.
And when we contribute to a contact, it's easier to find the file (because with the substree, we don't get the global package)

Commits
-------

a05ee087a2 [Constracts] Split the global CHANGELOG in dedicated CHANGELOG per contract
2020-02-10 21:09:55 +01:00
Nicolas Grekas 033ec1bc0f feature #35611 [Console] Moved estimated & remaining calculation logic to separate get method (peterjaap)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Console] Moved estimated & remaining calculation logic to separate get method

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

This way, we can use `getEstimated()`and `getRemaining()` to get easy access to the estimated / remaining number of seconds to be used in our placeholder definition set with `setPlaceholderFormatterDefinition` without having to redefine the calculation ourself.

Example before;

```php
ProgressBar::setPlaceholderFormatterDefinition(
    'eta',
    function (ProgressBar $progressBar) {
        $estimated = round((time() - $progressBar->getStartTime()) / ($progressBar->getProgress() ?: 0.1) * $progressBar->getMaxSteps());
        return date('H:i:s', strtotime('+' . $estimated . ' seconds'));
    }
);
```

Example after;

```php
ProgressBar::setPlaceholderFormatterDefinition(
    'eta',
    function (ProgressBar $progressBar) {
        return date('H:i:s', strtotime('+' . $this->getEstimated() . ' seconds'));
    }
);
```

Commits
-------

19958fba5a [Console] Moved estimated & remaining calculation logic to separate get method
2020-02-10 17:05:15 +01:00
Peter Jaap Blaakmeer 19958fba5a [Console] Moved estimated & remaining calculation logic to separate get method 2020-02-10 17:05:09 +01:00
Fabien Potencier 7e4abf5e9d feature #33968 [Notifier] Add Firebase bridge (Jeroeny)
This PR was squashed before being merged into the 5.1-dev branch (closes #33968).

Discussion
----------

[Notifier] Add Firebase bridge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | See #33687
| License       | MIT

This would add [Firebase](https://firebase.google.com) integration for the Notifier component. With Firebase you can send push notifications to the users of you Android and iOS app and website (formerly known as Google Cloud messaging).

I'm not sure if it's possible to have this merged, like the other bridges. Or if I should create a stand-alone repository? That'd be fine too.

Also it's now using the `ChatMessage` as implementation of `Symfony\Component\Notifier\Message\MessageInterface`, but I feel like this component could use a `PushMessage` or something similar. Although I'm not sure if it would contain more than `subject` that the `ChatMessage` does.

Commits
-------

2776d2f811 [Notifier] Add Firebase bridge
2020-02-10 16:35:00 +01:00
Jeroeny 2776d2f811 [Notifier] Add Firebase bridge 2020-02-10 16:34:55 +01:00
Fabien Potencier 1d472a6e9a feature #34022 [Notifier] add RocketChat bridge (Jeroeny)
This PR was squashed before being merged into the 5.1-dev branch (closes #34022).

Discussion
----------

[Notifier] add RocketChat bridge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | See #33687
| License       | MIT

This would add [RocketChat](https://rocket.chat/) integration for the Notifier component. RocketChat is a self hosted chat service.

Fully tested with a trial version of RocketChat.

@wirone I noticed you suggested this.

Commits
-------

4869ef61cd [Notifier] add RocketChat bridge
2020-02-10 16:33:35 +01:00
Jeroeny 4869ef61cd [Notifier] add RocketChat bridge 2020-02-10 16:33:29 +01:00
Fabien Potencier 4003700e90 feature #32454 [Messenger] Add SQS transport (jderusse)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Messenger] Add SQS transport

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

This PR add the AWS SQS transport in messenger.

It also add a `DisconnectedReceiverInterface` that allows the worker to release not-proceeded message (which are not automatically released in SQS and have to wait a TTL). Tell me if you prefer to move it in a dedicated PR.

accepted DNS:
- `sqs://default/accountId/queueName`
- `sqs://default/queueName`
- `sqs://default/queueName?region=us-east-2`
- `sqs://my_custome_endpoint:12345/queueName?sslmode=disabled`

To reduce AWS costs, the implementation performs a long polling call and prefetch several messages.
TO get ~real time worker, one could use `./bin/console messenger:consume --sleep 0.001`

Commits
-------

c226479d5f [Messenger] Add SQS transport
2020-02-10 13:30:37 +01:00
Fabien Potencier 11f1312d91 feature #33875 Add Mattermost notifier bridge (thePanz)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Add Mattermost notifier bridge

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

Added a http://mattermost.org (open source Slack alternative)  transport for the new Notifier component

Commits
-------

eaba6a507c Add Mattermost notifier bridge
2020-02-10 13:29:39 +01:00
Grégoire Pineau a05ee087a2 [Constracts] Split the global CHANGELOG in dedicated CHANGELOG per contract 2020-02-10 11:54:33 +01:00
Thomas Calvet 67a1f55ce1 [Console][QuestionHelper] Use String width() to properly move the cursor backwards 2020-02-10 10:12:08 +01:00
Emanuele Panzeri eaba6a507c Add Mattermost notifier bridge 2020-02-10 10:04:31 +01:00
Fabien Potencier 9eb7cb1b7b feature #35400 [RFC][DX][OptionsResolver] Allow setting info message per option (yceruto)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[RFC][DX][OptionsResolver] Allow setting info message per option

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

This is a DX proposal that will help in debugging/errors to better understand the meaning of one defined option.

This is how you'd use it:
```php
$resolver = new OptionsResolver();
$resolver->setDefined('date');
$resolver->setAllowedTypes('date', \DateTime::class);
$resolver->setInfo('date', 'A future date'); // <-- NEW
// ...
```
This information may be useful for those options where their name cannot be intuitive enough, or their purpose is too complex. Here is an example (based on the example above):
```php
// ...
$resolver->setAllowedValues('date', static function ($value): bool {
    return $value >= new \DateTime('now');
});
```
So, if you introduce a date value that does not match the criteria, you will get this error message:

**Before:**
```
The option "date" with value DateTime is invalid.
```
Note that the allowed value is not printable in this case, hence the error message cannot be clear at all.

**After:**
```
The option "date" with value DateTime is invalid. Info: A future date.
```
Although a more accurate error message can be triggered within the `\Closure` if desired.

Also you'll see this info message on `debug:form` command (see tests), then you have in advance the informative description of any option.

What do you think?

Commits
-------

0477a06d8a Allow setting one info message per option
2020-02-10 09:05:33 +01:00
Fabien Potencier 9e0a39ee05 minor #35657 [Security] Fix exception name in doc comments (chalasr)
This PR was squashed before being merged into the 3.4 branch (closes #35657).

Discussion
----------

[Security] Fix exception name in doc comments

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

Commits
-------

f10098e9f1 [Security] Fix exception name in doc comments
2020-02-10 09:04:06 +01:00
Robin Chalas f10098e9f1 [Security] Fix exception name in doc comments 2020-02-10 09:03:59 +01:00
Yonel Ceruto 0477a06d8a Allow setting one info message per option 2020-02-09 19:42:47 -05:00
Jules Pietri 1394df2dea [Form] Added an AbstractChoiceLoader to simplify implementations and handle global optimizations 2020-02-10 00:49:37 +01:00
Nicolas Grekas 332fa65f69 [FrameworkBundle] fix typo 2020-02-09 21:32:53 +01:00
Nicolas Grekas 477ee19778 feature #30501 [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers (HeahDude)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[FrameworkBundle][Routing] added Configurators to handle template and redirect controllers

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | let's see
| Fixed tickets | partially #24640, #25145
| License       | MIT
| Doc PR        | symfony/symfony-docs#11120

While working on https://github.com/symfony/symfony-docs/pull/11085, I felt bad about the long notations required for simple [redirects](https://symfony.com/doc/current/routing/redirect_in_config.html) and [templates rendering](https://symfony.com/doc/current/templating/render_without_controller.html) template actions, but I love and use those features since always. Then I gave it a try yesterday night and now I realised I missed #24640 and that #25145 has been closed x).

So here we go, here's my WIP. WDYT of this implementation? ping @javiereguiluz?

I'm going to open the PR in the docs so we can discuss the DX changes there too, and keep focus on the code here.

Cheers!

EDIT
----
This PR now only update PHP-DSL configurators.

______________

TODO:

- [x] gather reviews
- ~[x] fix xml schema~
- [x] add some tests
- ~[ ] handle xsd auto discovery~
- [x] rebase on top of #30507
- [x] ~add shortcuts for #30514~

Commits
-------

de74794acf [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers
2020-02-09 17:37:38 +01:00
Jules Pietri de74794acf [FrameworkBundle][Routing] added Configurators to handle template and redirect controllers 2020-02-09 17:37:08 +01:00
Fabien Potencier 9bfa25869a feature #35373 [Translation] Support name attribute on the xliff2 translator loader (Taluu)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Translation] Support name attribute on the xliff2 translator loader

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

Support using the `name` attribute on the `unit` element in xliff 2.0 to use as the "translation key" rather than always relying on the `<source>` content, as was done on the xliff 1.2.

Commits
-------

37b31149c6 Support name attribute on the xliff2 translator loader
2020-02-09 08:48:01 +01:00
Nicolas Grekas 083a32dee3 Merge branch '5.0'
* 5.0:
  Add missing symfony/mime to require-dev
  [Validator] Added the missing Mongolian translations
  [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
  refactor(Process): fromShellCommandLine
  [Mailer] Do not ping the SMTP server before sending every message
2020-02-08 18:01:13 +01:00
Nicolas Grekas 255a748f1f Merge branch '4.4' into 5.0
* 4.4:
  Add missing symfony/mime to require-dev
  [Validator] Added the missing Mongolian translations
  [ErrorHandler] Never throw on warnings triggered by assert() and set assert.exception=1 in Debug::enable()
  refactor(Process): fromShellCommandLine
  [Mailer] Do not ping the SMTP server before sending every message
2020-02-08 18:00:58 +01:00
Nicolas Grekas 48272f000a Add missing symfony/mime to require-dev 2020-02-08 17:59:15 +01:00
Nicolas Grekas c771557213 Merge branch '3.4' into 4.4
* 3.4:
  [Validator] Added the missing Mongolian translations
2020-02-08 17:57:24 +01:00
Fabien Potencier ebdcd63576 feature #35550 Leverage trigger_deprecation() from symfony/deprecation-contracts (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

Leverage trigger_deprecation() from symfony/deprecation-contracts

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

Here is what it could mean to use `deprecated()` from #35526 in the code base.

Commits
-------

3e35d8e9e3 Leverage trigger_deprecation() from symfony/deprecation-contracts
2020-02-08 15:35:51 +01:00
Nicolas Grekas 3e35d8e9e3 Leverage trigger_deprecation() from symfony/deprecation-contracts 2020-02-08 15:04:50 +01:00
Fabien Potencier 55e2c5b37d feature #35648 [Contracts/Deprecation] don't use assert(), rename to trigger_deprecation() (nicolas-grekas)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Contracts/Deprecation] don't use assert(), rename to trigger_deprecation()

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

This PR is a follow up the discussion that happened in #35526.

I applied all the suggestions I received so far on this previous PR so that we can discuss them all together.

Here are the changes:
- the most important change is to *not* use `assert()` anymore. This fixes the objection from @ostrolucky and @derrabus that deprecations and assert() should not be bound to each other. Instead, in order to still make the function a no-op when wanted, it is suggested that apps declare an empty function. This will be more flexible in practice I believe and keeps all the benefits we envisioned by using assert();
- as suggested by @fabpot, the function is renamed `trigger_deprecation()` instead of `deprecated()`. Because the implementation is now not conditional anymore (from the package pov, since assert() is not used), my arguments to keep the previous name don't stand as strong as before to me so I'm fine renaming.
- type hints are added back (requiring PHP 7.1 to use `void`). As mentioned in the 1st point, ppl that really want deprecations to be no-ops will redeclare the function as empty, thus not using any types, thus reclaiming all the perf diff. And for ppl that do want to catch deprecations, the overhead of types is negligible compared to any processing of the deprecations themselves.

WDYT?

All points can be discussed separately if needed of course. I'm personally fine with merging the PR as is, with all 3 changes.

Commits
-------

0032b2a289 [Contracts/Deprecation] don't use assert(), rename to trigger_deprecation()
2020-02-08 14:30:44 +01:00
Nicolas Grekas 0032b2a289 [Contracts/Deprecation] don't use assert(), rename to trigger_deprecation() 2020-02-08 14:27:18 +01:00
Fabien Potencier 3ebe15e0be minor #35646 [Validator] Added the missing Mongolian translations (erheme318)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Added the missing Mongolian translations

https://github.com/symfony/symfony/issues/30175

Added the missing translations for the Mongolian ("mn") locale.

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

Commits
-------

365f4d76bd [Validator] Added the missing Mongolian translations
2020-02-08 11:44:41 +01:00
Erkhembayar Gantulga 365f4d76bd [Validator] Added the missing Mongolian translations
https://github.com/symfony/symfony/issues/30175

Added the missing translations for the Mongolian ("mn") locale.
2020-02-08 18:24:04 +08:00
Fabien Potencier 916ff106c5 feature #33456 [MonologBridge] Add Mailer handler (BoShurik)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[MonologBridge] Add Mailer handler

| 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 | #33209   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

<!--
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):
 - 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
-------

5b7393b823 Add monolog mailer handler
2020-02-08 09:01:20 +01:00
Fabien Potencier 4bc1ea21b9 feature #35384 [Messenger] Add receiving of old pending messages (redis) (toooni)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Messenger] Add receiving of old pending messages (redis)

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

This PR makes it possible for the redis transport to get abandoned messages from not running/idle consumers by using `XPENDING` and `XCLAIM`.
Usually it would be best to let the claiming of pending messages be handled by a separate command. Since the messenger component's commands are fixed, we do need to set a `claimTimeout`. The `claimTimeout` defines how long an idle message should be left alone until it will get claimed by the current consumer (Must be a value higher than the longest running handling time of a message or else the message will be handled twice).
Using this solution makes the remarks (https://github.com/symfony/symfony-docs/pull/11869#pullrequestreview-257483666) regarding not being able to use the hostname as consumer name obsolete. I would even recommend the hostname as the consumer name.

**Questions**

- [x] Which value should we use as default `claimTimeout`?
- [x] How should the `claimTimeout` be configured?
- [x] Feature or Bugfix?

I will create a docs PR and a PR for the other branches as soon as the questions are resolved.

Commits
-------

9cb6fdfabb Implemted receiving of old pending messages
2020-02-08 08:48:00 +01:00
Fabien Potencier 32ce188b68 feature #34456 [Validator] Add a constraint to sequentially validate a set of constraints (ogizanagi)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Validator] Add a constraint to sequentially validate a set of constraints

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- 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        | Todo

Follows https://github.com/symfony/symfony/issues/20017#issuecomment-331276007 given some feedbacks about the suggested feature.

```php
/**
 * @var string
 *
 * @Assert\Sequentially({
 *     @Assert\Type("string"),
 *     @Assert\Length(min="4"),
 *     @Assert\Regex("[a-z]"),
 *     @SomeCustomConstraintWithHeavyExternalCalls(),
 * })
 */
public $foo;
```

This new `Sequentially` constraint solves - with less power but better DX - some of the use-cases of the `GroupSequence` feature, allowing to interrupt the validation of some constraints if a previous one in the list failed before. Constraints are validated in given order, and the first violation raised will prevent other constraint validators to be executed.
It can either prevent unexpected type exceptions thrown by further constraints or heavy & unnecessary calls to a database or external services if the value to validate already doesn't match some of the basic requirements.

Commits
-------

dfd9038d28 [Validator] Add a constraint to sequentially validate a set of constraints
2020-02-08 08:14:30 +01:00
Fabien Potencier f53ea3d04f feature #34334 [Validator] Allow to define a reusable set of constraints (ogizanagi)
This PR was squashed before being merged into the 5.1-dev branch (closes #34334).

Discussion
----------

[Validator] Allow to define a reusable set of constraints

| Q             | A
| ------------- | ---
| Branch?       | 5.1 <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- 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        | TODO

The goal of this feature is to simplify writing a set of validation constraints to be reused consistently across the application. Which is especially useful with DTOs, as a same set of constraints can be used in different places.

For instance, given multiple DTOs containing the new user password in for different use-cases (register, forgot pwd, change pwd), the same rules apply on the property. Hence with this PR, you can write a single constraint class to be reused:

```php
/**
 * @Annotation
 */
class MatchesPasswordRequirements extends Compound
{
    protected function getConstraints(array $options): array
    {
        return [
            new NotBlank(),
            new Type('string'),
            new Length(['min' => 12]),
            new NotCompromisedPassword(),
        ];
    }
}
```

I'm open to better naming and ways to expose the options to the `Compound::getConstraints` method, so options can be forwarded to the nested constraints for most specific use-cases.

Commits
-------

8f1b0dfdb7 [Validator] Allow to define a reusable set of constraints
2020-02-08 08:09:39 +01:00
Maxime Steinhausser 8f1b0dfdb7 [Validator] Allow to define a reusable set of constraints 2020-02-08 08:09:33 +01:00
Fabien Potencier 2d89ed1f26 bug #35641 [Process] throw when PhpProcess::fromShellCommandLine() is used (Guikingone)
This PR was merged into the 4.4 branch.

Discussion
----------

[Process] throw when PhpProcess::fromShellCommandLine() is used

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

Close #35638

Final PR (rebased and tests added)

Commits
-------

7f6d71c2a3 refactor(Process): fromShellCommandLine
2020-02-08 08:06:43 +01:00
Fabien Potencier f4490a6c65 feature #35642 [HttpFoundation] Make dependency on Mime component optional (atailouloute)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[HttpFoundation] Make dependency on Mime component optional

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

Make the Mime component dependency optional

/cc @nicolas-grekas

Commits
-------

11cef32ff7 [HttpFoundation] Make dependency on Mime component optional
2020-02-08 08:05:09 +01:00