Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 声明之外的类文档_Php_Netbeans - Fatal编程技术网

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;
   }
}