diff --git a/visitor.php b/visitor.php index 792df1a6..b92452d3 100644 --- a/visitor.php +++ b/visitor.php @@ -2,6 +2,7 @@ declare(strict_types = 1); +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\DocBlock\Tags\Return_; @@ -65,6 +66,11 @@ final class WordPressTag extends WithChildren */ public $name = null; + /** + * @var ?string + */ + public $description = null; + /** * @return string[] */ @@ -118,19 +124,27 @@ public function format(): array } $strings = array_merge($strings, $childStrings); + $description = ''; + + if ($this->description !== null) { + $description = ' ' . $this->description; + } if ($this->isArrayShape()) { $strings[] = sprintf( - '}%s', - $name + '}%s%s', + $name, + $description ); } else { $strings[] = sprintf( - '}>%s', - $name + '}>%s%s', + $name, + $description ); } + return $strings; } } @@ -231,9 +245,14 @@ public function format(int $level = 1): array private $functionMap = null; /** - * @var string + * @var array> + */ + private $additionalTags = []; + + /** + * @var array> */ - private $currentSymbolName; + private $additionalTagStrings = []; public function __construct() { @@ -254,18 +273,14 @@ public function enterNode(Node $node) return null; } - if ($node instanceof Property) { - $this->currentSymbolName = ''; - } else { - $this->currentSymbolName = $node->name->name; - } + $symbolName = self::getNodeName($node); if ($node instanceof ClassMethod) { /** @var \PhpParser\Node\Stmt\Class_ $parent */ $parent = $this->stack[count($this->stack) - 2]; if (isset($parent->name)) { - $this->currentSymbolName = sprintf( + $symbolName = sprintf( '%1$s::%2$s', $parent->name->name, $node->name->name @@ -273,37 +288,112 @@ public function enterNode(Node $node) } } - $newDocComment = $this->addArrayHashNotation($docComment); + $additions = $this->generateAdditionalTagsFromDoc($docComment); + $node->setAttribute('fullSymbolName', $symbolName); + + if (count($additions) > 0) { + $this->additionalTags[ $symbolName ] = $additions; + } + + $additions = $this->getAdditionalTagsFromMap($symbolName); + + if (count($additions) > 0) { + $this->additionalTagStrings[ $symbolName ] = $additions; + } + + return null; + } + + private static function getNodeName(Node $node): string + { + if (($node instanceof Function_) || ($node instanceof ClassMethod)) { + return $node->name->name; + } + + if ($node instanceof Property) { + return sprintf( + 'property_%s', + uniqid() + ); + } + + return ''; + } + + /** + * @return Node[] + */ + public function getStubStmts(): array + { + $stmts = parent::getStubStmts(); + + foreach ($stmts as $stmt) { + $this->postProcessNode($stmt); + } + + return $stmts; + } + + private function postProcessNode(Node $node): void + { + if (isset($node->stmts) && is_array($node->stmts)) { + foreach ($node->stmts as $stmt) { + $this->postProcessNode($stmt); + } + } + + if (! ($node instanceof Function_) && ! ($node instanceof ClassMethod) && ! ($node instanceof Property)) { + return; + } + + $name = $node->getAttribute('fullSymbolName'); + + if ($name === null) { + return; + } + + $docComment = $node->getDocComment(); + + if (!($docComment instanceof Doc)) { + return; + } + + $newDocComment = $this->addTags($name, $docComment); if ($newDocComment !== null) { $node->setDocComment($newDocComment); } + if (! isset($this->additionalTagStrings[ $name ])) { + return; + } + $docComment = $node->getDocComment(); if (!($docComment instanceof Doc)) { - return null; + return; } - $newDocComment = $this->addAdditionalParams($docComment); + $newDocComment = $this->addStringTags($name, $docComment); if ($newDocComment !== null) { $node->setDocComment($newDocComment); } - - return null; } - private function addArrayHashNotation(Doc $docComment): ?Doc + /** + * @return array + */ + private function generateAdditionalTagsFromDoc(Doc $docComment): array { $docCommentText = $docComment->getText(); try { $docblock = $this->docBlockFactory->create($docCommentText); } catch ( \RuntimeException $e ) { - return null; + return []; } catch ( \InvalidArgumentException $e ) { - return null; + return []; } /** @var \phpDocumentor\Reflection\DocBlock\Tags\Param[] */ @@ -315,10 +405,6 @@ private function addArrayHashNotation(Doc $docComment): ?Doc /** @var \phpDocumentor\Reflection\DocBlock\Tags\Var_[] */ $vars = $docblock->getTagsByName('var'); - if (!$params && !$returns && !$vars) { - return null; - } - /** @var WordPressTag[] $additions */ $additions = []; @@ -327,34 +413,62 @@ private function addArrayHashNotation(Doc $docComment): ?Doc continue; } - $addition = $this->getAdditionFromParam($param); + $addition = self::getAdditionFromParam($param); if ($addition !== null) { $additions[] = $addition; } } - if ($returns !== [] && $returns[0] instanceof Return_) { - $addition = $this->getAdditionFromReturn($returns[0]); + foreach ($returns as $return) { + if (! $return instanceof Return_) { + continue; + } + + $addition = self::getAdditionFromReturn($return); if ($addition !== null) { $additions[] = $addition; } } - if ($vars !== [] && $vars[0] instanceof Var_) { - $addition = $this->getAdditionFromVar($vars[0]); + foreach ($vars as $var) { + if (! $var instanceof Var_) { + continue; + } + + $addition = self::getAdditionFromVar($var); if ($addition !== null) { $additions[] = $addition; } } - if (!$additions) { + return $additions; + } + + private function addTags(string $name, Doc $docComment): ?Doc + { + if (isset($this->additionalTags[ $name ])) { + $additions = $this->additionalTags[ $name ]; + } else { + $additions = []; + } + + $docCommentText = $docComment->getText(); + + try { + $docblock = $this->docBlockFactory->create($docCommentText); + } catch ( \RuntimeException $e ) { + return null; + } catch ( \InvalidArgumentException $e ) { return null; } - $additions = array_map( function(WordPressTag $tag): string { + $additions = $this->discoverInheritedArgs($docblock, $additions); + + /** @var string[] $additionStrings */ + $additionStrings = array_map( function(WordPressTag $tag): string { $lines = $tag->format(); if (count($lines) === 0) { @@ -364,32 +478,140 @@ private function addArrayHashNotation(Doc $docComment): ?Doc return " * " . implode("\n * ", $lines); }, $additions); - $additions = array_filter($additions); + $additionStrings = array_filter($additionStrings); - if (count($additions) === 0) { + if (count($additionStrings) === 0) { return null; } $newDocComment = sprintf( "%s\n%s\n */", substr($docCommentText, 0, -4), - implode("\n", $additions) + implode("\n", $additionStrings) ); - return new Doc($newDocComment, $docComment->getLine(), $docComment->getFilePos()); + return new Doc($newDocComment, $docComment->getStartLine(), $docComment->getStartFilePos()); } - private function addAdditionalParams(Doc $docComment): ?Doc + /** + * @param array $additions + * @return array + */ + private function discoverInheritedArgs(DocBlock $docblock, array $additions): array + { + foreach ($additions as $add) { + if ($add->tag === '@phpstan-param') { + // We can't yet handle merging args. + return $additions; + } + } + + /** @var Param[] $params */ + $params = $docblock->getTagsByName('param'); + + foreach ($params as $param) { + $additions = array_merge($additions, $this->getInheritedTagsForParam($param)); + } + + return $additions; + } + + /** + * @return array + */ + private function getInheritedTagsForParam(Param $param): array + { + $type = $param->getType(); + + if ($type === null) { + return []; + } + + $typeName = self::getTypeNameFromType($type); + + if ($typeName === null) { + return []; + } + + $paramDescription = $param->getDescription(); + + if ($paramDescription === null) { + return []; + } + + list($description) = explode("\n\n", $paramDescription->__toString()); + + if (strpos($description, '()') === false) { + return []; + } + + $description = str_replace("\n", ' ', $description); + $additions = []; + + foreach ($this->additionalTags as $symbolName => $tags) { + $search = sprintf( + 'see %s()', + $symbolName + ); + + if (stripos($description, $search) === false) { + continue; + } + + $match = self::getMatchingInheritedTag($param, $tags, $symbolName); + + if ($match !== null) { + $additions[] = $match; + } + } + + return $additions; + } + + /** + * @param array $tags + */ + private static function getMatchingInheritedTag(Param $param, array $tags, string $symbolName): ?WordPressTag + { + $paramName = $param->getVariableName(); + $matchNames = [ + $paramName, + 'args', + 'options', + 'query', + ]; + $matchingTags = array_filter($tags, static function(WordPressTag $tag) use ($matchNames): bool { + return in_array($tag->name, $matchNames, true); + }); + + foreach ($matchingTags as $tag) { + $addTag = clone $tag; + $addTag->name = $paramName; + $addTag->description = sprintf( + 'See %s()', + $symbolName + ); + + return $addTag; + } + + return null; + } + + /** + * @return string[] + */ + private function getAdditionalTagsFromMap(string $symbolName): array { if (! isset($this->functionMap)) { $this->functionMap = require __DIR__ . '/functionMap.php'; } - if (! isset($this->functionMap[$this->currentSymbolName])) { - return null; + if (! isset($this->functionMap[$symbolName])) { + return []; } - $parameters = $this->functionMap[$this->currentSymbolName]; + $parameters = $this->functionMap[$symbolName]; $returnType = array_shift($parameters); $additions = []; @@ -415,6 +637,17 @@ private function addAdditionalParams(Doc $docComment): ?Doc $returnType ); + return $additions; + } + + private function addStringTags(string $name, Doc $docComment): ?Doc + { + if ( !isset($this->additionalTagStrings[ $name ])) { + return null; + } + + $additions = $this->additionalTagStrings[ $name ]; + $docCommentText = $docComment->getText(); $newDocComment = sprintf( "%s\n * %s\n */", @@ -422,7 +655,7 @@ private function addAdditionalParams(Doc $docComment): ?Doc implode("\n * ", $additions) ); - return new Doc($newDocComment, $docComment->getLine(), $docComment->getFilePos()); + return new Doc($newDocComment, $docComment->getStartLine(), $docComment->getStartFilePos()); } private function getAdditionFromParam(Param $tag): ?WordPressTag @@ -436,13 +669,13 @@ private function getAdditionFromParam(Param $tag): ?WordPressTag return null; } - $elements = $this->getElementsFromDescription($tagDescription, true); + $elements = self::getElementsFromDescription($tagDescription, true); if (count($elements) === 0) { return null; } - $tagVariableType = $this->getTypeNameFromType($tagVariableType); + $tagVariableType = self::getTypeNameFromType($tagVariableType); if ($tagVariableType === null) { return null; @@ -471,13 +704,13 @@ private function getAdditionFromReturn(Return_ $tag): ?WordPressTag return null; } - $elements = $this->getElementsFromDescription($tagDescription, false); + $elements = self::getElementsFromDescription($tagDescription, false); if (count($elements) === 0) { return null; } - $tagVariableType = $this->getTypeNameFromType($tagVariableType); + $tagVariableType = self::getTypeNameFromType($tagVariableType); if ($tagVariableType === null) { return null; @@ -491,7 +724,7 @@ private function getAdditionFromReturn(Return_ $tag): ?WordPressTag return $tag; } - private function getAdditionFromVar(Var_ $tag): ?WordPressTag + private static function getAdditionFromVar(Var_ $tag): ?WordPressTag { $tagDescription = $tag->getDescription(); $tagVariableType = $tag->getType(); @@ -501,13 +734,13 @@ private function getAdditionFromVar(Var_ $tag): ?WordPressTag return null; } - $elements = $this->getElementsFromDescription($tagDescription, false); + $elements = self::getElementsFromDescription($tagDescription, false); if (count($elements) === 0) { return null; } - $tagVariableType = $this->getTypeNameFromType($tagVariableType); + $tagVariableType = self::getTypeNameFromType($tagVariableType); if ($tagVariableType === null) { return null; @@ -521,12 +754,12 @@ private function getAdditionFromVar(Var_ $tag): ?WordPressTag return $tag; } - private function getTypeNameFromType(Type $tagVariableType): ?string + private static function getTypeNameFromType(Type $tagVariableType): ?string { - return $this->getTypeNameFromString($tagVariableType->__toString()); + return self::getTypeNameFromString($tagVariableType->__toString()); } - private function getTypeNameFromString(string $tagVariable): ?string + private static function getTypeNameFromString(string $tagVariable): ?string { // PHPStan dosn't support typed array shapes (`int[]{...}`) so replace // typed arrays such as `int[]` with `array`. @@ -552,7 +785,7 @@ private function getTypeNameFromString(string $tagVariable): ?string /** * @return WordPressArg[] */ - private function getElementsFromDescription(Description $tagDescription, bool $optional): array + private static function getElementsFromDescription(Description $tagDescription, bool $optional): array { $text = $tagDescription->__toString(); @@ -562,13 +795,13 @@ private function getElementsFromDescription(Description $tagDescription, bool $o return []; } - return $this->getTypesAtLevel($text, $optional, 1); + return self::getTypesAtLevel($text, $optional, 1); } /** * @return WordPressArg[] */ - private function getTypesAtLevel(string $text, bool $optional, int $level): array + private static function getTypesAtLevel(string $text, bool $optional, int $level): array { // Populate `$types` with the value of each top level `@type`. $spaces = str_repeat(' ', ($level * 4)); @@ -613,10 +846,10 @@ private function getTypesAtLevel(string $text, bool $optional, int $level): arra $arg->name = $name; $nextLevel = $level + 1; - $subTypes = $this->getTypesAtLevel($typeTag, $optional, $nextLevel); + $subTypes = self::getTypesAtLevel($typeTag, $optional, $nextLevel); if (count($subTypes) > 0) { - $type = $this->getTypeNameFromString($type); + $type = self::getTypeNameFromString($type); if ($type !== null) { $arg->type = $type; diff --git a/wordpress-stubs.php b/wordpress-stubs.php index 62ff9f69..4863ab52 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -1829,6 +1829,9 @@ public function upgrade_strings() * @param array $args Optional. Other optional arguments, see * Language_Pack_Upgrader::bulk_upgrade(). Default empty array. * @return array|bool|WP_Error The result of the upgrade, or a WP_Error object instead. + * @phpstan-param array{ + * clear_update_cache?: bool, + * } $args See Language_Pack_Upgrader::bulk_upgrade() */ public function upgrade($update = \false, $args = array()) { @@ -3620,6 +3623,15 @@ class Walker_Category_Checklist extends \Walker * @param string $output Used to append additional content (passed by reference). * @param int $depth Depth of category. Used for tab indentation. * @param array $args An array of arguments. @see wp_terms_checklist() + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() */ public function start_lvl(&$output, $depth = 0, $args = array()) { @@ -3634,6 +3646,15 @@ public function start_lvl(&$output, $depth = 0, $args = array()) * @param string $output Used to append additional content (passed by reference). * @param int $depth Depth of category. Used for tab indentation. * @param array $args An array of arguments. @see wp_terms_checklist() + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() */ public function end_lvl(&$output, $depth = 0, $args = array()) { @@ -3652,6 +3673,15 @@ public function end_lvl(&$output, $depth = 0, $args = array()) * @param int $depth Depth of the term in reference to parents. Default 0. * @param array $args An array of arguments. @see wp_terms_checklist() * @param int $current_object_id Optional. ID of the current term. Default 0. + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() */ public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) { @@ -3668,6 +3698,15 @@ public function start_el(&$output, $data_object, $depth = 0, $args = array(), $c * @param WP_Term $data_object The current term object. * @param int $depth Depth of the term in reference to parents. Default 0. * @param array $args An array of arguments. @see wp_terms_checklist() + * @phpstan-param array{ + * descendants_and_self?: int, + * selected_cats?: int[], + * popular_cats?: int[], + * walker?: Walker, + * taxonomy?: string, + * checked_ontop?: bool, + * echo?: bool, + * } $args See wp_terms_checklist() */ public function end_el(&$output, $data_object, $depth = 0, $args = array()) { @@ -30138,6 +30177,27 @@ class Walker_CategoryDropdown extends \Walker * @param array $args Uses 'selected', 'show_count', and 'value_field' keys, if they exist. * See wp_dropdown_categories(). * @param int $current_object_id Optional. ID of the current category. Default 0. + * @phpstan-param array{ + * show_option_all?: string, + * show_option_none?: string, + * option_none_value?: string, + * orderby?: string, + * pad_counts?: bool, + * show_count?: bool|int, + * echo?: bool|int, + * hierarchical?: bool|int, + * depth?: int, + * tab_index?: int, + * name?: string, + * id?: string, + * class?: string, + * selected?: int|string, + * value_field?: string, + * taxonomy?: string|array, + * hide_if_empty?: bool, + * required?: bool, + * walker?: Walker, + * } $args See wp_dropdown_categories() */ public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) { @@ -30189,6 +30249,26 @@ class Walker_Category extends \Walker * @param int $depth Optional. Depth of category. Used for tab indentation. Default 0. * @param array $args Optional. An array of arguments. Will only append content if style argument * value is 'list'. See wp_list_categories(). Default empty array. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() */ public function start_lvl(&$output, $depth = 0, $args = array()) { @@ -30204,6 +30284,26 @@ public function start_lvl(&$output, $depth = 0, $args = array()) * @param int $depth Optional. Depth of category. Used for tab indentation. Default 0. * @param array $args Optional. An array of arguments. Will only append content if style argument * value is 'list'. See wp_list_categories(). Default empty array. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() */ public function end_lvl(&$output, $depth = 0, $args = array()) { @@ -30223,6 +30323,26 @@ public function end_lvl(&$output, $depth = 0, $args = array()) * @param array $args Optional. An array of arguments. See wp_list_categories(). * Default empty array. * @param int $current_object_id Optional. ID of the current category. Default 0. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() */ public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) { @@ -30240,6 +30360,26 @@ public function start_el(&$output, $data_object, $depth = 0, $args = array(), $c * @param int $depth Optional. Depth of category. Not used. * @param array $args Optional. An array of arguments. Only uses 'list' for whether should * append to output. See wp_list_categories(). Default empty array. + * @phpstan-param array{ + * current_category?: int|int[], + * depth?: int, + * echo?: bool|int, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * feed?: string, + * feed_image?: string, + * feed_type?: string, + * hide_title_if_empty?: bool, + * separator?: string, + * show_count?: bool|int, + * show_option_all?: string, + * show_option_none?: string, + * style?: string, + * taxonomy?: string, + * title_li?: string, + * use_desc_for_title?: bool|int, + * walker?: Walker, + * } $args See wp_list_categories() */ public function end_el(&$output, $data_object, $depth = 0, $args = array()) { @@ -30494,6 +30634,19 @@ class Walker_PageDropdown extends \Walker * 'value_field' argument to fill "value" attribute. * See wp_dropdown_pages(). Default empty array. * @param int $current_object_id Optional. ID of the current page. Default 0. + * @phpstan-param array{ + * depth?: int, + * child_of?: int, + * selected?: int|string, + * echo?: bool|int, + * name?: string, + * id?: string, + * class?: string, + * show_option_none?: string, + * show_option_no_change?: string, + * option_none_value?: string, + * value_field?: string, + * } $args See wp_dropdown_pages() */ public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) { @@ -32258,6 +32411,30 @@ final class WP_Block_Type_Registry * of `WP_Block_Type`. See WP_Block_Type::__construct() for information * on accepted arguments. Default empty array. * @return WP_Block_Type|false The registered block type on success, or false on failure. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: array|null, + * ancestor?: array|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array, + * variations?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * attributes?: array|null, + * uses_context?: array, + * provides_context?: array|null, + * editor_script?: string|null, + * script?: string|null, + * view_script?: string|null, + * editor_style?: string|null, + * style?: string|null, + * } $args See WP_Block_Type::__construct() */ public function register($name, $args = array()) { @@ -32625,6 +32802,30 @@ public function prepare_attributes_for_render($attributes) * * @param array|string $args Array or string of arguments for registering a block type. * See WP_Block_Type::__construct() for information on accepted arguments. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: array|null, + * ancestor?: array|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array, + * variations?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * attributes?: array|null, + * uses_context?: array, + * provides_context?: array|null, + * editor_script?: string|null, + * script?: string|null, + * view_script?: string|null, + * editor_style?: string|null, + * style?: string|null, + * } $args See WP_Block_Type::__construct() */ public function set_props($args) { @@ -33094,6 +33295,57 @@ public function __construct($query = '') * @since 4.2.0 Extracted from WP_Comment_Query::query(). * * @param string|array $query WP_Comment_Query arguments. See WP_Comment_Query::__construct() + * @phpstan-param array{ + * author_email?: string, + * author_url?: string, + * author__in?: int[], + * author__not_in?: int[], + * comment__in?: int[], + * comment__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * include_unapproved?: array, + * karma?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * number?: int, + * paged?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * parent?: int, + * parent__in?: int[], + * parent__not_in?: int[], + * post_author__in?: int[], + * post_author__not_in?: int[], + * post_ID?: int, + * post_id?: int, + * post__in?: int[], + * post__not_in?: int[], + * post_author?: int, + * post_status?: string|string[], + * post_type?: string|string[], + * post_name?: string, + * post_parent?: int, + * search?: string, + * status?: string|array, + * type?: string|string[], + * type__in?: string[], + * type__not_in?: string[], + * user_id?: int, + * hierarchical?: bool|string, + * cache_domain?: string, + * update_comment_meta_cache?: bool, + * update_comment_post_cache?: bool, + * } $query See WP_Comment_Query::__construct() */ public function parse_query($query = '') { @@ -35039,6 +35291,17 @@ public function handle_dismiss_autosave_or_lock_request() * See WP_Customize_Setting::__construct() for information * on accepted arguments. Default empty array. * @return WP_Customize_Setting The instance of the setting that was added. + * @phpstan-param array{ + * type?: string, + * capability?: string, + * theme_supports?: string|string[], + * default?: string, + * transport?: string, + * validate_callback?: callable, + * sanitize_callback?: callable, + * sanitize_js_callback?: callable, + * dirty?: bool, + * } $args See WP_Customize_Setting::__construct() */ public function add_setting($id, $args = array()) { @@ -35096,6 +35359,15 @@ public function remove_setting($id) * See WP_Customize_Panel::__construct() for information * on accepted arguments. Default empty array. * @return WP_Customize_Panel The instance of the panel that was added. + * @phpstan-param array{ + * priority?: int, + * capability?: string, + * theme_supports?: string|string[], + * title?: string, + * description?: string, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Panel::__construct() */ public function add_panel($id, $args = array()) { @@ -35158,6 +35430,17 @@ public function render_panel_templates() * See WP_Customize_Section::__construct() for information * on accepted arguments. Default empty array. * @return WP_Customize_Section The instance of the section that was added. + * @phpstan-param array{ + * priority?: int, + * panel?: string, + * capability?: string, + * theme_supports?: string|string[], + * title?: string, + * description?: string, + * type?: string, + * active_callback?: callable, + * description_hidden?: bool, + * } $args See WP_Customize_Section::__construct() */ public function add_section($id, $args = array()) { @@ -35220,6 +35503,24 @@ public function render_section_templates() * See WP_Customize_Control::__construct() for information * on accepted arguments. Default empty array. * @return WP_Customize_Control The instance of the control that was added. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() */ public function add_control($id, $args = array()) { @@ -38567,6 +38868,22 @@ public static function parse_settings($editor_id, $settings) * @param string $editor_id HTML ID for the textarea and TinyMCE and Quicktags instances. * Should not contain square brackets. * @param array $settings See _WP_Editors::parse_settings() for description. + * @phpstan-param array{ + * wpautop?: bool, + * media_buttons?: bool, + * default_editor?: string, + * drag_drop_upload?: bool, + * textarea_name?: string, + * textarea_rows?: int, + * tabindex?: string|int, + * tabfocus_elements?: string, + * editor_css?: string, + * editor_class?: string, + * teeny?: bool, + * dfw?: bool, + * tinymce?: bool|array, + * quicktags?: bool|array, + * } $settings See _WP_Editors::parse_settings() */ public static function editor($content, $editor_id, $settings = array()) { @@ -43164,6 +43481,25 @@ public function __construct($query = '') * @since 4.6.0 * * @param string|array $query WP_Network_Query arguments. See WP_Network_Query::__construct() + * @phpstan-param array{ + * network__in?: int[], + * network__not_in?: int[], + * count?: bool, + * fields?: string, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * search?: string, + * update_network_cache?: bool, + * } $query See WP_Network_Query::__construct() */ public function parse_query($query = '') { @@ -44008,6 +44344,11 @@ public static function _remove_provider_early($format) * @param string|array $args Optional. Additional arguments for retrieving embed HTML. * See wp_oembed_get() for accepted arguments. Default empty. * @return object|false The result in the form of an object on success, false on failure. + * @phpstan-param array{ + * width?: int|string, + * height?: int|string, + * discover?: bool, + * } $args See wp_oembed_get() */ public function get_data($url, $args = '') { @@ -44025,6 +44366,11 @@ public function get_data($url, $args = '') * See wp_oembed_get() for accepted arguments. Default empty. * @return string|false The UNSANITIZED (and potentially unsafe) HTML that should be used to embed * on success, false on failure. + * @phpstan-param array{ + * width?: int|string, + * height?: int|string, + * discover?: bool, + * } $args See wp_oembed_get() */ public function get_html($url, $args = '') { @@ -44050,6 +44396,11 @@ public function discover($url) * @param string|array $args Optional. Additional arguments for retrieving embed HTML. * See wp_oembed_get() for accepted arguments. Default empty. * @return object|false The result in the form of an object on success, false on failure. + * @phpstan-param array{ + * width?: int|string, + * height?: int|string, + * discover?: bool, + * } $args See wp_oembed_get() */ public function fetch($provider, $url, $args = '') { @@ -48915,6 +49266,47 @@ public function __construct($query = '') * @see WP_Site_Query::__construct() * * @param string|array $query Array or string of WP_Site_Query arguments. See WP_Site_Query::__construct(). + * @phpstan-param array{ + * site__in?: int[], + * site__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * network_id?: int, + * network__in?: int[], + * network__not_in?: int[], + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * lang__in?: string[], + * lang__not_in?: string[], + * search?: string, + * search_columns?: string[], + * update_site_cache?: bool, + * update_site_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $query See WP_Site_Query::__construct() */ public function parse_query($query = '') { @@ -50078,6 +50470,41 @@ public function __construct($query = '') * @since 4.6.0 * * @param string|array $query WP_Term_Query arguments. See WP_Term_Query::__construct() + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $query See WP_Term_Query::__construct() */ public function parse_query($query = '') { @@ -53952,6 +54379,16 @@ public function form($instance) * information on accepted arguments. Default empty array. * @param array $control_options Optional. Widget control options. See wp_register_widget_control() for * information on accepted arguments. Default empty array. + * @phpstan-param array{ + * classname?: string, + * description?: string, + * show_instance_in_rest?: bool, + * } $widget_options See wp_register_sidebar_widget() + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $control_options See wp_register_widget_control() */ public function __construct($id_base, $name, $widget_options = array(), $control_options = array()) { @@ -53971,6 +54408,16 @@ public function __construct($id_base, $name, $widget_options = array(), $control * information on accepted arguments. Default empty array. * @param array $control_options Optional. Widget control options. See wp_register_widget_control() for * information on accepted arguments. Default empty array. + * @phpstan-param array{ + * classname?: string, + * description?: string, + * show_instance_in_rest?: bool, + * } $widget_options See wp_register_sidebar_widget() + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $control_options See wp_register_widget_control() */ public function WP_Widget($id_base, $name, $widget_options = array(), $control_options = array()) { @@ -57682,6 +58129,24 @@ class WP_Customize_Media_Control extends \WP_Customize_Control * @param array $args Optional. Arguments to override class property defaults. * See WP_Customize_Control::__construct() for information * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() */ public function __construct($manager, $id, $args = array()) { @@ -58086,6 +58551,24 @@ class WP_Customize_Color_Control extends \WP_Customize_Control * @param array $args Optional. Arguments to override class property defaults. * See WP_Customize_Control::__construct() for information * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() */ public function __construct($manager, $id, $args = array()) { @@ -58721,6 +59204,24 @@ class WP_Customize_Nav_Menu_Item_Control extends \WP_Customize_Control * @param array $args Optional. Arguments to override class property defaults. * See WP_Customize_Control::__construct() for information * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() */ public function __construct($manager, $id, $args = array()) { @@ -59637,6 +60138,24 @@ class WP_Customize_New_Menu_Control extends \WP_Customize_Control * @param array $args Optional. Arguments to override class property defaults. * See WP_Customize_Control::__construct() for information * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() */ public function __construct(\WP_Customize_Manager $manager, $id, array $args = array()) { @@ -60014,6 +60533,16 @@ public function partials() * See WP_Customize_Partial::__construct() for information * on accepted arguments. Default empty array. * @return WP_Customize_Partial The instance of the partial that was added. + * @phpstan-param array{ + * type?: string, + * selector?: string, + * settings?: string[], + * primary_setting?: string, + * capability?: string, + * render_callback?: callable, + * container_inclusive?: bool, + * fallback_refresh?: bool, + * } $args See WP_Customize_Partial::__construct() */ public function add_partial($id, $args = array()) { @@ -60202,6 +60731,24 @@ class WP_Customize_Site_Icon_Control extends \WP_Customize_Cropped_Image_Control * @param array $args Optional. Arguments to override class property defaults. * See WP_Customize_Control::__construct() for information * on accepted arguments. Default empty array. + * @phpstan-param array{ + * instance_number?: int, + * manager?: WP_Customize_Manager, + * id?: string, + * settings?: array, + * setting?: string, + * capability?: string, + * priority?: int, + * section?: string, + * label?: string, + * description?: string, + * choices?: array, + * input_attrs?: array, + * allow_addition?: bool, + * json?: array, + * type?: string, + * active_callback?: callable, + * } $args See WP_Customize_Control::__construct() */ public function __construct($manager, $id, $args = array()) { @@ -71509,6 +72056,16 @@ abstract class WP_Widget_Media extends \WP_Widget * information on accepted arguments. Default empty array. * @param array $control_options Optional. Widget control options. See wp_register_widget_control() * for information on accepted arguments. Default empty array. + * @phpstan-param array{ + * classname?: string, + * description?: string, + * show_instance_in_rest?: bool, + * } $widget_options See wp_register_sidebar_widget() + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $control_options See wp_register_widget_control() */ public function __construct($id_base, $name, $widget_options = array(), $control_options = array()) { @@ -75353,6 +75910,21 @@ function wp_set_link_cats($link_id = 0, $link_categories = array()) * * @param array $linkdata Link data to update. See wp_insert_link() for accepted arguments. * @return int|WP_Error Value 0 or WP_Error on failure. The updated link ID on success. + * @phpstan-param array{ + * link_id?: int, + * link_url?: string, + * link_name?: string, + * link_image?: string, + * link_target?: string, + * link_description?: string, + * link_visible?: string, + * link_owner?: int, + * link_rating?: int, + * link_rel?: string, + * link_notes?: string, + * link_rss?: string, + * link_category?: int, + * } $linkdata See wp_insert_link() */ function wp_update_link($linkdata) { @@ -77088,6 +77660,22 @@ function _wp_handle_upload(&$file, $overrides, $time, $action) * See _wp_handle_upload() for accepted values. * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null. * @return array See _wp_handle_upload() for return value. + * @phpstan-param array{ + * name?: string, + * type?: string, + * tmp_name?: string, + * size?: int, + * error?: int, + * } $file See _wp_handle_upload() + * @phpstan-param false|array{ + * upload_error_handler?: callable, + * unique_filename_callback?: callable, + * upload_error_strings?: string[], + * test_form?: bool, + * test_size?: bool, + * test_type?: bool, + * mimes?: string[], + * } $overrides See _wp_handle_upload() */ function wp_handle_upload(&$file, $overrides = \false, $time = \null) { @@ -77109,6 +77697,22 @@ function wp_handle_upload(&$file, $overrides = \false, $time = \null) * See _wp_handle_upload() for accepted values. * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null. * @return array See _wp_handle_upload() for return value. + * @phpstan-param array{ + * name?: string, + * type?: string, + * tmp_name?: string, + * size?: int, + * error?: int, + * } $file See _wp_handle_upload() + * @phpstan-param false|array{ + * upload_error_handler?: callable, + * unique_filename_callback?: callable, + * upload_error_strings?: string[], + * test_form?: bool, + * test_size?: bool, + * test_type?: bool, + * mimes?: string[], + * } $overrides See _wp_handle_upload() */ function wp_handle_sideload(&$file, $overrides = \false, $time = \null) { @@ -87322,6 +87926,30 @@ function get_block_metadata_i18n_schema() * of `WP_Block_Type`. See WP_Block_Type::__construct() for information * on accepted arguments. Default empty array. * @return WP_Block_Type|false The registered block type on success, or false on failure. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: array|null, + * ancestor?: array|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array, + * variations?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * attributes?: array|null, + * uses_context?: array, + * provides_context?: array|null, + * editor_script?: string|null, + * script?: string|null, + * view_script?: string|null, + * editor_style?: string|null, + * style?: string|null, + * } $args See WP_Block_Type::__construct() */ function register_block_type_from_metadata($file_or_folder, $args = array()) { @@ -87343,6 +87971,30 @@ function register_block_type_from_metadata($file_or_folder, $args = array()) * on accepted arguments. Default empty array. * * @return WP_Block_Type|false The registered block type on success, or false on failure. + * @phpstan-param array{ + * api_version?: string, + * title?: string, + * category?: string|null, + * parent?: array|null, + * ancestor?: array|null, + * icon?: string|null, + * description?: string, + * keywords?: string[], + * textdomain?: string|null, + * styles?: array, + * variations?: array, + * supports?: array|null, + * example?: array|null, + * render_callback?: callable|null, + * attributes?: array|null, + * uses_context?: array, + * provides_context?: array|null, + * editor_script?: string|null, + * script?: string|null, + * view_script?: string|null, + * editor_style?: string|null, + * style?: string|null, + * } $args See WP_Block_Type::__construct() */ function register_block_type($block_type, $args = array()) { @@ -91608,6 +92260,9 @@ function wp_simplepie_autoload($class) * See WP_Block_Pattern_Categories_Registry::register() for * accepted arguments. * @return bool True if the pattern category was registered with success and false otherwise. + * @phpstan-param array{ + * label?: string, + * } $category_properties See WP_Block_Pattern_Categories_Registry::register() */ function register_block_pattern_category($category_name, $category_properties) { @@ -91632,6 +92287,15 @@ function unregister_block_pattern_category($category_name) * @param array $pattern_properties List of properties for the block pattern. * See WP_Block_Patterns_Registry::register() for accepted arguments. * @return bool True if the pattern was registered with success and false otherwise. + * @phpstan-param array{ + * title?: string, + * content?: string, + * description?: string, + * viewportWidth?: int, + * categories?: array, + * blockTypes?: array, + * keywords?: array, + * } $pattern_properties See WP_Block_Patterns_Registry::register() */ function register_block_pattern($pattern_name, $pattern_properties) { @@ -92702,6 +93366,57 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $ * @param array $args Optional. See WP_Comment_Query::__construct() for information on accepted arguments. * @return WP_Comment[]|int[]|int The approved comments, or number of comments if `$count` * argument is true. + * @phpstan-param array{ + * author_email?: string, + * author_url?: string, + * author__in?: int[], + * author__not_in?: int[], + * comment__in?: int[], + * comment__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * include_unapproved?: array, + * karma?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * number?: int, + * paged?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * parent?: int, + * parent__in?: int[], + * parent__not_in?: int[], + * post_author__in?: int[], + * post_author__not_in?: int[], + * post_ID?: int, + * post_id?: int, + * post__in?: int[], + * post__not_in?: int[], + * post_author?: int, + * post_status?: string|string[], + * post_type?: string|string[], + * post_name?: string, + * post_parent?: int, + * search?: string, + * status?: string|array, + * type?: string|string[], + * type__in?: string[], + * type__not_in?: string[], + * user_id?: int, + * hierarchical?: bool|string, + * cache_domain?: string, + * update_comment_meta_cache?: bool, + * update_comment_post_cache?: bool, + * } $args See WP_Comment_Query::__construct() */ function get_approved_comments($post_id, $args = array()) { @@ -92736,6 +93451,57 @@ function get_comment($comment = \null, $output = \OBJECT) * @param string|array $args Optional. Array or string of arguments. See WP_Comment_Query::__construct() * for information on accepted arguments. Default empty. * @return WP_Comment[]|int[]|int List of comments or number of found comments if `$count` argument is true. + * @phpstan-param array{ + * author_email?: string, + * author_url?: string, + * author__in?: int[], + * author__not_in?: int[], + * comment__in?: int[], + * comment__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * include_unapproved?: array, + * karma?: int, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * number?: int, + * paged?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * parent?: int, + * parent__in?: int[], + * parent__not_in?: int[], + * post_author__in?: int[], + * post_author__not_in?: int[], + * post_ID?: int, + * post_id?: int, + * post__in?: int[], + * post__not_in?: int[], + * post_author?: int, + * post_status?: string|string[], + * post_type?: string|string[], + * post_name?: string, + * post_parent?: int, + * search?: string, + * status?: string|array, + * type?: string|string[], + * type__in?: string[], + * type__not_in?: string[], + * user_id?: int, + * hierarchical?: bool|string, + * cache_domain?: string, + * update_comment_meta_cache?: bool, + * update_comment_post_cache?: bool, + * } $args See WP_Comment_Query::__construct() */ function get_comments($args = '') { @@ -105061,6 +105827,22 @@ function wp_default_editor() * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. * Should not contain square brackets. * @param array $settings See _WP_Editors::parse_settings() for description. + * @phpstan-param array{ + * wpautop?: bool, + * media_buttons?: bool, + * default_editor?: string, + * drag_drop_upload?: bool, + * textarea_name?: string, + * textarea_rows?: int, + * tabindex?: string|int, + * tabfocus_elements?: string, + * editor_css?: string, + * editor_class?: string, + * teeny?: bool, + * dfw?: bool, + * tinymce?: bool|array, + * quicktags?: bool|array, + * } $settings See _WP_Editors::parse_settings() */ function wp_editor($content, $editor_id, $settings = array()) { @@ -108820,6 +109602,16 @@ function get_the_post_navigation($args = array()) * * @param array $args Optional. See get_the_post_navigation() for available arguments. * Default empty array. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * in_same_term?: bool, + * excluded_terms?: int[]|string, + * taxonomy?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_post_navigation() */ function the_post_navigation($args = array()) { @@ -108864,6 +109656,13 @@ function get_the_posts_navigation($args = array()) * * @param array $args Optional. See get_the_posts_navigation() for available arguments. * Default empty array. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_posts_navigation() */ function the_posts_navigation($args = array()) { @@ -108900,6 +109699,11 @@ function get_the_posts_pagination($args = array()) * * @param array $args Optional. See get_the_posts_pagination() for available arguments. * Default empty array. + * @phpstan-param array{ + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_posts_pagination() */ function the_posts_pagination($args = array()) { @@ -108996,6 +109800,24 @@ function previous_comments_link($label = '') * or if the query is not for an existing single post of any post type. * Otherwise, markup for comment page links or array of comment page links, * depending on 'type' argument. + * @phpstan-param array{ + * base?: string, + * format?: string, + * total?: int, + * current?: int, + * aria_current?: string, + * show_all?: bool, + * end_size?: int, + * mid_size?: int, + * prev_next?: bool, + * prev_text?: bool, + * next_text?: bool, + * type?: string, + * add_args?: array, + * add_fragment?: string, + * before_page_number?: string, + * after_page_number?: string, + * } $args See paginate_links() */ function paginate_comments_links($args = array()) { @@ -109036,6 +109858,13 @@ function get_the_comments_navigation($args = array()) * @since 4.4.0 * * @param array $args See get_the_comments_navigation() for available arguments. Default empty array. + * @phpstan-param array{ + * prev_text?: string, + * next_text?: string, + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_comments_navigation() */ function the_comments_navigation($args = array()) { @@ -109072,6 +109901,11 @@ function get_the_comments_pagination($args = array()) * @since 4.4.0 * * @param array $args See get_the_comments_pagination() for available arguments. Default empty array. + * @phpstan-param array{ + * screen_reader_text?: string, + * aria_label?: string, + * class?: string, + * } $args See get_the_comments_pagination() */ function the_comments_pagination($args = array()) { @@ -114597,6 +115431,47 @@ function update_sitemeta_cache($site_ids) * for information on accepted arguments. Default empty array. * @return array|int List of WP_Site objects, a list of site IDs when 'fields' is set to 'ids', * or the number of sites when 'count' is passed as a query var. + * @phpstan-param array{ + * site__in?: int[], + * site__not_in?: int[], + * count?: bool, + * date_query?: array, + * fields?: string, + * ID?: int, + * number?: int, + * offset?: int, + * no_found_rows?: bool, + * orderby?: string|array, + * order?: string, + * network_id?: int, + * network__in?: int[], + * network__not_in?: int[], + * domain?: string, + * domain__in?: string[], + * domain__not_in?: string[], + * path?: string, + * path__in?: string[], + * path__not_in?: string[], + * public?: int, + * archived?: int, + * mature?: int, + * spam?: int, + * deleted?: int, + * lang_id?: int, + * lang__in?: string[], + * lang__not_in?: string[], + * search?: string, + * search_columns?: string[], + * update_site_cache?: bool, + * update_site_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Site_Query::__construct() */ function get_sites($args = array()) { @@ -119923,6 +120798,41 @@ function wp_untrash_post_comments($post = \null) * 'all_with_object_id', an array of WP_Term objects will be returned. If `$fields` * is 'ids', an array of category IDs. If `$fields` is 'names', an array of category names. * WP_Error object if 'category' taxonomy doesn't exist. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() */ function wp_get_post_categories($post_id = 0, $args = array()) { @@ -119942,6 +120852,41 @@ function wp_get_post_categories($post_id = 0, $args = array()) * See WP_Term_Query::__construct() for supported arguments. * @return array|WP_Error Array of WP_Term objects on success or empty array if no tags were found. * WP_Error object if 'post_tag' taxonomy doesn't exist. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() */ function wp_get_post_tags($post_id = 0, $args = array()) { @@ -120106,6 +121051,35 @@ function wp_insert_post($postarr, $wp_error = \false, $fire_after_hooks = \true) * @param bool $wp_error Optional. Whether to return a WP_Error on failure. Default false. * @param bool $fire_after_hooks Optional. Whether to fire the after insert hooks. Default true. * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure. + * @phpstan-param array{ + * ID?: int, + * post_author?: int, + * post_date?: string, + * post_date_gmt?: string, + * post_content?: string, + * post_content_filtered?: string, + * post_title?: string, + * post_excerpt?: string, + * post_status?: string, + * post_type?: string, + * comment_status?: string, + * ping_status?: string, + * post_password?: string, + * post_name?: string, + * to_ping?: string, + * pinged?: string, + * post_modified?: string, + * post_modified_gmt?: string, + * post_parent?: int, + * menu_order?: int, + * post_mime_type?: string, + * guid?: string, + * import_id?: int, + * post_category?: int[], + * tags_input?: array, + * tax_input?: array, + * meta_input?: array, + * } $postarr See wp_insert_post() */ function wp_update_post($postarr = array(), $wp_error = \false, $fire_after_hooks = \true) { @@ -123469,6 +124443,15 @@ function remove_rewrite_tag($tag) * @param string $struct Permalink structure. * @param array $args Optional. Arguments for building the rules from the permalink structure, * see WP_Rewrite::add_permastruct() for full details. Default empty array. + * @phpstan-param array{ + * with_front?: bool, + * ep_mask?: int, + * paged?: bool, + * feed?: bool, + * forcomments?: bool, + * walk_dirs?: bool, + * endpoints?: bool, + * } $args See WP_Rewrite::add_permastruct() */ function add_permastruct($name, $struct, $args = array()) { @@ -125335,6 +126318,41 @@ function get_term_to_edit($id, $taxonomy) * @return WP_Term[]|int[]|string[]|string|WP_Error Array of terms, a count thereof as a numeric string, * or WP_Error if any of the taxonomies do not exist. * See the function description for more information. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() */ function get_terms($args = array(), $deprecated = '') { @@ -125657,6 +126675,41 @@ function wp_delete_category($cat_ID) * @param array|string $args See WP_Term_Query::__construct() for supported arguments. * @return WP_Term[]|WP_Error Array of terms or empty array if no terms found. * WP_Error if any of the taxonomies don't exist. + * @phpstan-param array{ + * taxonomy?: string|string[], + * object_ids?: int|int[], + * orderby?: string, + * order?: string, + * hide_empty?: bool|int, + * include?: int[]|string, + * exclude?: int[]|string, + * exclude_tree?: int[]|string, + * number?: int|string, + * offset?: int, + * fields?: string, + * count?: bool, + * name?: string|string[], + * slug?: string|string[], + * term_taxonomy_id?: int|int[], + * hierarchical?: bool, + * search?: string, + * name__like?: string, + * description__like?: string, + * pad_counts?: bool, + * get?: string, + * child_of?: int, + * parent?: int, + * childless?: bool, + * cache_domain?: string, + * update_term_meta_cache?: bool, + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * } $args See WP_Term_Query::__construct() */ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) { @@ -128573,6 +129626,41 @@ function delete_user_option($user_id, $option_name, $global = \false) * @param array $args Optional. Arguments to retrieve users. See WP_User_Query::prepare_query() * for more information on accepted arguments. * @return array List of users. + * @phpstan-param array{ + * blog_id?: int, + * role?: string|string[], + * role__in?: string[], + * role__not_in?: string[], + * meta_key?: string|string[], + * meta_value?: string|string[], + * meta_compare?: string, + * meta_compare_key?: string, + * meta_type?: string, + * meta_type_key?: string, + * meta_query?: array, + * capability?: string|string[], + * capability__in?: string[], + * capability__not_in?: string[], + * include?: int[], + * exclude?: int[], + * search?: string, + * search_columns?: string[], + * orderby?: string|array, + * order?: string, + * offset?: int, + * number?: int, + * paged?: int, + * count_total?: bool, + * fields?: string|string[], + * who?: string, + * has_published_posts?: bool|string[], + * nicename?: string, + * nicename__in?: string[], + * nicename__not_in?: string[], + * login?: string, + * login__in?: string[], + * login__not_in?: string[], + * } $args See WP_User_Query::prepare_query() */ function get_users($args = array()) { @@ -129909,6 +130997,11 @@ function wp_register_widget_control($id, $name, $control_callback, $options = ar * @param array $options Optional. Widget control options. See wp_register_widget_control(). * Default empty array. * @param mixed ...$params Optional additional parameters to pass to the callback function when it's called. + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $options See wp_register_widget_control() */ function _register_widget_update_callback($id_base, $update_callback, $options = array(), ...$params) { @@ -129928,6 +131021,11 @@ function _register_widget_update_callback($id_base, $update_callback, $options = * @param array $options Optional. Widget control options. See wp_register_widget_control(). * Default empty array. * @param mixed ...$params Optional additional parameters to pass to the callback function when it's called. + * @phpstan-param array{ + * height?: int, + * width?: int, + * id_base?: int|string, + * } $options See wp_register_widget_control() */ function _register_widget_form_callback($id, $name, $form_callback, $options = array(), ...$params) {