0

We are using comments like this in eclipse (zend studio):

/**
 * @return array<ObjectXY>
 */
public function moo() {
  // returns array of objectxy
}

Now if I want to use method moo, I write:

$myobj->moo();

And then, if I hover with mouse above moo I get the following output in the comment box:

@return array

Where is the "ObjectXY" after array? Why is it missing? Can I configure this in eclipse (zend studio)?

Thank you.

EDIT: I see in stackoverflow strings within angle brackets do not be shown as well.

kemal89
  • 931
  • 2
  • 8
  • 20

1 Answers1

0

Those comments (Javadoc style) can contain HTML content. So angle bracketed words are used for marking up the comment.

If you woul like the output itself to contain these brackets, use the @code notation:

/**
 * @return {@code array<ObjectXY>}
 */

This is naturally used for really displaying code snippets (and your example is one). The comment's return tag is usually for providing textual information, such as

/**
 * @return an {@code array<ObjectXY>} containing ...
 */

UPDATE as my first approach was slightly wrong.

As you are using the Zend Studio IDE for developping PHP applications, this style of comments is not called Javadoc, but PHPDoc.

The statement that angle bracketed words are used for marking up, is still correct. But the solution seems to be wrong. In Javadoc, the @code notation is a relatively new one. Before it was <code>...</code>. Unfortunately this alone will not show the bracketed word. It must go along with <pre>...</pre> (or you should maybe use pre alone). Maybe this works:

/**
 * @return an <code><pre>array<ObjectXY></pre></code> containing ...
 */
Seelenvirtuose
  • 20,273
  • 6
  • 37
  • 66
  • Hello! You must be wrong.. Even if I copy your comment snippet into my comment eclipse shows me just "array"... – kemal89 Apr 30 '14 at 11:32
  • Hmmm ... Maybe there is a difference in the used editor. I spoke from a Java point of view (as I used Eclipse for Java development). So I thought, it will be the same for other editors in Eclipse also. If it does not, then I fear, I cannot help you. Sorry. – Seelenvirtuose Apr 30 '14 at 11:35
  • Ah! I learnt that this is called PHPDoc. I will update my answer – Seelenvirtuose Apr 30 '14 at 11:39
  • Hehe, I will tell my boss that we should rewrite the whole webapp in java :-) – kemal89 May 02 '14 at 09:26