From 07348d1a6242c1103e409ec9d622fd1634f7b75d Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 12 Dec 2025 22:17:57 +0300 Subject: [PATCH 1/2] Minor refactor `RadioList::renderUncheckInput()` and `CheckboxList::renderUncheckInput()` methods --- CHANGELOG.md | 1 + src/Widget/CheckboxList/CheckboxList.php | 6 +++--- src/Widget/RadioList/RadioList.php | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e06cc7..d52a3db0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - New #249: Add `Tag::addStyle()` and `Tag::removeStyle()` methods (@vjik) - New #252: Add `Color` class, `Html::color()` and `Input::color()` methods (@razvbir) +- Enh #259: Minor refactor `RadioList::renderUncheckInput()` and `CheckboxList::renderUncheckInput()` methods (@vjik) ## 3.11.0 June 10, 2025 diff --git a/src/Widget/CheckboxList/CheckboxList.php b/src/Widget/CheckboxList/CheckboxList.php index 472922c6..005a89b4 100644 --- a/src/Widget/CheckboxList/CheckboxList.php +++ b/src/Widget/CheckboxList/CheckboxList.php @@ -318,7 +318,7 @@ public function render(): string $html = []; if ($this->uncheckValue !== null) { - $html[] = $this->renderUncheckInput(); + $html[] = $this->renderUncheckInput($this->uncheckValue); } if (!empty($this->containerTag)) { $html[] = Html::openTag($this->containerTag, $this->containerAttributes); @@ -333,7 +333,7 @@ public function render(): string return implode("\n", $html); } - private function renderUncheckInput(): string + private function renderUncheckInput(string $uncheckValue): string { return Input::hidden( @@ -347,7 +347,7 @@ private function renderUncheckInput(): string 'disabled' => $this->checkboxAttributes['disabled'] ?? null, 'form' => $this->checkboxAttributes['form'] ?? null, ], - $this->individualInputAttributes[$this->uncheckValue] ?? [], + $this->individualInputAttributes[$uncheckValue] ?? [], ), ) ->render(); diff --git a/src/Widget/RadioList/RadioList.php b/src/Widget/RadioList/RadioList.php index 95e4df3b..a86eea74 100644 --- a/src/Widget/RadioList/RadioList.php +++ b/src/Widget/RadioList/RadioList.php @@ -300,7 +300,7 @@ public function render(): string $html = []; if ($this->uncheckValue !== null) { - $html[] = $this->renderUncheckInput(); + $html[] = $this->renderUncheckInput($this->uncheckValue); } if (!empty($this->containerTag)) { $html[] = Html::openTag($this->containerTag, $this->containerAttributes); @@ -315,7 +315,7 @@ public function render(): string return implode("\n", $html); } - private function renderUncheckInput(): string + private function renderUncheckInput(string $uncheckValue): string { return Input::hidden( @@ -329,7 +329,7 @@ private function renderUncheckInput(): string 'disabled' => $this->radioAttributes['disabled'] ?? null, 'form' => $this->radioAttributes['form'] ?? null, ], - $this->individualInputAttributes[$this->uncheckValue] ?? [], + $this->individualInputAttributes[$uncheckValue] ?? [], ), ) ->render(); From 4d3a5baa1f7177f5400d3994fbc2dd962b989758 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 12 Dec 2025 22:19:33 +0300 Subject: [PATCH 2/2] improve --- src/Widget/CheckboxList/CheckboxList.php | 2 +- src/Widget/RadioList/RadioList.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Widget/CheckboxList/CheckboxList.php b/src/Widget/CheckboxList/CheckboxList.php index 005a89b4..79648351 100644 --- a/src/Widget/CheckboxList/CheckboxList.php +++ b/src/Widget/CheckboxList/CheckboxList.php @@ -338,7 +338,7 @@ private function renderUncheckInput(string $uncheckValue): string return Input::hidden( Html::getNonArrayableName($this->name), - $this->uncheckValue, + $uncheckValue, ) ->addAttributes( array_merge( diff --git a/src/Widget/RadioList/RadioList.php b/src/Widget/RadioList/RadioList.php index a86eea74..0e725847 100644 --- a/src/Widget/RadioList/RadioList.php +++ b/src/Widget/RadioList/RadioList.php @@ -320,7 +320,7 @@ private function renderUncheckInput(string $uncheckValue): string return Input::hidden( Html::getNonArrayableName($this->name), - $this->uncheckValue, + $uncheckValue, ) ->addAttributes( array_merge(