File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -51,22 +51,22 @@ class Type extends FieldType implements TranslationContainerInterface
5151 ],
5252 ];
5353
54- /** @var array<string> */
55- private array $ mimeTypes ;
56-
5754 /** @var \Ibexa\Core\FieldType\Validator[] */
5855 private $ validators ;
5956
57+ /** @var array<string> */
58+ private array $ mimeTypes ;
59+
6060 /**
61- * @param array<string> $mimeTypes
6261 * @param array<\Ibexa\Core\FieldType\Validator> $validators
62+ * @param array<string> $mimeTypes
6363 */
6464 public function __construct (
65- array $ mimeTypes ,
66- array $ validators
65+ array $ validators ,
66+ array $ mimeTypes = []
6767 ) {
68- $ this ->mimeTypes = $ mimeTypes ;
6968 $ this ->validators = $ validators ;
69+ $ this ->mimeTypes = $ mimeTypes ;
7070 }
7171
7272 /**
@@ -247,6 +247,7 @@ public function validateFieldSettings($fieldSettings): array
247247
248248 if (
249249 $ name === 'mimeTypes '
250+ && !empty ($ this ->mimeTypes )
250251 && !empty (array_diff ($ value , $ this ->mimeTypes ))
251252 ) {
252253 $ validationErrors [] = new ValidationError (
Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ protected function getMimeTypeDetectorMock()
6868 protected function createFieldTypeUnderTest ()
6969 {
7070 $ fieldType = new ImageType (
71- self ::MIME_TYPES ,
7271 [
7372 $ this ->getBlackListValidatorMock (),
7473 $ this ->getImageValidatorMock (),
75- ]
74+ ],
75+ self ::MIME_TYPES
7676 );
7777 $ fieldType ->setTransformationProcessor ($ this ->getTransformationProcessorMock ());
7878
You can’t perform that action at this time.
0 commit comments