Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #23471 [Finder] Add a method to check if any results were fou…
…nd (duncan3dc) This PR was merged into the 3.4 branch. Discussion ---------- [Finder] Add a method to check if any results were found | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT If I want to know if any results were found, but I don't want to start trawling through them, I have to do the rather ugly: ```php $found = false; foreach ($finder as $thing) { $found = true; break; } if ($found) { ``` This PR enables the much more readable: ```php if ($finder->found()) { ``` This seemed like an obvious thing to me, so I suspect there might be a reason this doesn't exist already, but I couldn't find any previous discussion. If it'll be accepted then I'll glady create a docs PR Commits ------- 24dcb52 Add a method to check if any results were found
- Loading branch information