From 2d869c727f21c785908fc3e1a47482a00bdf4f91 Mon Sep 17 00:00:00 2001 From: Attila Fulop <1162360+fulopattila122@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:20:56 +0300 Subject: [PATCH] `ConfigurableModel::hasConfiguration()` returns false on empty arrays --- Changelog.md | 5 +++++ Traits/ConfigurableModel.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index f044c04..663a83c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,11 @@ ## 4.x Series +## Unreleased +##### 2024-XX-YY + +- Changed the `ConfigurableModel::hasConfiguration()` trait to return false on empty arrays as well (until now, only `null` was considered as no config) + ## 4.1.0 ##### 2024-07-11 diff --git a/Traits/ConfigurableModel.php b/Traits/ConfigurableModel.php index b37966c..3821f60 100644 --- a/Traits/ConfigurableModel.php +++ b/Traits/ConfigurableModel.php @@ -42,7 +42,7 @@ public function configuration(): ?array public function hasConfiguration(): bool { - return null !== $this->{static::$configurationFieldName}; + return !empty($this->{static::$configurationFieldName}); } public function doesntHaveConfiguration(): bool