From 343c43c4ca135436dceca19a7cee77d040c4a9d8 Mon Sep 17 00:00:00 2001 From: Deeka Wong Date: Wed, 8 May 2024 09:27:50 +0800 Subject: [PATCH] blank and filled now support stringable (#617) * blank and filled now support stringable * chore: Add blank and filled functions for stringable support * feat: Add tests for blank and filled functions with stringable support * chore: Update Functions.php to support Stringable interface --------- Co-authored-by: Deeka Wong <8337659+huangdijia@users.noreply.github.com> --- src/Functions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Functions.php b/src/Functions.php index 0acd17d..bf2655e 100644 --- a/src/Functions.php +++ b/src/Functions.php @@ -100,6 +100,10 @@ function blank($value): bool return count($value) === 0; } + if ($value instanceof Stringable) { + return trim((string) $value) === ''; + } + return empty($value); }