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

Switch from arrays to DTO classes when passing event information around #94

Merged
merged 9 commits into from
Mar 28, 2022

Conversation

janklan
Copy link
Contributor

@janklan janklan commented Mar 26, 2022

Followup to #91 (comment), here is the PR that uses DTO classes instead of arrays in order to improve code robustness.

I added a dedicated method to each event type. It expands the Transaction API surface a bit, but it also enables static code analysers to do their thing. Comparing to passing an array with vague structure that's later magically converted to something useful, I think the surface expansion is an acceptable cost to pay.

Copy link
Owner

@DamienHarper DamienHarper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janklan Thanks for this nice contribution!

@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2022

Codecov Report

Merging #94 (fecce86) into master (33dd159) will decrease coverage by 1.28%.
The diff coverage is 83.82%.

❗ Current head fecce86 differs from pull request most recent head 9d30182. Consider uploading reports for the commit 9d30182 to get more accurate results

@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
- Coverage   95.75%   94.47%   -1.29%     
==========================================
  Files          35       40       +5     
  Lines        1390     1429      +39     
==========================================
+ Hits         1331     1350      +19     
- Misses         59       79      +20     
Impacted Files Coverage Δ
...trine/Auditing/Transaction/TransactionHydrator.php 82.69% <61.53%> (-3.59%) ⬇️
src/Model/Transaction.php 63.26% <62.50%> (-36.74%) ⬇️
src/Event/Dto/AbstractAssociationEventDto.php 100.00% <100.00%> (ø)
src/Event/Dto/AbstractEventDto.php 100.00% <100.00%> (ø)
src/Event/Dto/InsertEventDto.php 100.00% <100.00%> (ø)
src/Event/Dto/RemoveEventDto.php 100.00% <100.00%> (ø)
src/Event/Dto/UpdateEventDto.php 100.00% <100.00%> (ø)
...rine/Auditing/Transaction/TransactionProcessor.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 33dd159...9d30182. Read the comment docs.

@janklan
Copy link
Contributor Author

janklan commented Mar 28, 2022

I'm not sure why would the CI fail with exit code 8... :/

@DamienHarper DamienHarper merged commit 2262349 into DamienHarper:master Mar 28, 2022
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.

None yet

3 participants