PHPdoc 不检测对象(和其他属性)
PHPdoc does not detect object (and other properties)
我正在尝试使用正确的信息为我的项目创建一个 PHP 文档。
我正在尝试为对象创建信息,在 class 的方法中创建。
遗憾的是,PHPdoc 无法在我的函数中识别我的对象。
代码如下:
class app_controll
{
/**
* This function starts the application. All the functionality starts here.
* @return Objects Method returns all the objects and functions needed to build a page.
*/
public function start_application()
{
/**
* The domain_controll object contains domain information.
* @var object domain_controll
*/
$oDomain_controll = new domain_controll();
}
}
我定义错了什么?
class app_controll
{
/**
* This function starts the application. All the functionality starts here.
* @return Objects Method returns all the objects and functions needed to build a page.
*/
public function start_application()
{
/**
* The domain_controll object contains domain information.
* @var $oDomain_controll domain_controll
*/
$oDomain_controll = new domain_controll();
}
}
用法是:@var objectName className
我也在Github上问过这个问题。我收到了 James Pittman 的回复:
In this case, $oDomain_controll would be an internal variable, visible
only within the start_application() function. There would be no reason
to include it in API documentation, because it's not usable or
viewable by a consumer of the app_controll class. If you want to make
it a public member of the app_controll class, you should declare it
outside of the start_application() function:
class app_controll()
{
/**
* The domain_controll object contains domain information.
* @var domain_controll
*/
public $oDomain_controll;
public function start_application()
{
$oDomain_controll = new domain_controll();
}
}
谢谢你的回答詹姆斯 :)
我正在尝试使用正确的信息为我的项目创建一个 PHP 文档。 我正在尝试为对象创建信息,在 class 的方法中创建。 遗憾的是,PHPdoc 无法在我的函数中识别我的对象。
代码如下:
class app_controll
{
/**
* This function starts the application. All the functionality starts here.
* @return Objects Method returns all the objects and functions needed to build a page.
*/
public function start_application()
{
/**
* The domain_controll object contains domain information.
* @var object domain_controll
*/
$oDomain_controll = new domain_controll();
}
}
我定义错了什么?
class app_controll
{
/**
* This function starts the application. All the functionality starts here.
* @return Objects Method returns all the objects and functions needed to build a page.
*/
public function start_application()
{
/**
* The domain_controll object contains domain information.
* @var $oDomain_controll domain_controll
*/
$oDomain_controll = new domain_controll();
}
}
用法是:@var objectName className
我也在Github上问过这个问题。我收到了 James Pittman 的回复:
In this case, $oDomain_controll would be an internal variable, visible only within the start_application() function. There would be no reason to include it in API documentation, because it's not usable or viewable by a consumer of the app_controll class. If you want to make it a public member of the app_controll class, you should declare it outside of the start_application() function:
class app_controll()
{
/**
* The domain_controll object contains domain information.
* @var domain_controll
*/
public $oDomain_controll;
public function start_application()
{
$oDomain_controll = new domain_controll();
}
}
谢谢你的回答詹姆斯 :)