You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
<?php |
|
|
|
namespace Plugins\ApiDoc\Admin\Attributes; |
|
|
|
use JetBrains\PhpStorm\ExpectedValues; |
|
|
|
/** |
|
* Query 参数 |
|
* |
|
* Class ApiQuery |
|
* |
|
* @author chenlong<vip_chenlong@163.com> |
|
* @date 2022/5/17 10:02 |
|
*/ |
|
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] |
|
class ApiQuery extends Params |
|
{ |
|
/** |
|
* @param string|array $name 参数名 |
|
* @param string $type 参数类型 |
|
* @param string $describe 参数描述 |
|
* @param bool $required 是否必填 |
|
* @param float $version 参数版本, 版本废弃用负数表示,例 2.0 版本废弃了 id参数:-2.0 |
|
*/ |
|
public function __construct(public string|array $name, |
|
#[ExpectedValues(["String", "Integer", "Float", 'Bool',])] |
|
public string $type = "Integer", |
|
public string $describe = '', |
|
public bool $required = false, |
|
public float $version = 1 |
|
) |
|
{ |
|
if (is_array($name)) { |
|
foreach ($name as $key => $info) { |
|
$this->{$key} = $info; |
|
} |
|
} |
|
} |
|
}
|
|
|