| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | namespace Nexus\Mcp\Core\Schema; |
| 15: | |
| 16: | use Nexus\Assert\Assert; |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | final readonly class ProtocolVersion |
| 24: | { |
| 25: | public const string LATEST_VERSION = '2025-11-25'; |
| 26: | |
| 27: | |
| 28: | |
| 29: | |
| 30: | public const array PREVIOUS_VERSIONS = [ |
| 31: | '2025-06-18', |
| 32: | '2025-03-26', |
| 33: | '2024-11-05', |
| 34: | ]; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public string $version; |
| 40: | |
| 41: | public function __construct(string $version) |
| 42: | { |
| 43: | Assert::that($version) |
| 44: | ->isNonEmptyString('"protocolVersion" must be a non-empty string.') |
| 45: | ->matchesRegularExpression('/\A\d{4}-\d{2}-\d{2}\z/', '"protocolVersion" must be in the format "YYYY-MM-DD".') |
| 46: | ; |
| 47: | |
| 48: | $this->version = $version; |
| 49: | } |
| 50: | } |
| 51: | |