Hint: Implement all abstract methods

Today I would like to introduce new hint that was implemented already a few weeks ago but probably hardly anyone knows about it. This hint can be useful in case when you need to implement abstract methods in a class that extends another class.
As long as you have not implemented all methods, a light bulb will appear next to the class  declaration.Clicking the light bulb displays a hint how to fix the class. In our example  the hint would suggest to "Implement all abstract methods."  

If you click it, or press Alt-Return then skeletons of all necessary abstract methods will be generated for you.


Great feature. It would be very handy. However, it should be enhanced. I think that it will be nice if Netbeans has a symbol or indicator to give a clue if a given method is inherited from abstract one (or an interface method) or not (Just like @override in Java but PHP does not support it)


Posted by pcdinh on January 12, 2009 at 10:48 AM CET #

Thanks for feedback. Definitely, to annotate inherited methods similar like in java as you mentioned is one of the features on our list

Posted by radek on January 12, 2009 at 10:57 AM CET #

Hi, Radek. Nice! One picky note: shouldn't it be "Implement all abstract methods", not "Implements all abstract methods" - e.g. "Implement" not "Implements"?

Posted by David Van Couvering on January 12, 2009 at 04:19 PM CET #

The more eyes we have, the more bugs we see :)

You are right David, I've noticed it also just when I first looked at this published blog entry, will be fixed, thanks

Posted by radek on January 13, 2009 at 01:14 AM CET #

Tested. No bugs found.
Note: order of generated functions seems to be random. Maybe some definite order should be used.

Posted by Mikhail Matveev on January 13, 2009 at 12:09 PM CET #

Hi, nice feature. I noticed few days ago, but it is stil not working propely.

interface Test {
public function Pokus($var = TRUE);

public function Pokus($var)

public function Pokus($var = TRUE)

Fatal error: Declaration of Moje::Pokus() must be compatible with that of Test::Pokus()

Posted by Michal Kocian on January 13, 2009 at 04:25 PM CET #

thanks, I reported it: http://www.netbeans.org/issues/show_bug.cgi?id=156749

Posted by radek on January 14, 2009 at 03:35 AM CET #

The IDE is great, but I'm having problems using the PHP features don't know why. I've just fresh installed a full version of the 6.5 IDE including php support. But I just cannot see any of those features. I just tried creating a file with 2 classes like the one on the post for testing purposes, to see this hint, but it won't show. Also I can't use any refactor menu item on PHP and a friend of mine has a feature called Generate Getter/Setter in his portuguese brazilian version of the IDE, under the Source/InsertCode menu, but for me it do not show. I've also started a new topic in the forums with a screenshot. I anyone could help me on this I'd really appreciate. Thanks and congratulations for the IDE.


Posted by Juliano Polito on February 14, 2009 at 06:38 AM CET #

Hi Juliano,

Hint: Implement all abstract methods and other features were added after 6.5 and thus you cannot find them in 6.5 release. You can find them in 6.7 builds (either development builds or milestone builds). Download links:

Posted by radek on March 09, 2009 at 01:11 PM CET #

I can only force the IDE to implement abstract methods if the abstract class or interface is declared in the same file as the inheriting/implementing class. If the declaration is in other file, the lightbulb does not appear, although the IDE recognizes the abstract class/interface

NetBeans IDE 6.7 Beta (Build 200904242137)

Posted by Wojtek on June 20, 2009 at 06:45 AM CEST #

UPDATE: with RC3 the above does not apply to abstract classes. It however still does not work with interfaces.


Posted by Wojtek on June 21, 2009 at 05:04 AM CEST #

All the above method is very workable and useful.

Posted by Fosia on August 13, 2009 at 07:27 AM CEST #

Thank you by admin

Posted by mirc on August 22, 2009 at 09:29 PM CEST #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by links of london on October 29, 2009 at 08:10 PM CET #

All the above method is very workable and useful.

Posted by Funs blog on November 13, 2009 at 10:50 PM CET #

In 7.1.1 I can only get a class to implement interface methods if it is not abstract.

Posted by guest on April 28, 2012 at 09:59 PM CEST #

Using Netbeans 7.4, this feature is really useful:
Menu -> source -> insert code, Choose "override & implement" method

However, is it also possible to display information this as a separate window? When developing and maintaining a large set of PHP code, I need to see what methods have been inherited from the extended class.

Thanks. Keep up the good work :-)

Posted by Nick on February 13, 2014 at 10:57 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed

This blogs is written by NetBeans developers who contribute to the PHP support mainly.


« June 2016