type = self::TYPE; } /** * Creates an instance from an array. * * @param array{ * name: string, * title?: string|null, * type: 'ref/prompt' * } $data * @phpstan-param array $data * @return self */ public static function fromArray(array $data): self { self::assertRequired($data, ['name']); return new self( self::asString($data['name']), self::asStringOrNull($data['title'] ?? null) ); } /** * Converts the instance to an array. * * @return array */ public function toArray(): array { $result = parent::toArray(); $result['type'] = $this->type; return $result; } /** * @return 'ref/prompt' */ public function getType(): string { return $this->type; } }