Skip to content

Commit 0436587

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

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ 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 = null;
96+
if (class_exists('Symfony\Component\HttpFoundation\File\File')) {
97+
$dataClass = function (Options $options) {
98+
return $options['multiple'] ? null : 'Symfony\Component\HttpFoundation\File\File';
99+
};
100+
}
98101

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

0 commit comments

Comments
 (0)