DoctrineExtensions icon indicating copy to clipboard operation
DoctrineExtensions copied to clipboard

Mark Cache dependencies as optional

Open Slamdunk opened this issue 3 years ago • 3 comments

None of the actual Cache usages are required, as they are checked by runtime if exist:

  1. https://github.com/doctrine-extensions/DoctrineExtensions/blob/2def628a9a8304c1e7f56847a0b21778a3a9ed61/src/DoctrineExtensions.php#L119-L123
  2. https://github.com/doctrine-extensions/DoctrineExtensions/blob/2def628a9a8304c1e7f56847a0b21778a3a9ed61/src/Tree/Strategy/ORM/Closure.php#L197-L200

Marking those as optional allow to get rid of unused (an thus unwanted) dependencies.

Slamdunk avatar Feb 24 '22 08:02 Slamdunk

Codecov Report

Merging #2425 (d1d8f93) into main (2def628) will decrease coverage by 0.13%. The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #2425      +/-   ##
============================================
- Coverage     80.10%   79.97%   -0.14%     
+ Complexity     3161     3128      -33     
============================================
  Files           159      158       -1     
  Lines          8198     7670     -528     
============================================
- Hits           6567     6134     -433     
+ Misses         1631     1536      -95     
Impacted Files Coverage Δ
...ble/Document/MappedSuperclass/AbstractLogEntry.php 80.00% <0.00%> (-3.79%) :arrow_down:
src/Timestampable/Mapping/Driver/Yaml.php 75.00% <0.00%> (-3.58%) :arrow_down:
...gable/Entity/MappedSuperclass/AbstractLogEntry.php 86.66% <0.00%> (-2.53%) :arrow_down:
src/SoftDeleteable/Mapping/Validator.php 83.33% <0.00%> (-2.39%) :arrow_down:
src/Timestampable/Mapping/Driver/Xml.php 84.00% <0.00%> (-2.21%) :arrow_down:
.../Sluggable/Handler/InversedRelativeSlugHandler.php 85.71% <0.00%> (-2.05%) :arrow_down:
...ment/MongoDB/Repository/AbstractTreeRepository.php 68.96% <0.00%> (-2.01%) :arrow_down:
src/IpTraceable/Mapping/Driver/Annotation.php 75.00% <0.00%> (-1.93%) :arrow_down:
src/Mapping/Driver/AttributeAnnotationReader.php 48.14% <0.00%> (-1.86%) :arrow_down:
src/Translator/Translation.php 88.23% <0.00%> (-1.77%) :arrow_down:
... and 107 more

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 2def628...d1d8f93. Read the comment docs.

codecov-commenter avatar Feb 24 '22 08:02 codecov-commenter

There is another usage (it was defined as required because of this):

https://github.com/doctrine-extensions/DoctrineExtensions/blob/ddc468bcf40045a5b1606f62296b75c7c2a6a42c/src/Mapping/MappedEventSubscriber.php#L283-L301

franmomu avatar Mar 01 '22 07:03 franmomu

You're right: we still can mark symfony/cache as optional, and throw an Exception if both are absent. I'll update the PR as soon as possible

Slamdunk avatar Mar 01 '22 08:03 Slamdunk

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 13 '23 16:01 github-actions[bot]

Huh, I completely forgot to update this PR :open_mouth:

Slamdunk avatar Jan 15 '23 09:01 Slamdunk

@franmomu rebased and updated as requested

Slamdunk avatar Jan 18 '23 08:01 Slamdunk

Also ping @phansys as I've just seen this comment: https://github.com/doctrine-extensions/DoctrineExtensions/pull/2564#issuecomment-1370155413

Slamdunk avatar Jan 18 '23 14:01 Slamdunk

I guess we can merge this PR before the new release, as it is not narrowing an existing dependency or adding new ones. :+1:

phansys avatar Jan 18 '23 16:01 phansys