DamienHarper / auditor

auditor, the missing audit log library
MIT License
164 stars 53 forks source link

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

Closed janklan closed 2 years ago

janklan commented 2 years ago

Followup to https://github.com/DamienHarper/auditor/issues/91#issuecomment-1064327898, 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.

codecov-commenter commented 2 years ago

Codecov Report

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

:exclamation: 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%) :arrow_down:
src/Model/Transaction.php 63.26% <62.50%> (-36.74%) :arrow_down:
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 commented 2 years ago

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