Skip to content

Commit 5a70fcd

Browse files
ThomasLandauerjaviereguiluz
authored andcommitted
Update dom_crawler.rst
Since the expected `empty()` doesn't work, I explained how to check if a filter did find anything.
1 parent e356afe commit 5a70fcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/dom_crawler.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ To remove a node the anonymous function must return false.
114114
.. note::
115115

116116
All filter methods return a new :class:`Symfony\\Component\\DomCrawler\\Crawler`
117-
instance with filtered content.
117+
instance with the filtered content. To check if the filter actually
118+
found something, use ``$crawler->count() > 0`` on this new crawler.
118119

119120
Both the :method:`Symfony\\Component\\DomCrawler\\Crawler::filterXPath` and
120121
:method:`Symfony\\Component\\DomCrawler\\Crawler::filter` methods work with

0 commit comments

Comments
 (0)