Skip to content

[7.x] Add isEmpty() method to HtmlString - #32289

Merged
taylorotwell merged 3 commits into
laravel:7.xfrom
mvdnbrk:htmlstring-is-empty
Apr 8, 2020
Merged

taylorotwell merged 3 commits into
laravel:7.xfrom
mvdnbrk:htmlstring-is-empty

Conversation

@mvdnbrk

@mvdnbrk mvdnbrk commented Apr 8, 2020 •

Copy link
Copy Markdown
Contributor

This PR adds an isEmpty method to the \Illuminate\Support\HtmlString class just like the Stringable class has.

$string = new \Illuminate\Support\HtmlString(''); 

if ($string->isEmpty())

// vs

if (empty($string->toHtml()))

@taylorotwell
taylorotwell merged commit 5b3a6cf into laravel:7.x Apr 8, 2020
@mvdnbrk

mvdnbrk commented Apr 8, 2020

Copy link
Copy Markdown
Contributor Author

@taylorotwell Thank you!

@mvdnbrk
mvdnbrk deleted the htmlstring-is-empty branch April 8, 2020 17:46
@vlakoff

vlakoff commented Apr 19, 2020

Copy link
Copy Markdown
Contributor

Refs #32300

salmanarshad321 pushed a commit to salmanarshad321/framework that referenced this pull request Sep 23, 2026
* Add isEmpty() method to HtmlString

* Update HtmlString.php

* Update HtmlString.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants