How do I mark a method as \"returns an instance of the current class\" in my phpDoc?
In the following example my IDE (Netbeans) will see that setSomething always returns
phpDoc syntax allows for multiple types to be defined by separating them with a | character for the @return tag. When you extend the class foo
with class bar
you should write a new phpDoc tag that has the proper class for its @return
.
If a function returns either foo
or bar
then you would use @return foo|bar
.
However in your case just define @return bar
for the overridden function.
Take care.