Commit Graph

41010 Commits

Author SHA1 Message Date
Fabien Potencier
a35ad63191 feature #30664 [Finder] Get filename without extension (antonch1989)
This PR was squashed before being merged into the 4.3-dev branch (closes #30664).

Discussion
----------

[Finder] Get filename without extension

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

Commits
-------

821e55ab80 [Finder] Get filename without extension
2019-03-27 09:36:49 +01:00
Anton Chernikov
821e55ab80 [Finder] Get filename without extension 2019-03-27 09:36:42 +01:00
Fabien Potencier
0c9d684d0a [Mime] added BodyRendererInterface 2019-03-27 08:07:59 +01:00
Fabien Potencier
19c6639452 bug #30718 [Mime] Fix serialization of Message instances (fabpot)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Mime] Fix serialization of Message instances

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

f5386ffb2a [Mime] fixed serialization of Message instances
2019-03-27 08:00:39 +01:00
Fabien Potencier
f5386ffb2a [Mime] fixed serialization of Message instances 2019-03-27 07:58:31 +01:00
Fabien Potencier
0c02a40d72 feature #30645 Alias for each assets package (gpenverne)
This PR was merged into the 4.3-dev branch.

Discussion
----------

Alias for each assets package

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | ?     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets |   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | <!-- required for new features -->

Add autowiring by type + name on assets packages
```yaml
framework:
    assets:
        packages:
            xxx:
                base_urls: 'xxxx'
```
```php
<?php

class MyService
{
    private $xxxPackage;

    public function __construct(PackageInterface $xxxPackage)
    {
        $this->xxxPackage = $xxxPackage;
        ...
    }

    public function myMethod(): string
    {
        return $this->xxxPackage->getUrl('some-image.png');
    }
}
```
instead of:
```php
<?php

class MyService
{
    private $packages;

    public function __construct(Packages $packages)
    {
        $this->packages = $packages;
        ...
    }

    public function myMethod(): string
    {
        return $this->packages->getPackage('xxx')->getUrl('some-image.png');
    }
}
```

Commits
-------

e8b9856ec3 Alias for each assets package
2019-03-27 07:44:58 +01:00
Fabien Potencier
8952c021c5 feature #30706 [PropertyInfo] Add possibility to extract private and protected properties in reflection extractor (joelwurtz)
This PR was squashed before being merged into the 4.3-dev branch (closes #30706).

Discussion
----------

[PropertyInfo] Add possibility to extract private and protected properties in reflection extractor

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

This PR add the possibility to extract private and protected properties from a class by passing a new argument to the `ReflectionExtractor`

This new argument consist of flag that filters properties, so someone will also be able to use the `ReflectionExtractor` only for private property

```php
new ReflectionExtractor(null, null, null, true, ReflectionExtractor::ALLOW_PRIVATE | ReflectionExtractor::ALLOW_PROTECTED)
```

Flags method was prefered over a list of bool to avoid too many parameters and also be close to the reflection API of PHP

Commits
-------

05e487f3b2 [PropertyInfo] Add possibility to extract private and protected properties in reflection extractor
2019-03-27 07:41:49 +01:00
Joel Wurtz
05e487f3b2 [PropertyInfo] Add possibility to extract private and protected properties in reflection extractor 2019-03-27 07:41:42 +01:00
Fabien Potencier
bc18e3919a feature #27808 [DI] Deprecate non-string default envs (ro0NL)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] Deprecate non-string default envs

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes-ish
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes
| Tests pass?   | no    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27680, https://github.com/symfony/symfony/pull/27470#discussion_r196678923
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This is a failing test to further clarify the issues raised in #27680

So given https://github.com/symfony/symfony/issues/27680#issuecomment-399402480

> We should be sure this solves a real-world issue.

I think it solves a real bug :)

Commits
-------

2311437c9f [DI] Deprecate non-string default envs
2019-03-27 07:31:58 +01:00
Fabien Potencier
c949f9a282 feature #30691 [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible

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

This PR adds a new `EventDispatcherInterface` in `Contracts`. This interface contains only one method: `dispatch($event, $eventName)`. That covers almost all use cases of the event dispatcher in components (some use add/removeListeners/Subscribers but they are a minority.)

While doing so, it allows dispatching any objects as events - not only instances of `Event`.

This allows decoupling e.g. `Messenger` from the `EventDispatcher` component.
Next steps could be about planning to remove the base `Event` class from some concrete event classes and/or moving `EventSubscriberInterface` to `symfony/contracts`. It would allow decoupling e.g. `Workflow` from the component - but that's too far away for now, let's think about it in 5.1.

Commits
-------

3c3db2f14a [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible
2019-03-27 07:28:10 +01:00
Fabien Potencier
08faa536d1 minor #30716 Fixing bad return on getter (weaverryan)
This PR was merged into the 4.3-dev branch.

Discussion
----------

Fixing bad return on getter

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

My bad - this method is only to make the Symfony Serializer happy (not used in our code), so I missed it. Test added to be sure.

Commits
-------

f3b3b2f4f3 Fixing bad return on getter
2019-03-27 07:27:38 +01:00
Fabien Potencier
79aeed640a feature #20978 [Form] TransformationFailedException: Support specifying message to display (ogizanagi)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form] TransformationFailedException: Support specifying message to display

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

Currently, a failed transformation can't display a very accurate message, as it only uses the value of the `invalid_message` option. I suggest to add more flexibility, somehow the same way we did for `CustomUserMessageAuthenticationException`.

A test case in `FormTypeTest` shows a use-case based on @webmozart's [blog post about value/immutable objects in Symfony forms](https://webmozart.io/blog/2015/09/09/value-objects-in-symfony-forms/).

~I named the exception properties and methods the same way as for `CustomUserMessageAuthenticationException`, but do you think the followings would be better:~

- ~`setSafeMessage` ➜ `setInvalidMessage`~
- ~`getMessageKey` ➜ `getInvalidMessageKey`~
- ~`getMessageData` ➜ `getInvalidMessageParameters`~

~in order to echoes `invalid_message` and `invalid_message_parameters` options?~

=> Replaced to use `invalidMessage` & `invalidMessageParameters`

Commits
-------

d11055cc1c [Form] TransformationFailedException: Support specifying message to display
2019-03-27 07:26:31 +01:00
Ryan Weaver
f3b3b2f4f3 Fixing bad return on getter 2019-03-26 23:10:31 -04:00
Maxime Steinhausser
d11055cc1c [Form] TransformationFailedException: Support specifying message to display 2019-03-26 22:35:30 +01:00
Vincent Touzet
fbb534a838 [Messenger] Add a command to setup transports 2019-03-26 21:08:11 +01:00
Roland Franssen
2311437c9f [DI] Deprecate non-string default envs 2019-03-26 18:14:00 +01:00
Fabien Potencier
76260e7d44 minor #30667 [Validator] BIC remove unused sprintf and parameter (kaznovac)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Validator] BIC remove unused sprintf and parameter

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

removed surplus parameter and sprintf as there are no placeholders in message template

Commits
-------

131e495269 [Validator] BIC remove unused sprintf and parameter
2019-03-26 11:26:31 +01:00
Fabien Potencier
dbb91e4e54 minor #30702 [Messenger] rename auto-setup amqp option into auto_setup (dmaicher)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] rename `auto-setup` amqp option into `auto_setup`

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

See https://github.com/symfony/symfony/pull/30671#discussion_r268524032

Commits
-------

6263e48392 [Messenger] rename `auto-setup` amqp option into `auto_setup`
2019-03-26 11:10:35 +01:00
Marko Kaznovac
131e495269 [Validator] BIC remove unused sprintf and parameter 2019-03-26 11:04:14 +01:00
David Maicher
6263e48392 [Messenger] rename auto-setup amqp option into auto_setup 2019-03-26 11:03:16 +01:00
Fabien Potencier
0034a0f420 feature #30676 Avoid dispatching SendMessageToTransportsEvent on redeliver (weaverryan)
This PR was merged into the 4.3-dev branch.

Discussion
----------

Avoid dispatching SendMessageToTransportsEvent on redeliver

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes - I think so
| New feature?  | no
| BC breaks?    | no (feature only on master)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | a lot, soon :)

This purpose of this event is to be a hook when a message is sent to a transport.
If that message is redelivered later, that's not the purpose of this hook (there
are Worker events for that) and could cause problems if the user unknowingly
tries to modify the Envelope in some way, not thinking about how this might
be a redelivery message.

Commits
-------

3ac6bf9f24 Avoid dispatching SendMessageToTransportsEvent on redeliver
2019-03-26 07:14:35 +01:00
Fabien Potencier
40e9a776d7 bug #30697 [HttpClient] Fix missing use statement (chalasr)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] Fix missing use statement

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

Commits
-------

6eddb52333 [HttpClient] Fix missing use statement
2019-03-26 07:13:35 +01:00
Fabien Potencier
ce37d04771 minor #30696 [Contracts] fix phpdoc for http-client (user_data) (gharlan)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Contracts] fix phpdoc for http-client (user_data)

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

Commits
-------

226dbbc54f [Contracts] fix phpdoc for http-client (user_data)
2019-03-26 07:12:02 +01:00
Ryan Weaver
3ac6bf9f24 Avoid dispatching SendMessageToTransportsEvent on redeliver
This purpose of this event is to be a hook when a message is sent to a transport.
If that message is redelivered later, that's not the purpose of this hook (there
are Worker events for that) and could cause problems if the user unknowingly
tries to modify the Envelope in some way, not thinking about how this might
be a redelivery message.
2019-03-25 21:09:24 -04:00
Robin Chalas
6eddb52333 [HttpClient] Fix missing use statement 2019-03-26 01:54:03 +01:00
Gregor Harlan
226dbbc54f
[Contracts] fix phpdoc for http-client (user_data) 2019-03-26 00:17:13 +01:00
Nicolas Grekas
3c3db2f14a [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
Nicolas Grekas
8585317c85 minor #30688 [Form] fix lowest deps tests (xabbuh)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form] fix lowest deps tests

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

Commits
-------

f5eaba0798 fix lowest deps tests
2019-03-25 18:17:19 +01:00
Nicolas Grekas
b8ab296adf fix typo 2019-03-25 17:39:02 +01:00
Christian Flothmann
f5eaba0798 fix lowest deps tests 2019-03-25 14:49:18 +01:00
Christian Flothmann
f806e68613 Merge branch '4.2'
* 4.2:
  Debug finalized config in debug:config
2019-03-25 14:12:22 +01:00
Fabien Potencier
5ca968d544 minor #30679 [Messenger] Add missing information in messenger logs (fabpot)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] Add missing information in messenger logs

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes-ish
| New feature?  | yes-ish
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

When using `messenger:consume`, I get the following logs:

```
2019-03-25T11:39:05+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:05+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:05+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #1.
2019-03-25T11:39:05+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport"
2019-03-25T11:39:06+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:06+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:06+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #2.
2019-03-25T11:39:06+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport"
2019-03-25T11:39:09+01:00 [info] Received message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:09+01:00 [warning] An exception occurred while handling message "Symfony\Component\Mailer\EnvelopedMessage"
2019-03-25T11:39:09+01:00 [info] Retrying Symfony\Component\Mailer\EnvelopedMessage - retry #3.
2019-03-25T11:39:09+01:00 [info] Sending message "Symfony\Component\Mailer\EnvelopedMessage" with "Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport"
```

So, an. error occurred, but I have no idea what's going on. The exception is in the context, but the context is not displayed by default. So, this PR fixes it.

Commits
-------

20664caf25 [Messenger] added missing information in messenger logs
2019-03-25 12:46:31 +01:00
Fabien Potencier
e3d42a971c fixed missing dot for error message 2019-03-25 12:45:23 +01:00
Fabien Potencier
c1467446ad feature #26555 [Validator] Add constraint on unique elements collection(Assert\Unique) (zenmate, nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Validator] Add constraint on unique elements collection(Assert\Unique)

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #26535
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest 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 the master branch.
-->

Commits
-------

d0eb13e55a Rebase and update to latest CS
fc66683cf2 Add UniqueCollection constraint and validator
2019-03-25 12:42:44 +01:00
Fabien Potencier
c34f8a9b6b minor #30681 [Mime] Removed unnecessary strtolower function call (scuben)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Mime] Removed unnecessary strtolower function call

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| License       | MIT

Commits
-------

94198876d0 [Mime] Removed unnecessary strtolower
2019-03-25 12:25:21 +01:00
Patrick Landolt
94198876d0
[Mime] Removed unnecessary strtolower 2019-03-25 12:20:53 +01:00
Fabien Potencier
20664caf25 [Messenger] added missing information in messenger logs 2019-03-25 11:54:55 +01:00
Fabien Potencier
47a2f58421 feature #27684 [FrameworkBundle] Debug container environment variables (ro0NL)
This PR was squashed before being merged into the 4.3-dev branch (closes #27684).

Discussion
----------

[FrameworkBundle] Debug container environment variables

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This PR is an attempt to ease debugging environment variables used by the container. Main purpose is to tell which are missing and show detailed usage information.

![image](https://user-images.githubusercontent.com/1047696/47601226-ae43c480-d9cd-11e8-926b-8c49069189fc.png)

![image](https://user-images.githubusercontent.com/1047696/47601234-d7645500-d9cd-11e8-9e3f-d1c2ad85dbc5.png)

Commits
-------

b813a05aa5 [FrameworkBundle] Debug container environment variables
2019-03-25 10:02:57 +01:00
Roland Franssen
b813a05aa5 [FrameworkBundle] Debug container environment variables 2019-03-25 10:02:50 +01:00
Fabien Potencier
31cd26b97e feature #30666 [Form][Console] Use dumper (ro0NL)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form][Console] Use dumper

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Continuation of #28898 for `debug:form`

Commits
-------

a94228edba [Form][Console] Use dumper
2019-03-25 09:58:19 +01:00
Fabien Potencier
cb1ab077a7 bug #30677 Fix type hints for email attachments (fabpot)
This PR was merged into the 4.3-dev branch.

Discussion
----------

Fix type hints for email attachments

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

`createDataPart()` must return a `DataPart` instance, so `attachPart()` must only accept `DataPart` instances and `getAttachments()` is guaranteed to return an array of `DataPart` instances.

Commits
-------

8059c50e75 fixed type hints for email attachments
2019-03-25 09:54:47 +01:00
Roland Franssen
a94228edba [Form][Console] Use dumper 2019-03-25 09:47:26 +01:00
Fabien Potencier
8059c50e75 fixed type hints for email attachments 2019-03-25 08:46:22 +01:00
Fabien Potencier
041f60f80a feature #30559 [HttpClient] Parse common API error formats for better exception messages (dunglas)
This PR was squashed before being merged into the 4.3-dev branch (closes #30559).

Discussion
----------

[HttpClient] Parse common API error formats for better exception messages

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | todo?

Use extra details provided by popular error formats following to improve HTTP exception messages.
The following formats are supported:

* Hydra (default in API Platform)
* RFC 7807 (followed by Symfony's [ConstraintViolationListNormalizer](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Serializer/Normalizer/ConstraintViolationListNormalizer.php) and supported by API Platform and Apigility)
* JSON:API (because it respects the semantic of the RFC 7807)

It allows to write code like the following (here in a test context):

```php
    public function testBadRequest()
    {
        $this->expectException(ClientExceptionInterface::class);
        $this->expectExceptionCode(400); // HTTP status code
        $this->expectExceptionMessage(<<<ERROR
Validation Failed

users: This collection should contain 1 element or more.
users: The current logged in user must be part of the users owning this resource.
ERROR
);

        $response = (HttpClient::create())->request('POST', 'http://example.com/api/projects', [
            'json' => [
                'name' => 'My project',
            ],
        ]);
        $response->getContent();
    }
```

Port of https://github.com/api-platform/core/pull/2608#issuecomment-472510732.

Commits
-------

96df4464a1 [HttpClient] Parse common API error formats for better exception messages
2019-03-24 18:15:37 +01:00
Kévin Dunglas
96df4464a1 [HttpClient] Parse common API error formats for better exception messages 2019-03-24 18:15:28 +01:00
Fabien Potencier
c52af28b0e feature #28898 [Console] Add dumper (ro0NL)
This PR was squashed before being merged into the 4.3-dev branch (closes #28898).

Discussion
----------

[Console] Add dumper

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/issues/10502

This PR adds a new `Dumper` helper in the Console component. As there are 2 types of dumps

- debug purpose (e.g. `dd()`, `dump()`)
- output purpose (see #24208, #27684)

For the latter we cannot use the global system (debug) dumper, i.e. `VarDumper::dump()`, we need something tied to the current output and dependency free. Here it is:

```php
$io = new SymfonyStyle($input, $output);
$dumper = new Dumper($io);

$io->writeln($dumper([-0.5, 0, 1]));
$io->writeln($dumper(new \stdClass()));
$io->writeln($dumper(123));
$io->writeln($dumper('foo'));
$io->writeln($dumper(null));
$io->writeln($dumper(true));
```

With VarDumper comonent:

![image](https://user-images.githubusercontent.com/1047696/47069483-4cc26f80-d1ef-11e8-902e-2f9b0f040f25.png)

Without:

![image](https://user-images.githubusercontent.com/1047696/47069517-6663b700-d1ef-11e8-9328-ae1db0b83d7e.png)

> https://github.com/symfony/symfony/pull/27684#discussion_r224054237 var-dumper is not a mandatory dep of fwb, can we do without?

Now we can  :)

Commits
-------

fc7465c02c [Console] Add dumper
2019-03-24 11:32:40 +01:00
Roland Franssen
fc7465c02c [Console] Add dumper 2019-03-24 11:32:26 +01:00
Fabien Potencier
468bca8faa minor #30659 [Messenger] Add a BC layer for the ConsumeMessagesCommand arguments (sroze)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] Add a BC layer for the `ConsumeMessagesCommand` arguments

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no - removing some
| Deprecations? | yes (files already updated in previous PR)
| Tests pass?   | yes
| Fixed tickets | ø
| License       | MIT
| Doc PR        | ø

Instead of conflicting `symfony/messenger` with an old `symfony/framework-bundle`, let's add a simple BC layer.

Commits
-------

21235310e3 Add a BC layer for the `ConsumeMessagesCommand` arguments
2019-03-23 17:51:03 +01:00
Samuel ROZE
21235310e3 Add a BC layer for the ConsumeMessagesCommand arguments 2019-03-23 22:35:41 +07:00
Fabien Potencier
f206538c79 fixed typo 2019-03-23 16:11:21 +01:00