What are the benefits vs costs of comment annotation in PHP?
Posted
by
Patrick
on Programmers
See other posts from Programmers
or by Patrick
Published on 2012-11-29T15:00:00Z
Indexed on
2012/11/29
17:17 UTC
Read the original article
Hit count: 249
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)
{
}
© Programmers or respective owner