mode = $mode; } /** * Creates an instance from an array. * * @param array{ * mode?: 'auto'|'required'|'none'|null * } $data * @phpstan-param array $data * @return self */ public static function fromArray(array $data): self { /** @var 'auto'|'required'|'none'|null $mode */ $mode = isset($data['mode']) ? self::asStringOrNull($data['mode']) : null; return new self( $mode ); } /** * Converts the instance to an array. * * @return array */ public function toArray(): array { $result = []; if ($this->mode !== null) { $result['mode'] = $this->mode; } return $result; } /** * @return 'auto'|'required'|'none'|null */ public function getMode(): ?string { return $this->mode; } }