* @date 2022/5/17 10:02 */ #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class ApiReturn { /** * @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(['Array', 'Integer', 'Object', 'String', 'File', 'Float', 'Bool',])] public string $type = 'Integer', public string $describe = '', public bool $required = true, public float $version = 1 ) { if (is_array($name)) { foreach ($name as $key => $info) { $this->{$key} = $info; } } } }