Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return value of wrapAll() when count() is 0 #44

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

jakejackson1
Copy link
Member

@jakejackson1 jakejackson1 commented Dec 11, 2022

When $this->matches->count() is 0 in QueryMutators::wrapAll() it returns void, but the method is type hinted to return DOMQuery (the current object).

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

If matches is empty and you call ->wrapAll() it will return null.

What is the new behavior?

If matches is empty and you call ->wrapAll() it will return the DOMQuery object, as per the docblock return type.

Does this introduce a breaking change?

  • Yes
  • No

Included in major release.

@codecov
Copy link

codecov bot commented Dec 11, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.45%. Comparing base (86f1c77) to head (a7bebcb).
Report is 6 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #44      +/-   ##
============================================
+ Coverage     88.41%   89.45%   +1.04%     
  Complexity     1349     1349              
============================================
  Files            26       26              
  Lines          3124     3036      -88     
============================================
- Hits           2762     2716      -46     
+ Misses          362      320      -42     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jakejackson1 jakejackson1 force-pushed the wrap-all-return-no-matches branch from c6699f9 to a7bebcb Compare August 12, 2024 00:03
@jakejackson1 jakejackson1 marked this pull request as ready for review August 12, 2024 00:05
@jakejackson1 jakejackson1 merged commit 4a7ca5d into main Aug 12, 2024
12 checks passed
@jakejackson1 jakejackson1 deleted the wrap-all-return-no-matches branch August 12, 2024 00:05
@github-actions github-actions bot locked and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant