major = $major; $this->minor = $minor; } public function getMajor(): ?int { return $this->major; } public function getMinor(): ?int { return $this->minor; } public static function createFromArray(array $data): self { $data = Utils::filterNullValues($data); foreach (['major', 'minor'] as $key) { if (array_key_exists($key, $data)) { Assertion::integer($data[$key], sprintf('Invalid value for key "%s"', $key)); } } return new self( $data['major'] ?? null, $data['minor'] ?? null ); } public function jsonSerialize(): array { $data = [ 'major' => $this->major, 'minor' => $this->minor, ]; return Utils::filterNullValues($data); } }