Netbeans PHPDoc 局部变量不起作用
Netbeans PHPDoc local variable not working
我正在尝试更频繁地记录我的代码,现在我正在编写 class 并希望它得到完整的记录。但是,由于某些奇怪的原因,局部变量文档(当然还有 PHPDoc)不起作用..
我知道了:
/**
* A function for question
* @param string $theVar The var to put in local var $aVar.
*/
public function theFunction($theVar) {
/** @var string This is new local var, should have documentation but hasn't... */
$aVar = $theVar;
}
因此,当我键入 'the' 并按 space 并转到我在 Netbeans 中的函数时,它会显示函数文档。
但是,当我在函数中键入 'aVa' 并按 space 并转到我的变量时,它显示 'PHPDoc not found'.
我知道在这种情况下这不是问题,但在包含大量代码的大型函数中它实际上可能很有用。但是,由于某种原因它不起作用,我不知道为什么。
我认为您不能像那样记录内部变量。您可以记录 class
变量声明和函数参数,但 the documentation 没有说明局部函数变量
You may use the @var tag to document the “Type” of properties, sometimes called class variables.
Examples
class Foo
{
/** @var string|null Should contain a description */
protected $description = null;
}
Even compound statements may be documented:
class Foo
{
/**
* @var string $name Should contain a description
* @var string $description Should contain a description
*/
protected $name, $description;
}
这应该在局部变量中起作用。只是了解 PHPDoc,但我在 PHPStorm 中使用它,只要您没有在文档中明确包含局部变量名称,它就可以工作。
将此粘贴到您的 IDE:
<?php
/** @var int This documentation is for $aVar. */
$aVar = 5;
/** @var int This documentation is for $bVar. */
$bVar = 10;
if ($bVar !== $aVar) {
echo "False";
}
这是针对 Netbeans 的不同调整。您必须删除一个 *
.
/* @var int This documentation is for $bVar. */
$bVar = 10;
在Netbeans 8.2版本中,你有一个模板:vdoc可以快速完成:
/* @var $$${VARIABLE variableFromNextAssignmentName default="variable"} ${VAR_TYPE variableFromNextAssignmentType default="ClassName"} */
我正在尝试更频繁地记录我的代码,现在我正在编写 class 并希望它得到完整的记录。但是,由于某些奇怪的原因,局部变量文档(当然还有 PHPDoc)不起作用..
我知道了:
/**
* A function for question
* @param string $theVar The var to put in local var $aVar.
*/
public function theFunction($theVar) {
/** @var string This is new local var, should have documentation but hasn't... */
$aVar = $theVar;
}
因此,当我键入 'the' 并按 space 并转到我在 Netbeans 中的函数时,它会显示函数文档。
但是,当我在函数中键入 'aVa' 并按 space 并转到我的变量时,它显示 'PHPDoc not found'.
我知道在这种情况下这不是问题,但在包含大量代码的大型函数中它实际上可能很有用。但是,由于某种原因它不起作用,我不知道为什么。
我认为您不能像那样记录内部变量。您可以记录 class
变量声明和函数参数,但 the documentation 没有说明局部函数变量
You may use the @var tag to document the “Type” of properties, sometimes called class variables. Examples
class Foo
{
/** @var string|null Should contain a description */
protected $description = null;
}
Even compound statements may be documented:
class Foo
{
/**
* @var string $name Should contain a description
* @var string $description Should contain a description
*/
protected $name, $description;
}
这应该在局部变量中起作用。只是了解 PHPDoc,但我在 PHPStorm 中使用它,只要您没有在文档中明确包含局部变量名称,它就可以工作。
将此粘贴到您的 IDE:
<?php
/** @var int This documentation is for $aVar. */
$aVar = 5;
/** @var int This documentation is for $bVar. */
$bVar = 10;
if ($bVar !== $aVar) {
echo "False";
}
这是针对 Netbeans 的不同调整。您必须删除一个 *
.
/* @var int This documentation is for $bVar. */
$bVar = 10;
在Netbeans 8.2版本中,你有一个模板:vdoc可以快速完成:
/* @var $$${VARIABLE variableFromNextAssignmentName default="variable"} ${VAR_TYPE variableFromNextAssignmentType default="ClassName"} */