diff --git a/wordpress-stubs.php b/wordpress-stubs.php index 71efeaa..dc769c4 100644 --- a/wordpress-stubs.php +++ b/wordpress-stubs.php @@ -59,9 +59,13 @@ public function set_result($result) public function request_filesystem_credentials($error = \false, $context = '', $allow_relaxed_file_ownership = \false) { } + * @phpstan-return void + */ public function header() { } + * @phpstan-return void + */ public function footer() { } @@ -265,27 +269,7 @@ class WP_Upgrader */ public $skin = \null; /** - * The result of the installation. - * - * This is set by WP_Upgrader::install_package(), only when the package is installed - * successfully. It will then be an array, unless a WP_Error is returned by the - * {@see 'upgrader_post_install'} filter. In that case, the WP_Error will be assigned to - * it. - * - * @since 2.8.0 - * - * @var array|WP_Error $result { - * @type string $source The full path to the source the files were installed from. - * @type string $source_files List of all the files in the source directory. - * @type string $destination The full path to the installation destination folder. - * @type string $destination_name The name of the destination folder, or empty if `$destination` - * and `$local_destination` are the same. - * @type string $local_destination The full local path to the destination folder. This is usually - * the same as `$destination`. - * @type string $remote_destination The full remote path to the destination folder - * (i.e., from `$wp_filesystem`). - * @type bool $clear_destination Whether the destination folder was cleared. - * } + * @var array|\WP_Error $result * @phpstan-var \WP_Error|array{ * source: string, * source_files: string, @@ -362,35 +346,8 @@ public function clear_destination($remote_destination) { } /** - * Install a package. - * - * Copies the contents of a package from a source directory, and installs them in - * a destination directory. Optionally removes the source. It can also optionally - * clear out the destination folder if it already exists. - * - * @since 2.8.0 - * @since 6.2.0 Use move_dir() instead of copy_dir() when possible. - * - * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. - * @global array $wp_theme_directories - * - * @param array|string $args { - * Optional. Array or string of arguments for installing a package. Default empty array. - * - * @type string $source Required path to the package source. Default empty. - * @type string $destination Required path to a folder to install the package in. - * Default empty. - * @type bool $clear_destination Whether to delete any files already in the destination - * folder. Default false. - * @type bool $clear_working Whether to delete the files from the working directory - * after copying them to the destination. Default false. - * @type bool $abort_if_destination_exists Whether to abort the installation if - * the destination folder already exists. Default true. - * @type array $hook_extra Extra arguments to pass to the filter hooks called by - * WP_Upgrader::install_package(). Default empty array. - * } - * - * @return array|WP_Error The result (also stored in `WP_Upgrader::$result`), or a WP_Error on failure. + * @param array|string $args + * @return array|\WP_Error * @phpstan-param array{ * source?: string, * destination?: string, @@ -404,37 +361,8 @@ public function install_package($args = array()) { } /** - * Runs an upgrade/installation. - * - * Attempts to download the package (if it is not a local file), unpack it, and - * install it in the destination folder. - * - * @since 2.8.0 - * - * @param array $options { - * Array or string of arguments for upgrading/installing a package. - * - * @type string $package The full path or URI of the package to install. - * Default empty. - * @type string $destination The full path to the destination folder. - * Default empty. - * @type bool $clear_destination Whether to delete any files already in the - * destination folder. Default false. - * @type bool $clear_working Whether to delete the files from the working - * directory after copying them to the destination. - * Default true. - * @type bool $abort_if_destination_exists Whether to abort the installation if the destination - * folder already exists. When true, `$clear_destination` - * should be false. Default true. - * @type bool $is_multi Whether this run is one of multiple upgrade/installation - * actions being performed in bulk. When true, the skin - * WP_Upgrader::header() and WP_Upgrader::footer() - * aren't called. Default false. - * @type array $hook_extra Extra arguments to pass to the filter hooks called by - * WP_Upgrader::run(). - * } - * @return array|false|WP_Error The result from self::install_package() on success, otherwise a WP_Error, - * or false if unable to connect to the filesystem. + * @param array $options + * @return array|false|\WP_Error * @phpstan-param array{ * package?: string, * destination?: string, @@ -470,21 +398,8 @@ public static function release_lock($lock_name) { } /** - * Moves the plugin or theme being updated into a temporary backup directory. - * - * @since 6.3.0 - * - * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. - * - * @param string[] $args { - * Array of data for the temporary backup. - * - * @type string $slug Plugin or theme slug. - * @type string $src Path to the root directory for plugins or themes. - * @type string $dir Destination subdirectory name. Accepts 'plugins' or 'themes'. - * } - * - * @return bool|WP_Error True on success, false on early exit, otherwise WP_Error. + * @param string[] $args + * @return bool|\WP_Error * @phpstan-param array{ * slug?: string, * src?: string, @@ -495,25 +410,8 @@ public function move_to_temp_backup_dir($args) { } /** - * Restores the plugin or theme from temporary backup. - * - * @since 6.3.0 - * @since 6.6.0 Added the `$temp_backups` parameter. - * - * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. - * - * @param array[] $temp_backups { - * Optional. An array of temporary backups. - * - * @type array ...$0 { - * Information about the backup. - * - * @type string $dir The temporary backup location in the upgrade-temp-backup directory. - * @type string $slug The item's slug. - * @type string $src The directory where the original is stored. For example, `WP_PLUGIN_DIR`. - * } - * } - * @return bool|WP_Error True on success, false on early exit, otherwise WP_Error. + * @param array[] $temp_backups + * @return bool|\WP_Error * @phpstan-param array 'parent', 'id' => 'term_id'); // TODO: Decouple this. /** - * Starts the list before the elements are added. - * - * @see Walker:start_lvl() - * - * @since 2.5.1 - * - * @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 {@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() + * @param string $output + * @param int $depth + * @param array $args */ public function start_lvl(&$output, $depth = 0, $args = array()) { } /** - * Ends the list of after the elements are added. - * - * @see Walker::end_lvl() - * - * @since 2.5.1 - * - * @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 {@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() + * @param string $output + * @param int $depth + * @param array $args */ public function end_lvl(&$output, $depth = 0, $args = array()) { } /** - * Start the element output. - * - * @see Walker::start_el() - * - * @since 2.5.1 - * @since 5.9.0 Renamed `$category` to `$data_object` and `$id` to `$current_object_id` - * to match parent class for PHP 8 named parameter support. - * - * @param string $output Used to append additional content (passed by reference). - * @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 {@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() + * @param string $output + * @param \WP_Term $data_object + * @param int $depth + * @param array $args + * @param int $current_object_id */ public function start_el(&$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0) { } /** - * Ends the element output, if needed. - * - * @see Walker::end_el() - * - * @since 2.5.1 - * @since 5.9.0 Renamed `$category` to `$data_object` to match parent class for PHP 8 named parameter support. - * - * @param string $output Used to append additional content (passed by reference). - * @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 {@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() + * @param string $output + * @param \WP_Term $data_object + * @param int $depth + * @param array $args */ public function end_el(&$output, $data_object, $depth = 0, $args = array()) { @@ -2813,29 +2556,7 @@ class WP_List_Table */ protected $compat_methods = array('set_pagination_args', 'get_views', 'get_bulk_actions', 'bulk_actions', 'row_actions', 'months_dropdown', 'view_switcher', 'comments_bubble', 'get_items_per_page', 'pagination', 'get_sortable_columns', 'get_column_info', 'get_table_classes', 'display_tablenav', 'extra_tablenav', 'single_row_columns'); /** - * Constructor. - * - * The child class should call this constructor from its own constructor to override - * the default $args. - * - * @since 3.1.0 - * - * @param array|string $args { - * Array or string of arguments. - * - * @type string $plural Plural value used for labels and the objects being listed. - * This affects things such as CSS class-names and nonces used - * in the list table, e.g. 'posts'. Default empty. - * @type string $singular Singular label for an object being listed, e.g. 'post'. - * Default empty - * @type bool $ajax Whether the list table supports Ajax. This includes loading - * and sorting data, for example. If true, the class will call - * the _js_vars() method in the footer to provide variables - * to any scripts handling Ajax events. Default false. - * @type string $screen String containing the hook name used to determine the current - * screen. If left null, the current screen will be automatically set. - * Default null. - * } + * @param array|string $args * @phpstan-param array{ * plural?: string, * singular?: string, @@ -2922,18 +2643,8 @@ public function search_box($text, $input_id) { } /** - * Generates views links. - * - * @since 6.1.0 - * - * @param array $link_data { - * An array of link data. - * - * @type string $url The link URL. - * @type string $label The link label. - * @type bool $current Optional. Whether this is the currently selected view. - * } - * @return string[] An array of link markup. Keys match the `$link_data` input array. + * @param array $link_data + * @return string[] * @phpstan-param array{ * url?: string, * label?: string, @@ -2949,6 +2660,8 @@ protected function get_views_links($link_data = array()) protected function get_views() { } + * @phpstan-return void + */ public function views() { } @@ -2959,12 +2672,7 @@ protected function get_bulk_actions() { } /** - * Displays the bulk actions dropdown. - * - * @since 3.1.0 - * - * @param string $which The location of the bulk actions: Either 'top' or 'bottom'. - * This is designated as optional for backward compatibility. + * @param string $which * @phpstan-param 'top'|'bottom' $which * @phpstan-return void */ @@ -3020,11 +2728,7 @@ protected function get_items_per_page($option, $default_value = 20) { } /** - * Displays the pagination. - * - * @since 3.1.0 - * - * @param string $which The location of the pagination: Either 'top' or 'bottom'. + * @param string $which * @phpstan-param 'top'|'bottom' $which * @phpstan-return void */ @@ -3096,10 +2800,7 @@ protected function get_table_classes() { } /** - * Generates the table navigation above or below the table - * - * @since 3.1.0 - * @param string $which The location of the navigation: Either 'top' or 'bottom'. + * @param string $which * @phpstan-param 'top'|'bottom' $which */ protected function display_tablenav($which) @@ -3151,6 +2852,8 @@ protected function single_row_columns($item) protected function handle_row_actions($item, $column_name, $primary) { } + * @phpstan-return never + */ public function ajax_response() { } @@ -3207,11 +2910,7 @@ protected function column_default($item, $column_name) { } /** - * Generates custom table navigation to prevent conflicting nonces. - * - * @since 5.6.0 - * - * @param string $which The location of the bulk actions: Either 'top' or 'bottom'. + * @param string $which * @phpstan-param 'top'|'bottom' $which */ protected function display_tablenav($which) @@ -3284,6 +2983,8 @@ protected function send_core_update_notification_email($item) public function update($type, $item) { } + * @phpstan-return void + */ public function run() { } @@ -3481,21 +3182,8 @@ class WP_Community_Events */ protected $user_location = \false; /** - * Constructor for WP_Community_Events. - * - * @since 4.8.0 - * - * @param int $user_id WP user ID. - * @param false|array $user_location { - * Stored location data for the user. false to pass no location. - * - * @type string $description The name of the location - * @type string $latitude The latitude in decimal degrees notation, without the degree - * symbol. e.g.: 47.615200. - * @type string $longitude The longitude in decimal degrees notation, without the degree - * symbol. e.g.: -122.341100. - * @type string $country The ISO 3166-1 alpha-2 country code. e.g.: BR - * } + * @param int $user_id + * @param false|array $user_location * @phpstan-param false|array{ * description?: string, * latitude?: string, @@ -3603,13 +3291,9 @@ public static function get_mysql_var($mysql_var) { } /** - * Formats the information gathered for debugging, in a manner suitable for copying to a forum or support ticket. - * - * @since 5.2.0 - * - * @param array $info_array Information gathered from the `WP_Debug_Data::debug_data()` function. - * @param string $data_type The data type to return, either 'info' or 'debug'. - * @return string The formatted data. + * @param array $info_array + * @param string $data_type + * @return string * @phpstan-param 'info'|'debug' $data_type */ public static function format($info_array, $data_type) @@ -3936,40 +3620,10 @@ public function rmdir($path, $recursive = \false) { } /** - * Gets details for files in a directory or a specific file. - * - * @since 2.5.0 - * @abstract - * - * @param string $path Path to directory or file. - * @param bool $include_hidden Optional. Whether to include details of hidden ("." prefixed) files. - * Default true. - * @param bool $recursive Optional. Whether to recursively include file details in nested directories. - * Default false. - * @return array|false { - * Array of arrays containing file information. False if unable to list directory contents. - * - * @type array ...$0 { - * Array of file information. Note that some elements may not be available on all filesystems. - * - * @type string $name Name of the file or directory. - * @type string $perms *nix representation of permissions. - * @type string $permsn Octal representation of permissions. - * @type int|string|false $number File number. May be a numeric string. False if not available. - * @type string|false $owner Owner name or ID, or false if not available. - * @type string|false $group File permissions group, or false if not available. - * @type int|string|false $size Size of file in bytes. May be a numeric string. - * False if not available. - * @type int|string|false $lastmodunix Last modified unix timestamp. May be a numeric string. - * False if not available. - * @type string|false $lastmod Last modified month (3 letters) and day (without leading 0), or - * false if not available. - * @type string|false $time Last modified time, or false if not available. - * @type string $type Type of resource. 'f' for file, 'd' for directory, 'l' for link. - * @type array|false $files If a directory and `$recursive` is true, contains another array of - * files. False if unable to list directory contents. - * } - * } + * @param string $path + * @param bool $include_hidden + * @param bool $recursive + * @return array|false * @phpstan-return false|array