Skip to content

Commit c5efa8c

Browse files
authored
Minor refactor RadioList::renderUncheckInput() and CheckboxList::renderUncheckInput() (#259)
1 parent 9726da9 commit c5efa8c

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- New #249: Add `Tag::addStyle()` and `Tag::removeStyle()` methods (@vjik)
66
- New #252: Add `Color` class, `Html::color()` and `Input::color()` methods (@razvbir)
7+
- Enh #259: Minor refactor `RadioList::renderUncheckInput()` and `CheckboxList::renderUncheckInput()` methods (@vjik)
78

89
## 3.11.0 June 10, 2025
910

src/Widget/CheckboxList/CheckboxList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function render(): string
318318

319319
$html = [];
320320
if ($this->uncheckValue !== null) {
321-
$html[] = $this->renderUncheckInput();
321+
$html[] = $this->renderUncheckInput($this->uncheckValue);
322322
}
323323
if (!empty($this->containerTag)) {
324324
$html[] = Html::openTag($this->containerTag, $this->containerAttributes);
@@ -333,12 +333,12 @@ public function render(): string
333333
return implode("\n", $html);
334334
}
335335

336-
private function renderUncheckInput(): string
336+
private function renderUncheckInput(string $uncheckValue): string
337337
{
338338
return
339339
Input::hidden(
340340
Html::getNonArrayableName($this->name),
341-
$this->uncheckValue,
341+
$uncheckValue,
342342
)
343343
->addAttributes(
344344
array_merge(
@@ -347,7 +347,7 @@ private function renderUncheckInput(): string
347347
'disabled' => $this->checkboxAttributes['disabled'] ?? null,
348348
'form' => $this->checkboxAttributes['form'] ?? null,
349349
],
350-
$this->individualInputAttributes[$this->uncheckValue] ?? [],
350+
$this->individualInputAttributes[$uncheckValue] ?? [],
351351
),
352352
)
353353
->render();

src/Widget/RadioList/RadioList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function render(): string
300300

301301
$html = [];
302302
if ($this->uncheckValue !== null) {
303-
$html[] = $this->renderUncheckInput();
303+
$html[] = $this->renderUncheckInput($this->uncheckValue);
304304
}
305305
if (!empty($this->containerTag)) {
306306
$html[] = Html::openTag($this->containerTag, $this->containerAttributes);
@@ -315,12 +315,12 @@ public function render(): string
315315
return implode("\n", $html);
316316
}
317317

318-
private function renderUncheckInput(): string
318+
private function renderUncheckInput(string $uncheckValue): string
319319
{
320320
return
321321
Input::hidden(
322322
Html::getNonArrayableName($this->name),
323-
$this->uncheckValue,
323+
$uncheckValue,
324324
)
325325
->addAttributes(
326326
array_merge(
@@ -329,7 +329,7 @@ private function renderUncheckInput(): string
329329
'disabled' => $this->radioAttributes['disabled'] ?? null,
330330
'form' => $this->radioAttributes['form'] ?? null,
331331
],
332-
$this->individualInputAttributes[$this->uncheckValue] ?? [],
332+
$this->individualInputAttributes[$uncheckValue] ?? [],
333333
),
334334
)
335335
->render();

0 commit comments

Comments
 (0)