Skip to content

Commit

Permalink
fixed types
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Feb 17, 2024
1 parent 15b16a6 commit 0c10ca6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Forms/Controls/ChoiceControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function getValue(): mixed
/**
* Returns selected key (not checked).
*/
public function getRawValue(): string|int
public function getRawValue(): string|int|null
{
return $this->value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static function sanitize(int $type, $value)
{
if ($type === Form::DataText) {
return is_scalar($value)
? Strings::normalizeNewLines($value)
? Strings::normalizeNewLines((string) $value)
: null;

} elseif ($type === Form::DataLine) {
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Rendering/DefaultFormRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class DefaultFormRenderer implements Nette\Forms\FormRenderer
];

protected Nette\Forms\Form $form;
protected int $counter;
protected int $counter = 0;


/**
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public static function validateMimeType(Controls\UploadControl $control, $mimeTy
{
$mimeTypes = is_array($mimeType) ? $mimeType : explode(',', $mimeType);
foreach (static::toArray($control->getValue()) as $file) {
$type = strtolower($file->getContentType());
$type = strtolower($file->getContentType() ?? '');
if (!in_array($type, $mimeTypes, true) && !in_array(preg_replace('#/.*#', '/*', $type), $mimeTypes, true)) {
return false;
}
Expand Down

0 comments on commit 0c10ca6

Please sign in to comment.