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
Feature/attributes #19
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks mostly good, I noticed a couple functions that should be renamed.
Can you rebase your code as well?
FYI, I have created a branch named sf4 for the older code.
* @return object|null object of same class as $attributeClass or null if no attribute is found | ||
* @throws ReflectionException | ||
*/ | ||
public function getAnnotation(string $class, string $attributeClass): ?object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename that to getAttribute
?
* @return object|null object of same class as $attributeClass or null if no attribute is found | ||
* @throws ReflectionException if the field does not exist | ||
*/ | ||
public function getPropertyAnnotation(ClassMetadata $classMetadata, string $field, string $attributeClass): ?object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename to getPropertyAttribute
?
class AttributeGetter | ||
{ | ||
/** | ||
* Get a class-level annotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Get a class-level annotation | |
* Get a class-level attribute |
These changes will require a new major version.
I've implemented this bundle to support attributes instead of annotations. Since this bundle seems to be feature-complete anyway, I do not think it would make much sense to have additional complexity to support both (annotations and attributes) at the same time. <PHP8 users or users who want annotations can just use an older version.
I've based this PR on my other PR #18 which should be merged first.