Skip to content

Commit

Permalink
feature #31082 [Form] Show all option normalizers on debug:form comma…
Browse files Browse the repository at this point in the history
…nd (yceruto)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[Form] Show all option normalizers on debug:form command

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

Follow-up #30371

![normalizers](https://user-images.githubusercontent.com/2028198/55996454-6667df80-5c85-11e9-94f6-9ee3988833f3.png)

Commits
-------

f1d3bc0 Show all option normalizers on debug:form command
  • Loading branch information
fabpot committed Apr 15, 2019
2 parents e683dfa + f1d3bc0 commit 7cf96a4
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 65 deletions.
Expand Up @@ -120,7 +120,7 @@ protected function getOptionDefinition(OptionsResolver $optionsResolver, $option
'lazy' => 'getLazyClosures',
'allowedTypes' => 'getAllowedTypes',
'allowedValues' => 'getAllowedValues',
'normalizer' => 'getNormalizer',
'normalizers' => 'getNormalizers',
'deprecationMessage' => 'getDeprecationMessage',
];

Expand Down
Expand Up @@ -87,7 +87,7 @@ protected function describeOption(OptionsResolver $optionsResolver, array $optio
}
}
}
$data['has_normalizer'] = isset($definition['normalizer']);
$data['has_normalizer'] = isset($definition['normalizers']);

$this->writeData($data, $options);
}
Expand Down
Expand Up @@ -118,7 +118,7 @@ protected function describeOption(OptionsResolver $optionsResolver, array $optio
'Default' => 'default',
'Allowed types' => 'allowedTypes',
'Allowed values' => 'allowedValues',
'Normalizer' => 'normalizer',
'Normalizers' => 'normalizers',
];
$rows = [];
foreach ($map as $label => $name) {
Expand Down
44 changes: 23 additions & 21 deletions src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php
Expand Up @@ -164,27 +164,29 @@ public function testDebugCustomFormTypeOption()
Symfony\Component\Form\Tests\Command\FooType (foo)
==================================================
---------------- -----------------------------------------------------------%s
Required true %w
---------------- -----------------------------------------------------------%s
Default - %w
---------------- -----------------------------------------------------------%s
Allowed types [ %w
"string" %w
] %w
---------------- -----------------------------------------------------------%s
Allowed values [ %w
"bar", %w
"baz" %w
] %w
---------------- -----------------------------------------------------------%s
Normalizer Closure(Options $options, $value) { %w
class: "Symfony\Component\Form\Tests\Command\FooType" %w
this: Symfony\Component\Form\Tests\Command\FooType { …} %w
file: "%s"%w
line: "%d to %d"%w
} %w
---------------- -----------------------------------------------------------%s
---------------- -----------%s
Required true %s
---------------- -----------%s
Default - %s
---------------- -----------%s
Allowed types [ %s
"string"%s
] %s
---------------- -----------%s
Allowed values [ %s
"bar", %s
"baz" %s
] %s
---------------- -----------%s
Normalizers [ %s
Closure(%s
class:%s
this: %s
file: %s
line: %s
} %s
] %s
---------------- -----------%s
TXT
, $tester->getDisplay(true));
Expand Down
Expand Up @@ -2,22 +2,26 @@
Symfony\Component\Form\Extension\Core\Type\ChoiceType (choice_translation_domain)
=================================================================================

---------------- --------------------%s
Required false %s
---------------- --------------------%s
Default true %s
---------------- --------------------%s
Allowed types [ %s
"null", %s
"bool", %s
"string" %s
] %s
---------------- --------------------%s
Allowed values - %s
---------------- --------------------%s
Normalizer Closure%s{%A
file: "%s%eExtension%eCore%eType%eChoiceType.php"%w
line: %s
} %s
---------------- --------------------%s
---------------- -----------%s
Required false %s
---------------- -----------%s
Default true %s
---------------- -----------%s
Allowed types [ %s
"null", %s
"bool", %s
"string"%s
] %s
---------------- -----------%s
Allowed values - %s
---------------- -----------%s
Normalizers [ %s
Closure(%s
class:%s
this: %s
file: %s
line: %s
} %s
] %s
---------------- -----------%s

Expand Up @@ -14,5 +14,5 @@ Symfony\Component\Form\Tests\Console\Descriptor\FooType (bar)
--------------------- -----------------------------------
Allowed values -
--------------------- -----------------------------------
Normalizer -
Normalizers -
--------------------- -----------------------------------
@@ -1,4 +1,3 @@

Symfony\Component\Form\Tests\Console\Descriptor\FooType (empty_data)
====================================================================

Expand All @@ -22,6 +21,6 @@ Symfony\Component\Form\Tests\Console\Descriptor\FooType (empty_data)
---------------- ----------------------%s
Allowed values - %s
---------------- ----------------------%s
Normalizer - %s
Normalizers - %s
---------------- ----------------------%s

Expand Up @@ -2,23 +2,27 @@
Symfony\Component\Form\Tests\Console\Descriptor\FooType (foo)
=============================================================

---------------- --------------------%s
Required true %s
---------------- --------------------%s
Default - %s
---------------- --------------------%s
Allowed types [ %s
"string" %s
] %s
---------------- --------------------%s
Allowed values [ %s
"bar", %s
"baz" %s
] %s
---------------- --------------------%s
Normalizer Closure%s{%A
file: "%s%eTests%eConsole%eDescriptor%eAbstractDescriptorTest.php"%w
line: %s
} %s
---------------- --------------------%s
---------------- -----------%s
Required true %s
---------------- -----------%s
Default - %s
---------------- -----------%s
Allowed types [ %s
"string"%s
] %s
---------------- -----------%s
Allowed values [ %s
"bar", %s
"baz" %s
] %s
---------------- -----------%s
Normalizers [ %s
Closure(%s
class:%s
this: %s
file: %s
line: %s
} %s
] %s
---------------- -----------%s

2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/composer.json
Expand Up @@ -19,7 +19,7 @@
"php": "^7.1.3",
"symfony/event-dispatcher": "^4.3",
"symfony/intl": "^4.3",
"symfony/options-resolver": "~4.2",
"symfony/options-resolver": "~4.3",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0",
"symfony/property-access": "~3.4|~4.0"
Expand Down

0 comments on commit 7cf96a4

Please sign in to comment.