getMessage(), 0, $e); } if (!isset($parts['scheme']) && !str_starts_with($uri, '//')) { \trigger_deprecation( 'guzzlehttp/psr7', '3.6', 'Passing a URI string that starts with a host and port, such as "example.com:8080", is deprecated; guzzlehttp/psr7 4.0 rejects it. Start the string with a scheme or with "//".' ); } return Uri::fromParts($parts); } private static function hasNonAsciiData(string $value): bool { // An engine failure counts as non-ASCII so it cannot skip conversion. return preg_match('/[\x80-\xFF]|%[89A-Fa-f][0-9A-Fa-f]/', $value) !== 0; } private static function isPlainAsciiHost(string $host): bool { return preg_match('/\A[\x21-\x7E]++\z/', $host) === 1 && strpbrk($host, '%[]') === false && Rfc3986::isValidHost($host); } /** * @param mixed $errors */ private static function describeErrors($errors): string { $names = []; if (is_int($errors) && $errors !== 0) { foreach (get_defined_constants() as $name => $value) { if (str_starts_with($name, 'IDNA_ERROR_') && is_int($value) && ($errors & $value) !== 0) { $names[] = $name; } } } return implode(', ', $names); } }