@@ -716,6 +716,26 @@ function ms_allowed_http_request_hosts( $is_external, $host ) {
716716 * When a specific component has been requested: null if the component
717717 * doesn't exist in the given URL; a string or - in the case of
718718 * PHP_URL_PORT - integer when it does. See parse_url()'s return values.
719+ *
720+ * @phpstan-param int<-1, 7> $component
721+ * @phpstan-return (
722+ * $component is -1
723+ * ? false|array{
724+ * scheme?: string,
725+ * host?: string,
726+ * port?: int<0, 65535>,
727+ * user?: string,
728+ * pass?: string,
729+ * path?: string,
730+ * query?: string,
731+ * fragment?: string,
732+ * }
733+ * : (
734+ * $component is 2
735+ * ? int<0, 65535>|null
736+ * : string|null
737+ * )
738+ * )
719739 */
720740function wp_parse_url ( $ url , $ component = -1 ) {
721741 $ to_unset = array ();
@@ -763,6 +783,36 @@ function wp_parse_url( $url, $component = -1 ) {
763783 * When a specific component has been requested: null if the component
764784 * doesn't exist in the given URL; a string or - in the case of
765785 * PHP_URL_PORT - integer when it does. See parse_url()'s return values.
786+ *
787+ * @phpstan-param false|array{
788+ * scheme?: string,
789+ * host?: string,
790+ * port?: int<0, 65535>,
791+ * user?: string,
792+ * pass?: string,
793+ * path?: string,
794+ * query?: string,
795+ * fragment?: string,
796+ * } $url_parts
797+ * @phpstan-param int<-1, 7> $component
798+ * @phpstan-return (
799+ * $component is -1
800+ * ? false|array{
801+ * scheme?: string,
802+ * host?: string,
803+ * port?: int<0, 65535>,
804+ * user?: string,
805+ * pass?: string,
806+ * path?: string,
807+ * query?: string,
808+ * fragment?: string,
809+ * }
810+ * : (
811+ * $component is 2
812+ * ? int<0, 65535>|null
813+ * : string|null
814+ * )
815+ * )
766816 */
767817function _get_component_from_parsed_url_array ( $ url_parts , $ component = -1 ) {
768818 if ( -1 === $ component ) {
@@ -789,6 +839,9 @@ function _get_component_from_parsed_url_array( $url_parts, $component = -1 ) {
789839 *
790840 * @param int $constant PHP_URL_* constant.
791841 * @return string|false The named key or false.
842+ *
843+ * @phpstan-param int<-1, 7> $constant
844+ * @phpstan-return 'scheme'|'host'|'port'|'user'|'pass'|'path'|'query'|'fragment'|false
792845 */
793846function _wp_translate_php_url_constant_to_key ( $ constant ) {
794847 $ translation = array (
0 commit comments