return null;
}
PhpDocTag[] targetTag = phpDocComment.getTagElementsByName("@Target");
if(targetTag.length == 0) {
return new PhpAnnotation(phpClass, AnnotationTarget.UNDEFINED);
}
ArrayList<AnnotationTarget> targets = new ArrayList<AnnotationTarget>();
// @Target("PROPERTY", "METHOD")
// @Target("CLASS")
// @Target("ALL")
Pattern targetPattern = Pattern.compile("\"(\\w+)\"");
// @TODO: remove on stable api
// getTagValue is empty on eap; fallback to text
String tagValue = targetTag[0].getTagValue();
if(tagValue.length() == 0) {
tagValue = targetTag[0].getText();
}
Matcher matcher = targetPattern.matcher(tagValue);
while (matcher.find()) {
try {
targets.add(AnnotationTarget.valueOf(matcher.group(1).toUpperCase()));
} catch (IllegalArgumentException e) {
targets.add(AnnotationTarget.UNKNOWN);
}
}
return new PhpAnnotation(phpClass, targets);
}