annotations
annotations copied to clipboard
Add Constants Support
Continuation of https://github.com/doctrine/annotations/pull/226. Original commits (excl. merges) cherry-picked onto 1.7 branch.
This pull request adds complete support for constant annotations. It should be the same as property annotations support.
All tests passing.
Example:
class SomeClass {
/**
* @SomeAnnotation
*/
const SOME_CONSTANT = "foo";
}
$classRefl = new ClassReflection(SomeClass::class);
$constantRefl = $classRefl->getReflectionConstant('SOME_CONSTANT');
$annotations = $annotationReader->getConstantAnnotations($constantRefl);
// $annotations == [ new SomeAnnotation() ]
I think something needs to be done about the commits. Please fixup commits that fix errors into commits that introduce them, and provide messages in english all the time.
Ok, this should do the trick. I've also updated the pull request for 2.0 version (#264).
I think new features for 1.x are out of question at this point when refactoring for 2.0 is already ongoing.
@Majkl578 Well, I've created two pull requests for both versions. So it can go to 1.7 and refactoring of this feature to 2.0 is already done.
The only differences are in Target enum instead of few constants and in removed readers. Moreover, I did not notice any changes in getMethodAnnotations() and getMethodAnnotation() methods, so I guess the refactoring didn't got too far to cause any troubles here.
I think new features for 1.x are out of question at this point when refactoring for 2.0 is already ongoing.
Disagree: with how unclear the timeline for 2.0 is, it makes sense adding this to 1.x as well. I see no problem with releasing a final 1.x release at the same time as 2.0 is released, similar to how Symfony releases a minor release for the previous major along with a new major version.
I've rebased the MR to the current master (v1.10.x). It seems to work fine as before :)
@jkufner can you please fix the new conflicts?
@greg0ire I've rebased it to the 1.12.x branch. I hope it still works, it's been a long time.
I hope it still works, it's been a long time.
I'm afraid I have bad news for you :grimacing:
Closing because we won't add new features to this library.