Skip to content

Commit 185934f

Browse files
committed
Fix phpdoc to include params and correct types
1 parent 87b66ce commit 185934f

File tree

143 files changed

+1045
-293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+1045
-293
lines changed

includes/abstracts/abstract-wc-data.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ public function get_extra_data_keys() {
248248
* Filter null meta values from array.
249249
*
250250
* @since 3.0.0
251+
*
252+
* @param mixed $meta
253+
*
251254
* @return bool
252255
*/
253256
protected function filter_null_meta( $meta ) {
@@ -352,8 +355,8 @@ public function add_meta_data( $key, $value, $unique = false ) {
352355

353356
/**
354357
* Update meta data by key or ID, if provided.
355-
*
356358
* @since 2.6.0
359+
*
357360
* @param string $key
358361
* @param string $value
359362
* @param int $meta_id
@@ -532,8 +535,11 @@ public function get_object_read() {
532535
* Only sets using public methods.
533536
*
534537
* @since 3.0.0
538+
*
535539
* @param array $props Key value pairs to set. Key is the prop and should map to a setter function name.
536-
* @return WP_Error|bool
540+
* @param string $context
541+
*
542+
* @return bool|WP_Error
537543
*/
538544
public function set_props( $props, $context = 'set' ) {
539545
$errors = new WP_Error();

includes/abstracts/abstract-wc-deprecated-hooks.php

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ abstract function handle_deprecated_hook( $new_hook, $old_hook, $new_callback_ar
7676

7777
/**
7878
* Display a deprecated notice for old hooks.
79+
*
80+
* @param string $old_hook
81+
* @param string $new_hook
7982
*/
8083
protected function display_notice( $old_hook, $new_hook ) {
8184
wc_deprecated_function( sprintf( 'The "%s" hook uses out of date data structures and', esc_html( $old_hook ) ), WC_VERSION, esc_html( $new_hook ) );

includes/abstracts/abstract-wc-order.php

+7
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,8 @@ public function get_subtotal_to_display( $compound = false, $tax_display = '' )
13871387
/**
13881388
* Gets shipping (formatted).
13891389
*
1390+
* @param string $tax_display
1391+
*
13901392
* @return string
13911393
*/
13921394
public function get_shipping_to_display( $tax_display = '' ) {
@@ -1427,6 +1429,9 @@ public function get_shipping_to_display( $tax_display = '' ) {
14271429
/**
14281430
* Get the discount amount (formatted).
14291431
* @since 2.3.0
1432+
*
1433+
* @param string $tax_display
1434+
*
14301435
* @return string
14311436
*/
14321437
public function get_discount_to_display( $tax_display = '' ) {
@@ -1569,6 +1574,8 @@ public function get_order_item_totals( $tax_display = '' ) {
15691574
/**
15701575
* Checks the order status against a passed in status.
15711576
*
1577+
* @param array|string $status
1578+
*
15721579
* @return bool
15731580
*/
15741581
public function has_status( $status ) {

includes/abstracts/abstract-wc-product.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public function get_height( $context = 'view' ) {
436436
/**
437437
* Returns formatted dimensions.
438438
*
439-
* @param $formatted True by default for legacy support - will be false/not set in future versions to return the array only. Use wc_format_dimensions for formatted versions instead.
439+
* @param $formatted bool True by default for legacy support - will be false/not set in future versions to return the array only. Use wc_format_dimensions for formatted versions instead.
440440
* @return string|array
441441
*/
442442
public function get_dimensions( $formatted = true ) {
@@ -1639,6 +1639,9 @@ public function get_stock_managed_by_id() {
16391639

16401640
/**
16411641
* Returns the price in html format.
1642+
*
1643+
* @param string $deprecated
1644+
*
16421645
* @return string
16431646
*/
16441647
public function get_price_html( $deprecated = '' ) {
@@ -1719,7 +1722,7 @@ public function add_to_cart_text() {
17191722
*
17201723
* @param string $size (default: 'shop_thumbnail')
17211724
* @param array $attr
1722-
* @param bool True to return $placeholder if no image is found, or false to return an empty string.
1725+
* @param bool $placeholder True to return $placeholder if no image is found, or false to return an empty string.
17231726
* @return string
17241727
*/
17251728
public function get_image( $size = 'shop_thumbnail', $attr = array(), $placeholder = true ) {

includes/abstracts/abstract-wc-rest-controller.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public function validate_setting_select_field( $value, $setting ) {
228228
* @since 3.0.0
229229
* @param array $values
230230
* @param array $setting
231-
* @return string|WP_Error
231+
* @return array|WP_Error
232232
*/
233233
public function validate_setting_multiselect_field( $values, $setting ) {
234234
if ( empty( $values ) ) {
@@ -253,7 +253,7 @@ public function validate_setting_multiselect_field( $values, $setting ) {
253253
* Validate image_width based settings.
254254
*
255255
* @since 3.0.0
256-
* @param array $value
256+
* @param array $values
257257
* @param array $setting
258258
* @return string|WP_Error
259259
*/

includes/abstracts/abstract-wc-rest-crud-controller.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function delete_item_permissions_check( $request ) {
9494
/**
9595
* Get object permalink.
9696
*
97-
* @param int $id Object ID.
97+
* @param object $object
9898
* @return string
9999
*/
100100
protected function get_permalink( $object ) {

includes/abstracts/abstract-wc-rest-posts-controller.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public function delete_item_permissions_check( $request ) {
122122
* Check if a given request has access batch create, update and delete items.
123123
*
124124
* @param WP_REST_Request $request Full details about the request.
125-
* @return boolean
125+
*
126+
* @return boolean|WP_Error
126127
*/
127128
public function batch_items_permissions_check( $request ) {
128129
if ( ! wc_rest_check_post_permissions( $this->post_type, 'batch' ) ) {

includes/abstracts/abstract-wc-rest-terms-controller.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function delete_item_permissions_check( $request ) {
200200
* Check if a given request has access batch create, update and delete items.
201201
*
202202
* @param WP_REST_Request $request Full details about the request.
203-
* @return boolean
203+
* @return boolean|WP_Error
204204
*/
205205
public function batch_items_permissions_check( $request ) {
206206
$permissions = $this->check_permissions( $request, 'batch' );

includes/abstracts/abstract-wc-settings-api.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,11 @@ public function get_field_key( $key ) {
273273
* Generate the HTML for the fields on the "settings" screen.
274274
*
275275
* @param array $form_fields (default: array())
276+
* @param bool $echo
277+
*
278+
* @return string the html for the settings
276279
* @since 1.0.0
277280
* @uses method_exists()
278-
* @return string the html for the settings
279281
*/
280282
public function generate_settings_html( $form_fields = array(), $echo = true ) {
281283
if ( empty( $form_fields ) ) {
@@ -875,7 +877,7 @@ public function validate_select_field( $key, $value ) {
875877
*
876878
* @param string $key
877879
* @param string $value Posted Value
878-
* @return string
880+
* @return string|array
879881
*/
880882
public function validate_multiselect_field( $key, $value ) {
881883
return is_array( $value ) ? array_map( 'wc_clean', array_map( 'stripslashes', $value ) ) : '';
@@ -884,6 +886,8 @@ public function validate_multiselect_field( $key, $value ) {
884886
/**
885887
* Validate the data on the "Settings" form.
886888
* @deprecated 2.6.0 No longer used
889+
*
890+
* @param array $form_fields
887891
*/
888892
public function validate_settings_fields( $form_fields = array() ) {
889893
wc_deprecated_function( 'validate_settings_fields', '2.6' );

includes/abstracts/abstract-wc-shipping-method.php

+2
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ public function supports( $feature ) {
137137

138138
/**
139139
* Called to calculate shipping rates for this method. Rates can be added using the add_rate() method.
140+
*
141+
* @param array $package
140142
*/
141143
public function calculate_shipping( $package = array() ) {}
142144

includes/abstracts/abstract-wc-widget.php

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public function flush_widget_cache() {
108108
* Output the html at the start of a widget.
109109
*
110110
* @param array $args
111+
* @param array $instance
112+
*
111113
* @return string
112114
*/
113115
public function widget_start( $args, $instance ) {

includes/admin/class-wc-admin-duplicate-product.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function product_duplicate( $product ) {
170170
*
171171
* @deprecated 3.0.0
172172
* @param mixed $id
173-
* @return WP_Post|bool
173+
* @return object|bool
174174
* @see duplicate_product
175175
*/
176176
private function get_product_to_duplicate( $id ) {

includes/admin/class-wc-admin-post-types.php

+14
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ public function __construct() {
108108

109109
/**
110110
* Adjust shop order columns for the user on certain conditions.
111+
*
112+
* @param array $hidden
113+
* @param object $screen
114+
*
115+
* @return array
111116
*/
112117
public function adjust_shop_order_columns( $hidden, $screen ) {
113118
if ( isset( $screen->id ) && 'edit-shop_order' === $screen->id ) {
@@ -1899,6 +1904,8 @@ public function disable_view_mode_options( $post_types ) {
18991904

19001905
/**
19011906
* Show blank slate.
1907+
*
1908+
* @param string $which
19021909
*/
19031910
public function maybe_render_blank_state( $which ) {
19041911
global $post_type;
@@ -1941,6 +1948,11 @@ public function maybe_render_blank_state( $which ) {
19411948

19421949
/**
19431950
* When editing the shop page, we should hide templates.
1951+
*
1952+
* @param array $page_templates
1953+
* @param $class
1954+
* @param object $post
1955+
*
19441956
* @return array
19451957
*/
19461958
public function hide_cpt_archive_templates( $page_templates, $class, $post ) {
@@ -1955,6 +1967,8 @@ public function hide_cpt_archive_templates( $page_templates, $class, $post ) {
19551967

19561968
/**
19571969
* Show a notice above the CPT archive.
1970+
*
1971+
* @param object $post
19581972
*/
19591973
public function show_cpt_archive_notice( $post ) {
19601974
$shop_page_id = wc_get_page_id( 'shop' );

includes/admin/class-wc-admin-reports.php

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ public static function get_reports() {
152152

153153
/**
154154
* Get a report from our reports subfolder.
155+
*
156+
* @param string $name
155157
*/
156158
public static function get_report( $name ) {
157159
$name = sanitize_title( str_replace( '_', '-', $name ) );

includes/admin/class-wc-admin-settings.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,10 @@ public static function output() {
172172
/**
173173
* Get a setting from the settings API.
174174
*
175-
* @param mixed $option_name
176-
* @return string
175+
* @param string $option_name
176+
* @param mixed $default
177+
*
178+
* @return mixed
177179
*/
178180
public static function get_option( $option_name, $default = '' ) {
179181
// Array value
@@ -214,7 +216,7 @@ public static function get_option( $option_name, $default = '' ) {
214216
*
215217
* Loops though the woocommerce options array and outputs each field.
216218
*
217-
* @param array $options Opens array to output
219+
* @param array[] $options Opens array to output
218220
*/
219221
public static function output_fields( $options ) {
220222
foreach ( $options as $value ) {

includes/admin/class-wc-admin-taxonomies.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ public function product_cat_columns( $columns ) {
327327
* @param string $columns
328328
* @param string $column
329329
* @param int $id
330-
* @return array
330+
*
331+
* @return string
331332
*/
332333
public function product_cat_column( $columns, $column, $id ) {
333334

includes/admin/class-wc-admin-webhooks.php

+3
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,8 @@ public static function logs_output( $webhook ) {
491491
/**
492492
* Get the webhook topic data.
493493
*
494+
* @param WC_Webhook $webhook
495+
*
494496
* @return array
495497
*/
496498
public static function get_topic_data( $webhook ) {
@@ -519,6 +521,7 @@ public static function get_topic_data( $webhook ) {
519521
* Get the logs navigation.
520522
*
521523
* @param int $total
524+
* @param WC_Webhook $webhook
522525
*
523526
* @return string
524527
*/

includes/admin/meta-boxes/class-wc-meta-box-product-data.php

+11
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ public static function output_variations() {
173173

174174
/**
175175
* Prepare downloads for save.
176+
*
177+
* @param array $file_names
178+
* @param array $file_urls
179+
* @param array $file_hashes
180+
*
176181
* @return array
177182
*/
178183
private static function prepare_downloads( $file_names, $file_urls, $file_hashes ) {
@@ -204,6 +209,9 @@ private static function prepare_children() {
204209

205210
/**
206211
* Prepare attributes for save.
212+
*
213+
* @param array $data
214+
*
207215
* @return array
208216
*/
209217
public static function prepare_attributes( $data = false ) {
@@ -292,6 +300,9 @@ private static function prepare_set_attributes( $all_attributes, $key_prefix = '
292300

293301
/**
294302
* Save meta box data.
303+
*
304+
* @param int $post_id
305+
* @param $post
295306
*/
296307
public static function save( $post_id, $post ) {
297308
// Process product type first so we have the correct class to run setters.

includes/admin/meta-boxes/class-wc-meta-box-product-reviews.php

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class WC_Meta_Box_Product_Reviews {
1919

2020
/**
2121
* Output the metabox
22+
*
23+
* @param object $comment
2224
*/
2325
public static function output( $comment ) {
2426
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
@@ -35,6 +37,11 @@ public static function output( $comment ) {
3537

3638
/**
3739
* Save meta box data
40+
*
41+
* @param mixed $location
42+
* @param int $comment_id
43+
*
44+
* @return mixed
3845
*/
3946
public static function save( $location, $comment_id ) {
4047
// Not allowed, return regular value without updating meta

includes/admin/reports/class-wc-report-sales-by-date.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,10 @@ class="export_csv"
590590

591591
/**
592592
* Round our totals correctly.
593-
* @param string $amount
594-
* @return string
593+
*
594+
* @param array|string $amount
595+
*
596+
* @return array|string
595597
*/
596598
private function round_chart_totals( $amount ) {
597599
if ( is_array( $amount ) ) {

includes/admin/settings/class-wc-settings-checkout.php

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public function get_sections() {
5959
/**
6060
* Get settings array.
6161
*
62+
* @param string $current_section
63+
*
6264
* @return array
6365
*/
6466
public function get_settings( $current_section = '' ) {

includes/admin/settings/class-wc-settings-page.php

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ public function get_label() {
6363

6464
/**
6565
* Add this page to settings.
66+
*
67+
* @param array $pages
68+
*
69+
* @return mixed
6670
*/
6771
public function add_settings_page( $pages ) {
6872
$pages[ $this->id ] = $this->label;

includes/admin/settings/class-wc-settings-products.php

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ public function save() {
7474
/**
7575
* Get settings array.
7676
*
77+
* @param string $current_section
78+
*
7779
* @return array
7880
*/
7981
public function get_settings( $current_section = '' ) {

0 commit comments

Comments
 (0)