Parse the version from a string like "8.1".
public static function fromString(string $version) : self { if (!preg_match('/^(\\d+)\\.(\\d+)/', $version, $matches)) { throw new \LogicException("Invalid PHP version \"{$version}\""); } return self::fromComponents((int) $matches[1], (int) $matches[2]); }