Skip to content

Conversation

fancyweb
Copy link
Contributor

@fancyweb fancyweb commented Aug 22, 2019

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

It kind of improve the DX, especially when you define a lot of nested form options since the file and line cannot be displayed.

$resolver->setDefaults([
    'array' => function (OptionsResolver $arrayResolver): void {
        $arrayResolver->setRequired('foo');
    },
]);

Before:
The required option "foo" is missing.

After:
The required option "array[foo]" is missing.

That can go to 4.3 I guess.

@fancyweb fancyweb force-pushed the options-resolver-nested-messages branch from ebe8fff to 356540a Compare August 22, 2019 16:22
@yceruto yceruto added this to the next milestone Aug 22, 2019
@yceruto
Copy link
Member

yceruto commented Aug 22, 2019

New feature IMO

@fancyweb fancyweb force-pushed the options-resolver-nested-messages branch from 356540a to a981fc3 Compare August 23, 2019 06:30
@fabpot
Copy link
Member

fabpot commented Sep 8, 2019

Thank you @fancyweb.

fabpot added a commit that referenced this pull request Sep 8, 2019
… in exceptions (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[OptionsResolver] Display full nested option hierarchy in exceptions

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

It kind of improve the DX, especially when you define a lot of nested form options since the file and line cannot be displayed.

```php
$resolver->setDefaults([
    'array' => function (OptionsResolver $arrayResolver): void {
        $arrayResolver->setRequired('foo');
    },
]);

```

Before:
`The required option "foo" is missing.`

After:
`The required option "array[foo]" is missing.`

That can go to 4.3 I guess.

Commits
-------

a981fc3 [OptionsResolver] Display full nested options hierarchy in exceptions
@fabpot fabpot merged commit a981fc3 into symfony:4.4 Sep 8, 2019
@fancyweb fancyweb deleted the options-resolver-nested-messages branch September 10, 2019 06:13
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants