Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
ciastektk committed Dec 5, 2023
1 parent 2e03387 commit 29a2224
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30625,11 +30625,6 @@ parameters:
count: 1
path: tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\ImageIntegrationTest\\:\\:getSettingsSchema\\(\\) return type has no value type specified in iterable type array\\.$#"
count: 1
path: tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\ImageIntegrationTest\\:\\:getStoragePrefix\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
3 changes: 2 additions & 1 deletion src/lib/FieldType/Image/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class Type extends FieldType implements TranslationContainerInterface
],
];

/** @var array{
/**
* @var array{
* mimeTypes: array{
* type: string,
* default: array{},
Expand Down
3 changes: 2 additions & 1 deletion src/lib/FieldType/Validator/ImageValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ private function innerValidate($filePath, array $mimeTypes): bool
{
// silence `getimagesize` error as extension-wise valid image files might produce it anyway
// note that file extension checking is done using other validation which should be called before this one
if (!$imageData = @getimagesize($filePath)) {
$imageData = @getimagesize($filePath);
if (false === $imageData) {
$this->errors[] = new ValidationError(
'A valid image file is required.',
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin
}

/**
* @return array<string>
* @return array<string, string>
*
* @throws \JsonException
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ public function getTypeName()
}

/**
* Get expected settings schema.
*
* @return array
* @return array{
* mimeTypes: array{
* type: string,
* default: array{},
* }
* }
*/
public function getSettingsSchema()
public function getSettingsSchema(): array
{
return [
'mimeTypes' => [
Expand Down

0 comments on commit 29a2224

Please sign in to comment.