简体   繁体   English

PhpStorm中的代码提示方法属性

[英]Code hinting method properties in PhpStorm

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. 而且,我希望任何IDE都会给我暗示,知道$ dom属性是DOMDocument。 Somehow this is not working in my IDE phpstorm. 不知何故,这在我的IDE phpstorm中不起作用。 Am I doing something wrong with the documentation of the class? 我在课堂文档上做错什么了吗?

The code contains no errors, in case you'd ask that. 该代码中没有错误,以防万一。

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

Was the way to do it! 是这样做的方式!

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. 然后,IDE将知道$ dom是什么。

@param \\ DOMDocument $ dom-> @属性\\ DOMDocument $ dom

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM