An Oracle blog about NetBeans for PHP

Brand New Annotations Support

Hi all! Today we would like to introduce you our brand new annotation support for NetBeans 7.2.

The first thing which is different is the look of annotations in code completion. As you can see, there is a new annotation icon and an annotation type. Because we have a lot of modules with their own annotations, we differ them in code completion window by their type. We support annotations for:

  • ApiGen (legacy PHPDoc annotations),
  • PHPUnit,
  • Doctrine 2 (ORM and ODM) and
  • Symfony 2.
Every annotation can be associated with some context. We recognize four of them:
  • function,
  • class/interface (type),
  • method and
  • field.

It means that you will get just proper annotations for your class field as well as your global function.

Brand New Annotations Support

Do you have your own annotations? Or do you simply miss some? There is nothing hard to add it in there. We have a simple UI for adding your custom annotations! It's in Tools -> Options -> PHP -> Annotations. Here you can simply add, edit or delete your annotations.

Brand New Annotations Support

When you try to create new one, all fields are prefilled by some default values. So you really don't have to remember "how to use that crazy freemarker syntax".

Brand New Annotations Support

If you are satisfied with your new annotation, you can see it in a code completion window among other annotations. As you can see it has its own "Custom" type.

Brand New Annotations Support

That's all for today and as usual, please test it and if you find something strange, don't hesitate to file a new issue (component php, subcomponent Editor). Thanks.

Join the discussion

Comments ( 8 )
  • CJ Thursday, March 29, 2012

    I'm looking forward to 7.2

    I expect you are tracking the DocBlox & phpDocumentor 2 merge? http://www.docblox-project.org/2012/03/docblox-is-unmasked-it-is-really-phpdocumentor-2/

  • Koc Thursday, March 29, 2012


  • Marco Thursday, March 29, 2012

    A much needed feature, nice work!

  • Ondrej Brejla Friday, March 30, 2012

    Thanks for your response!

    CJ: Yes we know about that...but now we prefer ApiGen (http://apigen.org/) over other PHPDocs generators. We think that it's the best PHP API generator in these days.

  • Gregor Friday, March 30, 2012

    Awesome! That is so useful. Can't wait for 7.2

  • pivasyk Friday, March 30, 2012

    Thank you, very useful!

  • bullito Friday, April 13, 2012

    Many thanks,

    i planned to hack PHPUnit and Doctrine2 ORM/ODM annotations management for colorizing comments in netbeans... but 7.2 has done the job for me !!!

  • Radek Monday, April 23, 2012

    That looks great. I am looking forward to netbeans-7.2.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.