Skip to content

Commit 22d0e78

Browse files
Merge branch '2.8' into 3.4
* 2.8: Remove duplicate condition fix useless space in docblock remove unneeded tearDown method [FrameworkBundle] Fix broken exception message Revert "fixed CS" Skip empty proxy code [Security] Fix "exclude-from-classmap" add missing double-quotes to extra_fields output message Convert InsufficientAuthenticationException to HttpException
2 parents 12b6dc4 + 783643f commit 22d0e78

File tree

6 files changed

+35
-14
lines changed

6 files changed

+35
-14
lines changed

Extension/Validator/Constraints/FormValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function validate($form, Constraint $constraint)
127127
if (!$config->getOption('allow_extra_fields') && \count($form->getExtraData()) > 0) {
128128
$this->context->setConstraint($constraint);
129129
$this->context->buildViolation($config->getOption('extra_fields_message'))
130-
->setParameter('{{ extra_fields }}', implode('", "', array_keys($form->getExtraData())))
130+
->setParameter('{{ extra_fields }}', '"'.implode('", "', array_keys($form->getExtraData())).'"')
131131
->setInvalidValue($form->getExtraData())
132132
->setCode(Form::NO_SUCH_FIELD_ERROR)
133133
->addViolation();

FormConfigBuilderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,10 @@ public function setRequestHandler(RequestHandlerInterface $requestHandler);
257257
*
258258
* Should be set to true only for root forms.
259259
*
260-
* @param bool $initialize true to initialize the form automatically,
260+
* @param bool $initialize True to initialize the form automatically,
261261
* false to suppress automatic initialization.
262262
* In the second case, you need to call
263-
* {@link FormInterface::initialize()} manually
263+
* {@link FormInterface::initialize()} manually.
264264
*
265265
* @return $this The configuration object
266266
*/

FormInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ public function getData();
127127
/**
128128
* Returns the normalized data of the field.
129129
*
130-
* @return mixed when the field is not submitted, the default data is returned.
130+
* @return mixed When the field is not submitted, the default data is returned.
131131
* When the field is submitted, the normalized submitted data is
132-
* returned if the field is valid, null otherwise
132+
* returned if the field is valid, null otherwise.
133133
*/
134134
public function getNormData();
135135

FormRendererEngineInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public function setTheme(FormView $view, $themes /*, $useDefaultThemes = true */
3838
* The type of the resource is decided by the implementation. The resource
3939
* is later passed to {@link renderBlock()} by the rendering algorithm.
4040
*
41-
* @param FormView $view the view for determining the used themes.
41+
* @param FormView $view The view for determining the used themes.
4242
* First the themes attached directly to the
4343
* view with {@link setTheme()} are considered,
44-
* then the ones of its parent etc
44+
* then the ones of its parent etc.
4545
* @param string $blockName The name of the block to render
4646
*
4747
* @return mixed the renderer resource or false, if none was found
@@ -70,10 +70,10 @@ public function getResourceForBlockName(FormView $view, $blockName);
7070
* The type of the resource is decided by the implementation. The resource
7171
* is later passed to {@link renderBlock()} by the rendering algorithm.
7272
*
73-
* @param FormView $view the view for determining the used themes.
73+
* @param FormView $view The view for determining the used themes.
7474
* First the themes attached directly to
7575
* the view with {@link setTheme()} are
76-
* considered, then the ones of its parent etc
76+
* considered, then the ones of its parent etc.
7777
* @param array $blockNameHierarchy The block name hierarchy, with the root block
7878
* at the beginning
7979
* @param int $hierarchyLevel The level in the hierarchy at which to start
@@ -108,10 +108,10 @@ public function getResourceForBlockNameHierarchy(FormView $view, array $blockNam
108108
* The type of the resource is decided by the implementation. The resource
109109
* is later passed to {@link renderBlock()} by the rendering algorithm.
110110
*
111-
* @param FormView $view the view for determining the used themes.
111+
* @param FormView $view The view for determining the used themes.
112112
* First the themes attached directly to
113113
* the view with {@link setTheme()} are
114-
* considered, then the ones of its parent etc
114+
* considered, then the ones of its parent etc.
115115
* @param array $blockNameHierarchy The block name hierarchy, with the root block
116116
* at the beginning
117117
* @param int $hierarchyLevel The level in the hierarchy at which to start

Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,33 @@ public function testViolationIfExtraData()
592592
$this->validator->validate($form, new Form());
593593

594594
$this->buildViolation('Extra!')
595-
->setParameter('{{ extra_fields }}', 'foo')
595+
->setParameter('{{ extra_fields }}', '"foo"')
596596
->setInvalidValue(array('foo' => 'bar'))
597597
->setCode(Form::NO_SUCH_FIELD_ERROR)
598598
->assertRaised();
599599
}
600600

601+
public function testViolationFormatIfMultipleExtraFields()
602+
{
603+
$form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!'))
604+
->setCompound(true)
605+
->setDataMapper($this->getDataMapper())
606+
->add($this->getBuilder('child'))
607+
->getForm();
608+
609+
$form->submit(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz'));
610+
611+
$this->expectNoValidate();
612+
613+
$this->validator->validate($form, new Form());
614+
615+
$this->buildViolation('Extra!')
616+
->setParameter('{{ extra_fields }}', '"foo", "baz", "quux"')
617+
->setInvalidValue(array('foo' => 'bar', 'baz' => 'qux', 'quux' => 'quuz'))
618+
->setCode(Form::NO_SUCH_FIELD_ERROR)
619+
->assertRaised();
620+
}
621+
601622
public function testNoViolationIfAllowExtraData()
602623
{
603624
$context = $this->getMockExecutionContext();

Util/OrderedHashMapIterator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class OrderedHashMapIterator implements \Iterator
6262
* keys
6363
* @param array $orderedKeys The keys of the map in the order in which
6464
* they should be iterated
65-
* @param array $managedCursors an array from which to reference the
65+
* @param array $managedCursors An array from which to reference the
6666
* iterator's cursor as long as it is alive.
6767
* This array is managed by the corresponding
6868
* {@link OrderedHashMap} instance to support
69-
* recognizing the deletion of elements
69+
* recognizing the deletion of elements.
7070
*/
7171
public function __construct(array &$elements, array &$orderedKeys, array &$managedCursors)
7272
{

0 commit comments

Comments
 (0)