Skip to content

Refactor: move filter / map logic into IterableObject #26

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

Merged
merged 1 commit into from
Feb 11, 2021

Conversation

bpolaszek
Copy link
Owner

@bpolaszek bpolaszek commented Feb 5, 2021

Depends on #25.

As discussed in #24, map and filter logics have been moved to the IterableObject class, introducing a new MappedTraversable internal class to handle maps on traversable objects.

It also fixes a bug where a filter would be applied before mapping (current test is biased), despite the opposite intention (map first, then filter).

IterableObject unit test has been improved to test all possible combinations (null / array / Traversable input, no filter / default filter / callable filter, no mapper / callable mapper).

@simPod if you've got a few minutes for reviewing 🙂

@bpolaszek bpolaszek self-assigned this Feb 5, 2021
@codecov
Copy link

codecov bot commented Feb 5, 2021

Codecov Report

Merging #26 (42fc535) into 2.0.x-dev (4c46851) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           2.0.x-dev       #26   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
===========================================
  Files              2         3    +1     
  Lines             48        39    -9     
===========================================
- Hits              48        39    -9     
Impacted Files Coverage Δ
src/IterableObject.php 100.00% <100.00%> (ø)
src/MappedTraversable.php 100.00% <100.00%> (ø)
src/iterable-functions.php 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c46851...42fc535. Read the comment docs.

@bpolaszek bpolaszek force-pushed the refactor/move-functions-logic branch from 6b8fb79 to 4e8349a Compare February 5, 2021 10:31
@bpolaszek bpolaszek mentioned this pull request Feb 11, 2021
Base automatically changed from feature/null-filter to 2.0.x-dev February 11, 2021 08:05
@bpolaszek bpolaszek force-pushed the refactor/move-functions-logic branch from 4e8349a to 42fc535 Compare February 11, 2021 08:07
@bpolaszek bpolaszek merged commit 3a125c1 into 2.0.x-dev Feb 11, 2021
@bpolaszek bpolaszek deleted the refactor/move-functions-logic branch February 11, 2021 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant