Skip to content

Commit 88d3c38

Browse files
committed
unsafe native types
1 parent 69d1030 commit 88d3c38

7 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/Forms/Controls/BaseControl.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function loadHttpData(): void
120120
/**
121121
* Loads HTTP data.
122122
*/
123-
protected function getHttpData($type, ?string $htmlTail = null): mixed
123+
protected function getHttpData(int $type, ?string $htmlTail = null): mixed
124124
{
125125
return $this->getForm()->getHttpData($type, $this->getHtmlName() . $htmlTail);
126126
}
@@ -420,7 +420,7 @@ public function addRule(
420420
* Adds a validation condition a returns new branch.
421421
* @param (callable(self): bool)|string|bool $validator
422422
*/
423-
public function addCondition($validator, mixed $value = null): Rules
423+
public function addCondition(callable|string|bool $validator, mixed $value = null): Rules
424424
{
425425
return $this->rules->addCondition($validator, $value);
426426
}
@@ -430,7 +430,7 @@ public function addCondition($validator, mixed $value = null): Rules
430430
* Adds a validation condition based on another control a returns new branch.
431431
* @param (callable(self): bool)|string $validator
432432
*/
433-
public function addConditionOn(Control $control, $validator, mixed $value = null): Rules
433+
public function addConditionOn(Control $control, callable|string $validator, mixed $value = null): Rules
434434
{
435435
return $this->rules->addConditionOn($control, $validator, $value);
436436
}
@@ -532,7 +532,7 @@ public function cleanErrors(): void
532532
/**
533533
* Sets user-specific option.
534534
*/
535-
public function setOption($key, mixed $value): static
535+
public function setOption(string $key, mixed $value): static
536536
{
537537
if ($value === null) {
538538
unset($this->options[$key]);
@@ -547,7 +547,7 @@ public function setOption($key, mixed $value): static
547547
/**
548548
* Returns user-specific option.
549549
*/
550-
public function getOption($key): mixed
550+
public function getOption(string $key): mixed
551551
{
552552
return $this->options[$key] ?? null;
553553
}
@@ -567,7 +567,7 @@ public function getOptions(): array
567567

568568

569569
/** @param mixed[] $args */
570-
public function __call(string $name, array $args)
570+
public function __call(string $name, array $args): mixed
571571
{
572572
$class = static::class;
573573
do {

src/Forms/Controls/Button.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function isFilled(): bool
4040
/**
4141
* Bypasses label generation.
4242
*/
43-
public function getLabel($caption = null): Html|string|null
43+
public function getLabel(string|Stringable|null $caption = null): Html|string|null
4444
{
4545
return null;
4646
}

src/Forms/Controls/Checkbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getControl(): Html
6363
/**
6464
* Bypasses label generation.
6565
*/
66-
public function getLabel($caption = null): Html|string|null
66+
public function getLabel(string|Stringable|null $caption = null): Html|string|null
6767
{
6868
return null;
6969
}

src/Forms/Controls/CheckboxList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public function getControl(): Html
7575
}
7676

7777

78-
public function getLabel($caption = null): Html
78+
public function getLabel(string|Stringable|null $caption = null): Html
7979
{
8080
return parent::getLabel($caption)->for(null);
8181
}
8282

8383

84-
public function getControlPart($key = null): Html
84+
public function getControlPart(int|string|null $key = null): Html
8585
{
8686
$key = key([(string) $key => null]);
8787
return parent::getControl()->addAttributes([
@@ -94,7 +94,7 @@ public function getControlPart($key = null): Html
9494
}
9595

9696

97-
public function getLabelPart($key = null): Html
97+
public function getLabelPart(int|string|null $key = null): Html
9898
{
9999
$itemLabel = clone $this->itemLabel;
100100
return func_num_args()

src/Forms/Controls/HiddenField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getControl(): Html
9898
/**
9999
* Bypasses label generation.
100100
*/
101-
public function getLabel($caption = null): Html|string|null
101+
public function getLabel(string|Stringable|null $caption = null): Html|string|null
102102
{
103103
return null;
104104
}

src/Forms/Controls/RadioList.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ public function getControl(): Html
7272
}
7373

7474

75-
public function getLabel($caption = null): Html
75+
public function getLabel(string|\Stringable|null $caption = null): Html
7676
{
7777
return parent::getLabel($caption)->for(null);
7878
}
7979

8080

81-
public function getControlPart($key = null): Html
81+
public function getControlPart(int|string|null $key = null): Html
8282
{
8383
$key = key([(string) $key => null]);
8484
return parent::getControl()->addAttributes([
@@ -90,7 +90,7 @@ public function getControlPart($key = null): Html
9090
}
9191

9292

93-
public function getLabelPart($key = null): Html
93+
public function getLabelPart(int|string|null $key = null): Html
9494
{
9595
$itemLabel = clone $this->itemLabel;
9696
return func_num_args()

src/Forms/Controls/SubmitButton.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function click(): void
104104
}
105105

106106

107-
public function getControl($caption = null): Nette\Utils\Html
107+
public function getControl(string|Stringable|null $caption = null): Nette\Utils\Html
108108
{
109109
$scope = [];
110110
foreach ((array) $this->validationScope as $control) {

0 commit comments

Comments
 (0)