Answer the question
In order to leave comments, you need to log in
Is it possible in PHP to get annotations for a specific property and vice versa?
Good afternoon,
You can pull it out of the class in this way:
function getClassAnnotations($class)
{
$r = new ReflectionClass($class);
$doc = $r->getDocComment();
preg_match_all('#@(.*?)\n#s', $doc, $annotations);
return $annotations[1];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question