Skip to content

Commit aa5f36f

Browse files
committed
[Form] Move check of class existence out of closure
1 parent 072c5fe commit aa5f36f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Component/Form/Extension/Core/Type/FileType.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ public function finishView(FormView $view, FormInterface $form, array $options)
9292
*/
9393
public function configureOptions(OptionsResolver $resolver)
9494
{
95-
$dataClass = function (Options $options) {
96-
return $options['multiple'] || !class_exists('Symfony\Component\HttpFoundation\File\File') ? null : 'Symfony\Component\HttpFoundation\File\File';
97-
};
95+
$dataClass = class_exists('Symfony\Component\HttpFoundation\File\File')
96+
? function (Options $options) {
97+
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
98+
}
99+
: null;
98100

99101
$emptyData = function (Options $options) {
100102
return $options['multiple'] ? array() : null;

0 commit comments

Comments
 (0)