mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
improve api docs generator class discrimination
This commit is contained in:
parent
97face2406
commit
371926b5a6
12
bin/gendoc
12
bin/gendoc
@ -91,6 +91,8 @@ use Jasny\PhpdocParser\Set\PhpDocumentor;
|
||||
use Jasny\PhpdocParser\Tag\Summery;
|
||||
use ZM\Console\Console;
|
||||
|
||||
var_dump('hi');
|
||||
|
||||
$opts = getopt('', ['show-warnings']);
|
||||
if (array_key_exists('show-warnings', $opts)) {
|
||||
$show_warnings = true;
|
||||
@ -98,7 +100,7 @@ if (array_key_exists('show-warnings', $opts)) {
|
||||
$show_warnings = false;
|
||||
}
|
||||
|
||||
Console::init(2);
|
||||
Console::init(4);
|
||||
|
||||
$errors = [];
|
||||
$warnings = [];
|
||||
@ -296,12 +298,16 @@ foreach (new \RecursiveIteratorIterator($fs) as $file) {
|
||||
// 过滤不包含类的文件
|
||||
$tokens = token_get_all(file_get_contents($path));
|
||||
$found = false;
|
||||
foreach ($tokens as $token) {
|
||||
foreach ($tokens as $k => $token) {
|
||||
if (!is_array($token)) {
|
||||
continue;
|
||||
}
|
||||
if ($token[0] === T_CLASS) {
|
||||
if ($token[0] === T_CLASS && $tokens[$k - 2][0] !== T_NEW) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
if ($k >= 100) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user