Skip to content

Commit 46f3c09

Browse files
committed
Docs: Improve WP_List_Table and WP_Plugins_List_Table docblocks.
Improve the PHPDoc docblocks in `WP_List_Table` and `WP_Plugins_List_Table` for accuracy, completeness, and consistency with WordPress core documentation standards. Adds missing `@since` tags and corrects several existing versions, adds summary descriptions to all previously bare method and property docblocks, and refines type annotations with precise generic array types. Developed in WordPress#10989. Follow-up to r30679, r31127, r32642, r32654. Props huzaifaalmesbah, westonruter, noruzzaman. See #64896. git-svn-id: https://develop.svn.wordpress.org/trunk@62491 602fd350-edb4-49c9-b593-d223f7449a82
1 parent a22ef26 commit 46f3c09

2 files changed

Lines changed: 142 additions & 56 deletions

File tree

src/wp-admin/includes/class-wp-list-table.php

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,34 @@ class WP_List_Table {
1919
* The current list of items.
2020
*
2121
* @since 3.1.0
22-
* @var array
22+
*
23+
* @var array<int|string, mixed>
2324
*/
2425
public $items;
2526

2627
/**
2728
* Various information about the current table.
2829
*
2930
* @since 3.1.0
30-
* @var array
31+
*
32+
* @var array<string, mixed>
3133
*/
3234
protected $_args;
3335

3436
/**
3537
* Various information needed for displaying the pagination.
3638
*
3739
* @since 3.1.0
38-
* @var array
40+
*
41+
* @var array<string, mixed>
3942
*/
4043
protected $_pagination_args = array();
4144

4245
/**
4346
* The current screen.
4447
*
4548
* @since 3.1.0
49+
*
4650
* @var WP_Screen
4751
*/
4852
protected $screen;
@@ -51,14 +55,16 @@ class WP_List_Table {
5155
* Cached bulk actions.
5256
*
5357
* @since 3.1.0
54-
* @var array
58+
*
59+
* @var array<string, string|array<string, string>>|null
5560
*/
5661
private $_actions;
5762

5863
/**
5964
* Cached pagination output.
6065
*
6166
* @since 3.1.0
67+
*
6268
* @var string
6369
*/
6470
private $_pagination;
@@ -67,29 +73,35 @@ class WP_List_Table {
6773
* The view switcher modes.
6874
*
6975
* @since 4.1.0
70-
* @var array
76+
*
77+
* @var array<string, string>
7178
*/
7279
protected $modes = array();
7380

7481
/**
75-
* Stores the value returned by ::get_column_info().
82+
* Stores the value returned by {@see self::get_column_info()}.
7683
*
77-
* @since 4.1.0
78-
* @var array|null
84+
* @since 4.2.0
85+
*
86+
* @var array<int, array|string>|null
7987
*/
8088
protected $_column_headers;
8189

8290
/**
8391
* List of private properties made readable for backward compatibility.
8492
*
85-
* @var array
93+
* @since 4.2.0
94+
*
95+
* @var string[]
8696
*/
8797
protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
8898

8999
/**
90100
* List of private/protected methods made readable for backward compatibility.
91101
*
92-
* @var array
102+
* @since 4.2.0
103+
*
104+
* @var string[]
93105
*/
94106
protected $compat_methods = array(
95107
'set_pagination_args',
@@ -116,7 +128,7 @@ class WP_List_Table {
116128
* The child class should call this constructor from its own constructor to override
117129
* the default $args.
118130
*
119-
* @since 3.1.0
131+
* @since 3.2.0
120132
*
121133
* @param array|string $args {
122134
* Array or string of arguments.
@@ -348,7 +360,7 @@ public function get_pagination_arg( $key ) {
348360
}
349361

350362
/**
351-
* Determines whether the table has items to display or not
363+
* Determines whether the table has items to display or not.
352364
*
353365
* @since 3.1.0
354366
*
@@ -359,7 +371,7 @@ public function has_items() {
359371
}
360372

361373
/**
362-
* Message to be displayed when there are no items
374+
* Message to be displayed when there are no items.
363375
*
364376
* @since 3.1.0
365377
*/
@@ -790,7 +802,7 @@ protected function months_dropdown( $post_type ) {
790802
*
791803
* @since 3.1.0
792804
*
793-
* @param string $current_mode
805+
* @param string $current_mode The current view mode slug, e.g. 'list' or 'excerpt'.
794806
*/
795807
protected function view_switcher( $current_mode ) {
796808
?>
@@ -1389,7 +1401,7 @@ public function get_column_count() {
13891401
*
13901402
* @since 3.1.0
13911403
*
1392-
* @param bool $with_id Whether to set the ID attribute or not
1404+
* @param bool $with_id Whether to set the ID attribute or not. Default true.
13931405
*/
13941406
public function print_column_headers( $with_id = true ) {
13951407
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
@@ -1657,9 +1669,10 @@ protected function get_table_classes() {
16571669
}
16581670

16591671
/**
1660-
* Generates the table navigation above or below the table
1672+
* Generates the table navigation above or below the table.
16611673
*
16621674
* @since 3.1.0
1675+
*
16631676
* @param string $which The location of the navigation: Either 'top' or 'bottom'.
16641677
*/
16651678
protected function display_tablenav( $which ) {
@@ -1736,13 +1749,21 @@ public function single_row( $item ) {
17361749
}
17371750

17381751
/**
1739-
* @param object|array $item
1740-
* @param string $column_name
1752+
* Handles an unknown column.
1753+
*
1754+
* @since 4.2.0
1755+
*
1756+
* @param object|array $item The current item.
1757+
* @param string $column_name Name of the column.
17411758
*/
17421759
protected function column_default( $item, $column_name ) {}
17431760

17441761
/**
1745-
* @param object|array $item
1762+
* Handles the checkbox column output.
1763+
*
1764+
* @since 4.2.0
1765+
*
1766+
* @param object|array $item The current item.
17461767
*/
17471768
protected function column_cb( $item ) {}
17481769

0 commit comments

Comments
 (0)