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

[WIP] Deprecate annotations support #2772

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mbabker
Copy link
Contributor

@mbabker mbabker commented Feb 19, 2024

Now that the hard dependency is broken, the next major task to coincide with the doctrine/annotations library being deprecated would be deprecating annotations support in this package. WIP for now because this is going to be quite a big deprecation and architectural task since the attribute drivers are all subclasses of their annotation counterparts so some thought will be needed into how to address that (as folks in the Symfony ecosystem will eventually come here with reports about it, even with the drivers all being flagged internal).

Other things to think about along the way include:

  • In Symfony, the term "annotation" was deprecated in full and replaced with "attribute" in all relevant APIs, which included renaming and aliasing classes in "Annotation" namespaces and renaming methods (i.e. setAnnotationReader()), how in-depth does this deprecation need to go here?

Copy link

codecov bot commented Feb 19, 2024

Codecov Report

Attention: 90 lines in your changes are missing coverage. Please review.

Comparison is base (0632ab1) 78.75% compared to head (8a86f5e) 78.97%.
Report is 8 commits behind head on main.

Files Patch % Lines
src/Tree/Mapping/Driver/Attribute.php 76.00% 24 Missing ⚠️
src/Sluggable/Mapping/Driver/Attribute.php 79.66% 12 Missing ⚠️
src/Loggable/Mapping/Driver/Attribute.php 79.06% 9 Missing ⚠️
src/Mapping/ExtensionMetadataFactory.php 63.15% 7 Missing ⚠️
src/Translatable/Mapping/Driver/Attribute.php 83.72% 7 Missing ⚠️
src/Blameable/Mapping/Driver/Attribute.php 80.00% 6 Missing ⚠️
src/IpTraceable/Mapping/Driver/Attribute.php 77.77% 6 Missing ⚠️
src/Timestampable/Mapping/Driver/Attribute.php 81.48% 5 Missing ⚠️
src/Sortable/Mapping/Driver/Attribute.php 83.33% 4 Missing ⚠️
src/Mapping/Driver/AbstractAnnotationDriver.php 72.72% 3 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2772      +/-   ##
==========================================
+ Coverage   78.75%   78.97%   +0.22%     
==========================================
  Files         163      163              
  Lines        8593     8513      -80     
==========================================
- Hits         6767     6723      -44     
+ Misses       1826     1790      -36     

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

@franmomu
Copy link
Collaborator

I don't know if we can invert the inheritance and make the Annotation classes inherit from the Attribute ones

@mbabker
Copy link
Contributor Author

mbabker commented Feb 19, 2024

I don't know if we can invert the inheritance and make the Annotation classes inherit from the Attribute ones

We'd have to flip it for the AnnotationDriverInterface and AttributeDriverInterface as well. There are checks like this one targeting only the attribute drivers so those bits and bobs would need to be inverted as well to not break any other behaviors.

Conceivably it's possible, and the mapping drivers within this package are a lot more of an internal implementation than in the object managers themselves given the way ExtensionMetadataFactory::getDriver() works, so even though there are some potential B/C implications they aren't as impactful to downstream users as the changes that were made upstream.

@mbabker mbabker force-pushed the deprecate-annotations branch 2 times, most recently from b346152 to 6489401 Compare February 19, 2024 23:46
@mbabker
Copy link
Contributor Author

mbabker commented Feb 20, 2024

Reversing the inheritance chain actually worked out a lot more smoothly than I expected it to. The only possible hangup from an end-user perspective is if someone implemented a custom extension (as in fully added their own listener extending from MappedEventSubscriber and adding their own annotation/attribute mapping drivers), they would also have to flip their inheritance chains. I would suggest the likelihood of that is pretty low, though.

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

2 participants