Skip to content

Commit 7063ac7

Browse files
committed
fix: Nette: Forms: Controls
1 parent 2e07cf6 commit 7063ac7

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

phpstan.neon

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ parameters:
1414
- identifier: assign.propertyType
1515
- identifier: missingType.iterableValue
1616
- identifier: missingType.parameter
17-
- identifier: offsetAccess.nonOffsetAccessible
18-
- identifier: offsetAssign.dimType
1917
- identifier: return.type

src/Nette/Forms/Controls/LocalDateInput.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Nette\Utils\Html;
1313
use Override;
1414

15+
use function implode;
16+
1517
class LocalDateInput extends TextInput
1618
{
1719
/**
@@ -98,7 +100,7 @@ public function setValue($value)
98100
public function getControl(): Html
99101
{
100102
$control = parent::getControl();
101-
$control->class[] = implode(' ', static::$additionalHtmlClasses);
103+
$control->class .= ' ' . implode(' ', static::$additionalHtmlClasses);
102104

103105
return $control;
104106
}

src/Nette/Forms/Controls/LocalDateTimeInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function setValue($value)
9898
public function getControl(): Html
9999
{
100100
$control = parent::getControl();
101-
$control->class[] = implode(' ', static::$additionalHtmlClasses);
101+
$control->class .= ' ' . implode(' ', static::$additionalHtmlClasses);
102102

103103
return $control;
104104
}

src/Nette/Forms/Controls/SelectBox.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ public function setItems(array $items, bool $useKeys = true)
9797
foreach ($items as $key => $value) {
9898
unset($items[$key]);
9999
if (is_array($value)) {
100+
$resWithKey = [];
100101
foreach ($value as $val) {
101102
assert(is_string($val) || $val instanceof Stringable);
102-
$res[$key][(string) $val] = $val;
103+
$resWithKey[(string) $val] = $val;
103104
}
105+
$res[$key] = $resWithKey;
104106
} else {
105107
assert(is_string($value) || $value instanceof Stringable);
106108
$res[(string) $value] = $value;

0 commit comments

Comments
 (0)