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

Use constants for arbitrary annotation values #2675

Closed
wants to merge 2 commits into from

Conversation

phansys
Copy link
Collaborator

@phansys phansys commented Aug 20, 2023

To Do:

  • Add the remaining annotation constants.

@codecov
Copy link

codecov bot commented Aug 20, 2023

Codecov Report

Attention: Patch coverage is 73.52941% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 79.20%. Comparing base (7493440) to head (a86e342).
Report is 74 commits behind head on main.

❗ Current head a86e342 differs from pull request most recent head 7facd0b. Consider uploading reports for the commit 7facd0b to get more accurate results

Files Patch % Lines
src/Blameable/Mapping/Driver/Xml.php 0.00% 2 Missing ⚠️
src/Blameable/Mapping/Driver/Yaml.php 0.00% 2 Missing ⚠️
src/IpTraceable/Mapping/Driver/Xml.php 0.00% 2 Missing ⚠️
src/IpTraceable/Mapping/Driver/Yaml.php 0.00% 2 Missing ⚠️
src/Sluggable/Mapping/Driver/Xml.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2675      +/-   ##
==========================================
- Coverage   79.22%   79.20%   -0.02%     
==========================================
  Files         161      161              
  Lines        8412     8412              
==========================================
- Hits         6664     6663       -1     
- Misses       1748     1749       +1     

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

@phansys phansys force-pushed the annotation_values branch 3 times, most recently from a86e342 to fc4c9ec Compare August 20, 2023 15:58
namespace Gedmo\Mapping\Annotation;

/**
* @internal
Copy link
Contributor

Choose a reason for hiding this comment

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

If you expect projects to use those constants, I don't think it should be internal

/**
* @internal
*/
interface TrackingAwareAnnotationInterface extends Annotation
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of an interface extending Annotation, I would suggest putting those constants on an enum-like class (being final and forbidding instantiation thanks to a private constructor).
If the PHP requirements were allowing it, those events would be a good candidate for an actual enum, as it is a closed list.

public const STYLE_LOWER = 'lower';
public const STYLE_UPPER = 'upper';
public const STYLE_CAMEL = 'camel';
public const STYLE_ORIGINAL = 'default';
Copy link
Contributor

Choose a reason for hiding this comment

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

Those styles being a closed list also look like a good candidate for an enum class

Copy link

github-actions bot commented Mar 5, 2024

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 github-actions bot added Stale and removed Stale labels Mar 5, 2024
Copy link

github-actions bot commented Sep 1, 2024

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 github-actions bot added the Stale label Sep 1, 2024
@github-actions github-actions bot closed this Oct 1, 2024
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.

2 participants