* @date 2022/5/17 9:59 */ #[\Attribute(\Attribute::TARGET_METHOD|\Attribute::TARGET_CLASS)] class Api { public ?string $isAuthenticate = null; /** * @param bool $isAuthenticate 是否需要认证 */ public function __construct(#[ExpectedValues(['strength', 'weak', true, false])] bool|string $isAuthenticate = false) { if ($isAuthenticate === true) { $isAuthenticate = 'strength'; } if ($isAuthenticate === false) { $isAuthenticate = null; } $this->isAuthenticate = $isAuthenticate; } }