Skip to content

Commit

Permalink
blank and filled now support stringable (#617)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
huangdijia and huangdijia authored May 8, 2024
1 parent 0e2eee5 commit 343c43c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ function blank($value): bool
return count($value) === 0;
}

if ($value instanceof Stringable) {
return trim((string) $value) === '';
}

return empty($value);
}

Expand Down

0 comments on commit 343c43c

Please sign in to comment.