|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace hg\apidoc\annotation; |
| 4 | + |
| 5 | +use Attribute; |
| 6 | + |
| 7 | +/** |
| 8 | + * 类的属性 |
| 9 | + * @Annotation |
| 10 | + * @Target({"METHOD","ANNOTATION","PROPERTY"}) |
| 11 | + */ |
| 12 | +#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE | Attribute::TARGET_PROPERTY)] |
| 13 | +class Property extends ParamBase |
| 14 | +{ |
| 15 | + |
| 16 | + /** |
| 17 | + * mock |
| 18 | + * @var string |
| 19 | + */ |
| 20 | + public $mock; |
| 21 | + |
| 22 | + /** |
| 23 | + * @param string $name 字段名 |
| 24 | + * @param string $type 字段类型 |
| 25 | + * @param bool $require 是否必须 |
| 26 | + * @param string|int|bool $default 默认值 |
| 27 | + * @param string|array $ref 引用注解/模型 |
| 28 | + * @param string $table 引用数据表 |
| 29 | + * @param string|array $field 指定Ref引入的字段 |
| 30 | + * @param string|array $withoutField 排除Ref引入的字段 |
| 31 | + * @param string $desc 字段名称 |
| 32 | + * @param string $md Md文本内容 |
| 33 | + * @param string $mock Mock规则 |
| 34 | + * @param array $children 子参数 |
| 35 | + * @param string $childrenField 为tree类型时指定children字段 |
| 36 | + * @param string $childrenDesc 为tree类型时指定children字段说明 |
| 37 | + * @param string $childrenType 为array类型时指定子节点类型 |
| 38 | + */ |
| 39 | + public function __construct( |
| 40 | + $name = '', |
| 41 | + string $type = '', |
| 42 | + bool $require = false, |
| 43 | + $default = "", |
| 44 | + $ref = "", |
| 45 | + $table = "", |
| 46 | + $field = "", |
| 47 | + $withoutField = "", |
| 48 | + string $desc = '', |
| 49 | + string $md = "", |
| 50 | + string $mock = "", |
| 51 | + array $children = [], |
| 52 | + string $childrenField = "", |
| 53 | + string $childrenDesc = "children", |
| 54 | + string $childrenType = "", |
| 55 | + ...$attrs |
| 56 | + ) |
| 57 | + { |
| 58 | + parent::__construct(...func_get_args()); |
| 59 | + } |
| 60 | + |
| 61 | + |
| 62 | +} |
0 commit comments