Something went wrong. Try again.
Parse and validate AT Protocol Lexicons with DTO generation for Laravel
Something went wrong. Try again.
985 B · 48 lines
PHP
at dev
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849<?php
namespace SocialDept\AtpSchema\Data\Types;
use SocialDept\AtpSchema\Data\TypeDefinition;
class UnknownType extends TypeDefinition{ /** * Create a new UnknownType. */ public function __construct(?string $description = null) { parent::__construct('unknown', $description); }
/** * Create from array data. */ public static function fromArray(array $data): self { return new self( description: $data['description'] ?? null ); }
/** * Convert to array. */ public function toArray(): array { $array = ['type' => $this->type];
if ($this->description !== null) { $array['description'] = $this->description; }
return $array; }
/** * Validate a value against this type definition. */ public function validate(mixed $value, string $path = ''): void { // Unknown type accepts any value }}