From af1909bc7899e329227edd2dbfe0538c09a6b4ff Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 13 Mar 2026 17:26:11 +0300 Subject: [PATCH] Make all `CheckboxItem` and `RadioItem` properties required --- CHANGELOG.md | 1 + UPGRADE.md | 4 +++- src/Widget/CheckboxList/CheckboxItem.php | 4 ++-- src/Widget/RadioList/RadioItem.php | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fb516a3..456963d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 4.0.0 under development - Chg #221: Throw `LogicException` in `Tag::id()` when id is empty string (@razvbir) +- Chg #267: Make all `CheckboxItem` and `RadioItem` properties required (@vjik) ## 3.13.0 March 13, 2026 diff --git a/UPGRADE.md b/UPGRADE.md index 37b8a9f6..2f1387ee 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -9,5 +9,7 @@ application when you upgrade the package from one version to another. ## Upgrade from 3.x -- `Tag::id()` now throws `LogicException` when an empty string is passed. Check your code for places where you call +- `Tag::id()` now throws `LogicException` when an empty string is passed. Check your code for places where you call `Tag::id()` and make sure you are not passing an empty string. +- All `CheckboxItem` and `RadioItem` properties are now required. If you create instances of these classes directly, + make sure to pass `$labelAttributes` and `$labelWrap` arguments explicitly. diff --git a/src/Widget/CheckboxList/CheckboxItem.php b/src/Widget/CheckboxList/CheckboxItem.php index 7df2e9e5..bef558be 100644 --- a/src/Widget/CheckboxList/CheckboxItem.php +++ b/src/Widget/CheckboxList/CheckboxItem.php @@ -16,7 +16,7 @@ public function __construct( public array $checkboxAttributes, public string $label, public bool $encodeLabel, - public array $labelAttributes = [], - public bool $labelWrap = true, + public array $labelAttributes, + public bool $labelWrap, ) {} } diff --git a/src/Widget/RadioList/RadioItem.php b/src/Widget/RadioList/RadioItem.php index fcd419d1..2467d874 100644 --- a/src/Widget/RadioList/RadioItem.php +++ b/src/Widget/RadioList/RadioItem.php @@ -16,7 +16,7 @@ public function __construct( public array $radioAttributes, public string $label, public bool $encodeLabel, - public array $labelAttributes = [], - public bool $labelWrap = true, + public array $labelAttributes, + public bool $labelWrap, ) {} }