What are the benefits vs costs of comment annotation in PHP?
- by Patrick
I have just started working with symfony2 and have run across comment annotations.
Although comment annotation is not an inherent part of PHP, symfony2 adds support for this feature.
My understanding of commenting is that it should make the code more intelligible to the human. The computer shouldn't care what is in comments.
What benefits come from doing this type of annotation versus just putting a command in the normal PHP code?
ie-
/**
* @Route("/{id}")
* @Method("GET")
* @ParamConverter("post", class="SensioBlogBundle:Post")
* @Template("SensioBlogBundle:Annot:post.html.twig", vars={"post"})
* @Cache(smaxage="15")
*/
public function showAction(Post $post)
{
}