0

Suppose I have the following class:

namespace Acme\SuperBundle\Resources;
use \DOMDocument;
/**
* Class XMLAnswerParser
* @package Acme\SuperBundle\Resources
* @author Quant
* @param \DOMDocument $dom
*/
class XMLAnswerParser
{

public $dom;
private $profile;

// a whole lot of things

protected function checkDOM()
{
    $this->dom-> 

And I'd expect any IDE to give me hinting knowing that the $dom property is a DOMDocument. Somehow this is not working in my IDE phpstorm. Am I doing something wrong with the documentation of the class?

The code contains no errors, in case you'd ask that.

Quant
  • 350
  • 3
  • 14
  • 1
    You don't have any `@var` docblock entry for the dom property... you have an `@param` stuck in the class-level docblock – Mark Baker May 15 '13 at 17:45
  • Aha. So, I should put it above the `public $dom` line? – Quant May 15 '13 at 17:47
  • 1
    You should have an `@var` entry in a docblock for each individual property; and `@param` should appear in method docblocks, not in class docblocks – Mark Baker May 15 '13 at 17:49

3 Answers3

4
<?php
/**
* @var DOMDocument $dom
*/
public $dom
?>

Was the way to do it!

Quant
  • 350
  • 3
  • 14
1

Add

namespace Acme\SuperBundle\Resources;
use \DOMDocument;
/**
 * Class XMLAnswerParser
 * @package Acme\SuperBundle\Resources
 * @author Quant
 */
class XMLAnswerParser
{

/**
 * @var \DOMDocument $dom
 */
public $dom;

private $profile;

// a whole lot of things

protected function checkDOM()
{
    $this->dom-> 

Then the IDE will know what $dom exatctly is.

Milad Rahimi
  • 3,464
  • 3
  • 27
  • 39
0

@param \DOMDocument $dom --> @property \DOMDocument $dom

hovszabolcs
  • 101
  • 1
  • 2