Building an AOP Framework for PHP – Instantiating Annotation Objects

Our previous post covered the task of reading annotations from DocBlocks. It described how to get the name and the parameters (also called attributes) for an annotation defined like this:

We finished the last post by taking a look at the AnnotationParser where we filled the variables $annotationName and $parameters with some data. That’s all we have to know about the annotation. So what’s next?

Our extended reflection API will keep all the information about the annotations. Thus, the answer is obvious: For each annotation, there is an object to be created which will encapsulate all data read out from the annotation definition.