Php 声明之外的类文档
是否可以在类声明之外记录方法、属性等Php 声明之外的类文档,php,netbeans,Php,Netbeans,是否可以在类声明之外记录方法、属性等 <?php // lib/classa.php class ClassA { public function __call($method, $args) { if ($method == 'testA') return $method; else if ($method == 'testB') return $method; } } 如果使用phpdoc,这是不可能的。你应该读一
<?php
// lib/classa.php
class ClassA {
public function __call($method, $args)
{
if ($method == 'testA')
return $method;
else if ($method == 'testB')
return $method;
}
}
如果使用phpdoc,这是不可能的。你应该读一下@方法
用于另一种方式:
/**
* @method string testA()
* @method string testB()
*/
class ClassA {
public function __call($method, $args)
{
if ($method == 'testA')
return $method;
else if ($method == 'testB')
return $method;
}
}
您有两个选项:扩展库类和文档自己的类,或者更好的选项:在库开发和文档库中贡献
/**
* @method string testA()
* @method string testB()
*/
class ClassA {
public function __call($method, $args)
{
if ($method == 'testA')
return $method;
else if ($method == 'testB')
return $method;
}
}