Generated Methods with Type Hints

Posted by Ondrej Brejla on Oracle Blogs See other posts from Oracle Blogs or by Ondrej Brejla
Published on Thu, 4 Oct 2012 10:50:30 +0000 Indexed on 2012/10/04 15:46 UTC
Read the original article Hit count: 258

Filed under:

Hi all! Today we would like to introduce you just another feature from upcoming NetBeans 7.3. It's about generating setters, constructors and type hints of their parameters.

For years, you can use Insert Code action to generate setters, getters, constructors and such. Nothing new. But from NetBeans 7.3 you can generate Fluent Setters! What does it mean? Simply that $this is returned from a generated setter. This is how it looks like:

Fluent Setters

Fluent Setters

But that's not everything :) As you know, before a method is generated, you have to choose a field, which will be associated with that method (in case of constructors, you choose fileds which should be initialized by that constructor). And from NetBeans 7.3, type hints are generated automatically for these parameters! But only if a proper PHPDoc is used in a corresponding field declaration, of course. Here is how it looks like.

Generated Type Hints

And 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 (product php, component Editor). Thanks a lot!

© Oracle Blogs or respective owner

Related posts about /Features