Skip to content

Commit

Permalink
Fix multiple ImageField constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb33300 committed Jul 6, 2024
1 parent 35953b5 commit 3c9a9b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Form/Type/FileUploadType.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\Uid\Ulid;
use Symfony\Component\Uid\Uuid;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\All;

/**
* @author Yonel Ceruto <[email protected]>
Expand All @@ -39,7 +40,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$uploadFilename = $options['upload_filename'];
$uploadValidate = $options['upload_validate'];
$allowAdd = $options['allow_add'];
$options['constraints'] = $options['file_constraints'];
$options['constraints'] = $options['multiple'] ? new All($options['file_constraints']) : $options['file_constraints'];

Check failure on line 43 in src/Form/Type/FileUploadType.php

View workflow job for this annotation

GitHub Actions / phpstan

Only booleans are allowed in a ternary operator condition, mixed given.
unset($options['upload_dir'], $options['upload_new'], $options['upload_delete'], $options['upload_filename'], $options['upload_validate'], $options['download_path'], $options['allow_add'], $options['allow_delete'], $options['compound'], $options['file_constraints']);

$builder->add('file', FileType::class, $options);
Expand Down

0 comments on commit 3c9a9b3

Please sign in to comment.