Skip to content

Commit d246681

Browse files
committed
removed useless type juggling
1 parent 3fcf2ee commit d246681

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

src/Forms/Container.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public function addCheckboxList(string $name, $label = NULL, array $items = NULL
344344
public function addSelect(string $name, $label = NULL, array $items = NULL, int $size = NULL): Controls\SelectBox
345345
{
346346
return $this[$name] = (new Controls\SelectBox($label, $items))
347-
->setHtmlAttribute('size', $size > 1 ? (int) $size : NULL);
347+
->setHtmlAttribute('size', $size > 1 ? $size : NULL);
348348
}
349349

350350

@@ -355,7 +355,7 @@ public function addSelect(string $name, $label = NULL, array $items = NULL, int
355355
public function addMultiSelect(string $name, $label = NULL, array $items = NULL, int $size = NULL): Controls\MultiSelectBox
356356
{
357357
return $this[$name] = (new Controls\MultiSelectBox($label, $items))
358-
->setHtmlAttribute('size', $size > 1 ? (int) $size : NULL);
358+
->setHtmlAttribute('size', $size > 1 ? $size : NULL);
359359
}
360360

361361

src/Forms/Controls/BaseControl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function isDisabled(): bool
219219
*/
220220
public function setOmitted(bool $value = TRUE)
221221
{
222-
$this->omitted = (bool) $value;
222+
$this->omitted = $value;
223223
return $this;
224224
}
225225

src/Forms/Controls/TextBase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getValue()
6363
*/
6464
public function setNullable(bool $value = TRUE)
6565
{
66-
$this->nullable = (bool) $value;
66+
$this->nullable = $value;
6767
return $this;
6868
}
6969

@@ -74,7 +74,7 @@ public function setNullable(bool $value = TRUE)
7474
*/
7575
public function setEmptyValue(string $value)
7676
{
77-
$this->emptyValue = (string) $value;
77+
$this->emptyValue = $value;
7878
return $this;
7979
}
8080

src/Forms/Controls/UploadControl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __construct($label = NULL, bool $multiple = FALSE)
2929
{
3030
parent::__construct($label);
3131
$this->control->type = 'file';
32-
$this->control->multiple = (bool) $multiple;
32+
$this->control->multiple = $multiple;
3333
$this->setOption('type', 'file');
3434
$this->addCondition(Forms\Form::FILLED)
3535
->addRule([$this, 'isOk'], Forms\Validator::$messages[self::VALID]);

src/Forms/Rules.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ public function endCondition(): Rules
164164
*/
165165
public function addFilter(callable $filter)
166166
{
167-
Nette\Utils\Callback::check($filter);
168167
$this->rules[] = $rule = new Rule;
169168
$rule->control = $this->control;
170169
$rule->validator = function (IControl $control) use ($filter) {

0 commit comments

Comments
 (0)