From 4f00d7e5e3c631b5aad97ada407411795a488120 Mon Sep 17 00:00:00 2001 From: Rasmus Bengtsson Date: Fri, 12 May 2017 10:48:46 +0200 Subject: [PATCH 1/2] PHPDoc: Add missing return statement --- includes/abstracts/abstract-wc-order.php | 6 ++++++ .../abstracts/abstract-wc-rest-controller.php | 2 ++ includes/abstracts/abstract-wc-settings-api.php | 5 ++++- includes/abstracts/abstract-wc-widget.php | 1 + .../reports/class-wc-report-customer-list.php | 2 ++ includes/api/class-wc-rest-orders-controller.php | 8 ++++++++ includes/api/legacy/v2/class-wc-api-products.php | 5 ++++- .../api/v1/class-wc-rest-orders-controller.php | 8 ++++++++ includes/class-wc-checkout.php | 3 +++ includes/class-wc-data-store.php | 5 +++++ includes/class-wc-datetime.php | 3 +++ includes/class-wc-frontend-scripts.php | 3 +++ includes/class-wc-order.php | 3 +++ includes/class-wc-shipping.php | 2 ++ includes/cli/class-wc-cli-rest-command.php | 5 +++++ .../class-wc-coupon-data-store-cpt.php | 5 +++-- .../class-wc-customer-data-store-session.php | 1 + .../class-wc-shipping-zone-data-store.php | 3 +++ .../class-wc-gateway-simplify-commerce.php | 10 +++++++--- .../includes/Simplify/Authorization.php | 14 +++++++------- .../includes/Simplify/Coupon.php | 14 +++++++------- .../includes/Simplify/Customer.php | 14 +++++++------- .../includes/Simplify/Invoice.php | 14 +++++++------- .../includes/Simplify/InvoiceItem.php | 14 +++++++------- .../simplify-commerce/includes/Simplify/Plan.php | 14 +++++++------- .../includes/Simplify/Subscription.php | 14 +++++++------- .../simplify-commerce/includes/Simplify/Tax.php | 14 +++++++------- .../includes/Simplify/TransactionReview.php | 14 +++++++------- .../includes/Simplify/Webhook.php | 14 +++++++------- includes/wc-cart-functions.php | 5 +++++ includes/wc-core-functions.php | 3 +++ includes/wc-stock-functions.php | 3 +++ includes/wc-template-functions.php | 16 +++++++++++++++- 33 files changed, 169 insertions(+), 78 deletions(-) diff --git a/includes/abstracts/abstract-wc-order.php b/includes/abstracts/abstract-wc-order.php index ba10071b735..768805125cf 100644 --- a/includes/abstracts/abstract-wc-order.php +++ b/includes/abstracts/abstract-wc-order.php @@ -630,6 +630,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * * @param string $value * @param string $deprecated Function used to set different totals based on this. + * + * @return bool|void * @throws WC_Data_Exception */ public function set_total( $value, $deprecated = '' ) { @@ -817,6 +819,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * Remove item from the order. * * @param int $item_id + * + * @return false|void */ public function remove_item( $item_id ) { $item = $this->get_item( $item_id ); @@ -835,6 +839,8 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order { * * @since 3.0.0 * @param WC_Order_Item Order item object (product, shipping, fee, coupon, tax) + * + * * @return false|void */ public function add_item( $item ) { if ( ! $items_key = $this->get_items_key( $item ) ) { diff --git a/includes/abstracts/abstract-wc-rest-controller.php b/includes/abstracts/abstract-wc-rest-controller.php index c2c39555635..ad889be2728 100644 --- a/includes/abstracts/abstract-wc-rest-controller.php +++ b/includes/abstracts/abstract-wc-rest-controller.php @@ -35,6 +35,8 @@ abstract class WC_REST_Controller extends WP_REST_Controller { * The type of object is inferred from the passed schema. * * @param array $schema Schema array. + * + * @return array */ protected function add_additional_fields_schema( $schema ) { if ( empty( $schema['title'] ) ) { diff --git a/includes/abstracts/abstract-wc-settings-api.php b/includes/abstracts/abstract-wc-settings-api.php index 1be55532e23..2adb44f575b 100644 --- a/includes/abstracts/abstract-wc-settings-api.php +++ b/includes/abstracts/abstract-wc-settings-api.php @@ -58,7 +58,10 @@ abstract class WC_Settings_API { /** * Set default required properties for each field. - * @param array + * + * @param array $field + * + * @return array */ protected function set_defaults( $field ) { if ( ! isset( $field['default'] ) ) { diff --git a/includes/abstracts/abstract-wc-widget.php b/includes/abstracts/abstract-wc-widget.php index dc54788689d..072f2d3dedc 100644 --- a/includes/abstracts/abstract-wc-widget.php +++ b/includes/abstracts/abstract-wc-widget.php @@ -189,6 +189,7 @@ abstract class WC_Widget extends WP_Widget { * Outputs the settings update form. * * @see WP_Widget->form + * * @param array $instance */ public function form( $instance ) { diff --git a/includes/admin/reports/class-wc-report-customer-list.php b/includes/admin/reports/class-wc-report-customer-list.php index 96e0e7019b7..21f587b0715 100644 --- a/includes/admin/reports/class-wc-report-customer-list.php +++ b/includes/admin/reports/class-wc-report-customer-list.php @@ -222,6 +222,8 @@ class WC_Report_Customer_List extends WP_List_Table { * Order users by name. * * @param WP_User_Query $query + * + * @return WP_User_Query */ public function order_by_last_name( $query ) { global $wpdb; diff --git a/includes/api/class-wc-rest-orders-controller.php b/includes/api/class-wc-rest-orders-controller.php index 0c4501f5163..5e0d48230c7 100644 --- a/includes/api/class-wc-rest-orders-controller.php +++ b/includes/api/class-wc-rest-orders-controller.php @@ -606,6 +606,8 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller { * * @param array $posted Line item data. * @param string $action 'create' to add line item or 'update' to update it. + * + * @return WC_Order_Item_Product * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_line_items( $posted, $action = 'create' ) { @@ -634,6 +636,8 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller { * * @param $posted $shipping Item data. * @param string $action 'create' to add shipping or 'update' to update it. + * + * @return WC_Order_Item_Shipping * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_shipping_lines( $posted, $action ) { @@ -656,6 +660,8 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller { * * @param array $posted Item data. * @param string $action 'create' to add fee or 'update' to update it. + * + * @return WC_Order_Item_Fee * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_fee_lines( $posted, $action ) { @@ -678,6 +684,8 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller { * * @param array $posted Item data. * @param string $action 'create' to add coupon or 'update' to update it. + * + * @return WC_Order_Item_Coupon * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_coupon_lines( $posted, $action ) { diff --git a/includes/api/legacy/v2/class-wc-api-products.php b/includes/api/legacy/v2/class-wc-api-products.php index ca27e67f376..d6c2fcff249 100644 --- a/includes/api/legacy/v2/class-wc-api-products.php +++ b/includes/api/legacy/v2/class-wc-api-products.php @@ -1613,8 +1613,11 @@ class WC_API_Products extends WC_API_Resource { * Save product images * * @since 2.2 + * * @param WC_Product $product - * @param array $images + * @param array $images + * + * @return WC_Product * @throws WC_API_Exception */ protected function save_product_images( $product, $images ) { diff --git a/includes/api/v1/class-wc-rest-orders-controller.php b/includes/api/v1/class-wc-rest-orders-controller.php index 3e7b85ef3b1..99613982bf9 100644 --- a/includes/api/v1/class-wc-rest-orders-controller.php +++ b/includes/api/v1/class-wc-rest-orders-controller.php @@ -646,6 +646,8 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { * * @param array $posted Line item data. * @param string $action 'create' to add line item or 'update' to update it. + * + * @return WC_Order_Item_Product * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_line_items( $posted, $action = 'create' ) { @@ -673,6 +675,8 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { * * @param $posted $shipping Item data. * @param string $action 'create' to add shipping or 'update' to update it. + * + * @return WC_Order_Item_Shipping * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_shipping_lines( $posted, $action ) { @@ -694,6 +698,8 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { * * @param array $posted Item data. * @param string $action 'create' to add fee or 'update' to update it. + * + * @return WC_Order_Item_Fee * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_fee_lines( $posted, $action ) { @@ -715,6 +721,8 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { * * @param array $posted Item data. * @param string $action 'create' to add coupon or 'update' to update it. + * + * @return WC_Order_Item_Coupon * @throws WC_REST_Exception Invalid data, server error. */ protected function prepare_coupon_lines( $posted, $action ) { diff --git a/includes/class-wc-checkout.php b/includes/class-wc-checkout.php index eda9d32c208..3b35ea2810f 100644 --- a/includes/class-wc-checkout.php +++ b/includes/class-wc-checkout.php @@ -509,8 +509,11 @@ class WC_Checkout { * See if a fieldset should be skipped. * * @since 3.0.0 + * * @param string $fieldset_key * @param array $data + * + * @return bool */ protected function maybe_skip_fieldset( $fieldset_key, $data ) { if ( 'shipping' === $fieldset_key && ( ! $data['ship_to_different_address'] || ! WC()->cart->needs_shipping_address() ) ) { diff --git a/includes/class-wc-data-store.php b/includes/class-wc-data-store.php index ac6b51afde4..9c88f550186 100644 --- a/includes/class-wc-data-store.php +++ b/includes/class-wc-data-store.php @@ -117,7 +117,9 @@ class WC_Data_Store { * Loads a data store. * * @param string $object_type Name of object. + * * @since 3.0.0 + * @return WC_Data_Store */ public static function load( $object_type ) { return new WC_Data_Store( $object_type ); @@ -180,8 +182,11 @@ class WC_Data_Store { * through to the instance if that function exists. * * @since 3.0.0 + * * @param $method * @param $parameters + * + * @return mixed */ public function __call( $method, $parameters ) { if ( is_callable( array( $this->instance, $method ) ) ) { diff --git a/includes/class-wc-datetime.php b/includes/class-wc-datetime.php index b7b310c3b1f..a15100373f5 100644 --- a/includes/class-wc-datetime.php +++ b/includes/class-wc-datetime.php @@ -51,7 +51,10 @@ class WC_DateTime extends DateTime { /** * Set timezone. + * * @param DateTimeZone $timezone + * + * @return static */ public function setTimezone( $timezone ) { $this->utc_offset = 0; diff --git a/includes/class-wc-frontend-scripts.php b/includes/class-wc-frontend-scripts.php index 7cbb7b50bd6..750ac93cb42 100644 --- a/includes/class-wc-frontend-scripts.php +++ b/includes/class-wc-frontend-scripts.php @@ -92,7 +92,10 @@ class WC_Frontend_Scripts { /** * Return protocol relative asset URL. + * * @param string $path + * + * @return string */ private static function get_asset_url( $path ) { return str_replace( array( 'http:', 'https:' ), '', plugins_url( $path, WC_PLUGIN_FILE ) ); diff --git a/includes/class-wc-order.php b/includes/class-wc-order.php index 8039a7b6849..51978539cd2 100644 --- a/includes/class-wc-order.php +++ b/includes/class-wc-order.php @@ -218,10 +218,13 @@ class WC_Order extends WC_Abstract_Order { /** * Set order status. * @since 3.0.0 + * * @param string $new_status Status to change the order to. No internal wc- prefix is required. * @param string $note (default: '') Optional note to add. * @param bool $manual_update is this a manual order status change? * @param array details of change + * + * @return array */ public function set_status( $new_status, $note = '', $manual_update = false ) { $result = parent::set_status( $new_status ); diff --git a/includes/class-wc-shipping.php b/includes/class-wc-shipping.php index c242de60d21..393fcfae7a2 100644 --- a/includes/class-wc-shipping.php +++ b/includes/class-wc-shipping.php @@ -160,6 +160,8 @@ class WC_Shipping { * Register a shipping method. * * @param object|string $method Either the name of the method's class, or an instance of the method's class. + * + * @return bool|void */ public function register_shipping_method( $method ) { if ( ! is_object( $method ) ) { diff --git a/includes/cli/class-wc-cli-rest-command.php b/includes/cli/class-wc-cli-rest-command.php index b500dbafe35..94580bb9a92 100644 --- a/includes/cli/class-wc-cli-rest-command.php +++ b/includes/cli/class-wc-cli-rest-command.php @@ -221,7 +221,10 @@ class WC_CLI_REST_Command { * Do a REST Request * * @param string $method + * @param string $route + * @param array $assoc_args * + * @return array */ private function do_request( $method, $route, $assoc_args ) { if ( ! defined( 'REST_REQUEST' ) ) { @@ -437,6 +440,8 @@ EOT; * This function decodes the json (if present) and tries to get it's value. * * @param array $arr + * + * @return array */ protected function decode_json( $arr ) { foreach ( $arr as $key => $value ) { diff --git a/includes/data-stores/class-wc-coupon-data-store-cpt.php b/includes/data-stores/class-wc-coupon-data-store-cpt.php index 5d9aa76e48d..f0be9e30946 100644 --- a/includes/data-stores/class-wc-coupon-data-store-cpt.php +++ b/includes/data-stores/class-wc-coupon-data-store-cpt.php @@ -165,8 +165,9 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat * Deletes a coupon from the database. * * @since 3.0.0 - * @param WC_Coupon - * @param array $args Array of args to pass to the delete method. + * + * @param WC_Coupon $coupon + * @param array $args Array of args to pass to the delete method. */ public function delete( &$coupon, $args = array() ) { $args = wp_parse_args( $args, array( diff --git a/includes/data-stores/class-wc-customer-data-store-session.php b/includes/data-stores/class-wc-customer-data-store-session.php index 395e5021b9b..75aba1881b8 100644 --- a/includes/data-stores/class-wc-customer-data-store-session.php +++ b/includes/data-stores/class-wc-customer-data-store-session.php @@ -142,6 +142,7 @@ class WC_Customer_Data_Store_Session extends WC_Data_Store_WP implements WC_Cust * Deletes a customer from the database. * * @since 3.0.0 + * * @param WC_Customer * @param array $args Array of args to pass to the delete method. */ diff --git a/includes/data-stores/class-wc-shipping-zone-data-store.php b/includes/data-stores/class-wc-shipping-zone-data-store.php index 31aaa0d7d5f..5af1a1c7ce4 100644 --- a/includes/data-stores/class-wc-shipping-zone-data-store.php +++ b/includes/data-stores/class-wc-shipping-zone-data-store.php @@ -266,7 +266,10 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin * This function clears old locations, then re-inserts new if any changes are found. * * @since 3.0.0 + * * @param WC_Shipping_Zone + * + * @return bool|void */ private function save_locations( &$zone ) { $updated_props = array(); diff --git a/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php b/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php index d727f37d19c..61e2f4c8e44 100644 --- a/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php +++ b/includes/gateways/simplify-commerce/class-wc-gateway-simplify-commerce.php @@ -341,9 +341,11 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway_CC { /** * Actually saves a customer token to the database. * - * @param WC_Payment_Token $customer_token Payment Token - * @param string $cart_token CC Token - * @param array $customer_info 'email', 'name' + * @param WC_Payment_Token $customer_token Payment Token + * @param string $cart_token CC Token + * @param array $customer_info 'email', 'name' + * + * @return null|WC_Payment_Token|WC_Payment_Token_CC */ public function save_token( $customer_token, $cart_token, $customer_info ) { if ( ! is_null( $customer_token ) ) { @@ -568,6 +570,8 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway_CC { * Process the payment. * * @param int $order_id + * + * @return array|void */ public function process_payment( $order_id ) { $order = wc_get_order( $order_id ); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Authorization.php b/includes/gateways/simplify-commerce/includes/Simplify/Authorization.php index f309a657c4f..81d453b4443 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Authorization.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Authorization.php @@ -67,13 +67,13 @@ class Simplify_Authorization extends Simplify_Object { } - - - /** - * Deletes an Simplify_Authorization object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Authorization object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteAuthorization($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Coupon.php b/includes/gateways/simplify-commerce/includes/Simplify/Coupon.php index f99198599fc..54cdf5d9b51 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Coupon.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Coupon.php @@ -56,13 +56,13 @@ class Simplify_Coupon extends Simplify_Object { } - - - /** - * Deletes an Simplify_Coupon object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Coupon object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteCoupon($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Customer.php b/includes/gateways/simplify-commerce/includes/Simplify/Customer.php index 694ee744e43..72ae5f0e686 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Customer.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Customer.php @@ -75,13 +75,13 @@ class Simplify_Customer extends Simplify_Object { } - - - /** - * Deletes an Simplify_Customer object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Customer object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteCustomer($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Invoice.php b/includes/gateways/simplify-commerce/includes/Simplify/Invoice.php index 5075748107d..2c7b0626860 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Invoice.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Invoice.php @@ -91,13 +91,13 @@ class Simplify_Invoice extends Simplify_Object { } - - - /** - * Deletes an Simplify_Invoice object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Invoice object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteInvoice($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/InvoiceItem.php b/includes/gateways/simplify-commerce/includes/Simplify/InvoiceItem.php index 2d40f66b942..3d00ce97136 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/InvoiceItem.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/InvoiceItem.php @@ -54,13 +54,13 @@ class Simplify_InvoiceItem extends Simplify_Object { } - - - /** - * Deletes an Simplify_InvoiceItem object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_InvoiceItem object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteInvoiceItem($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Plan.php b/includes/gateways/simplify-commerce/includes/Simplify/Plan.php index d5a09564589..77b8c509b12 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Plan.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Plan.php @@ -57,13 +57,13 @@ class Simplify_Plan extends Simplify_Object { } - - - /** - * Deletes an Simplify_Plan object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Plan object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deletePlan($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Subscription.php b/includes/gateways/simplify-commerce/includes/Simplify/Subscription.php index e72573824b2..86c2f2a2333 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Subscription.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Subscription.php @@ -59,13 +59,13 @@ class Simplify_Subscription extends Simplify_Object { } - - - /** - * Deletes an Simplify_Subscription object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Subscription object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteSubscription($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Tax.php b/includes/gateways/simplify-commerce/includes/Simplify/Tax.php index b3a05fa1344..a893cdf1c54 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Tax.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Tax.php @@ -49,13 +49,13 @@ class Simplify_Tax extends Simplify_Object { } - - - /** - * Deletes an Simplify_Tax object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Tax object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteTax($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/TransactionReview.php b/includes/gateways/simplify-commerce/includes/Simplify/TransactionReview.php index cfea74e4069..1680a29d72d 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/TransactionReview.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/TransactionReview.php @@ -47,13 +47,13 @@ class Simplify_TransactionReview extends Simplify_Object { } - - - /** - * Deletes an Simplify_TransactionReview object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_TransactionReview object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteTransactionReview($authentication = null) { $args = func_get_args(); diff --git a/includes/gateways/simplify-commerce/includes/Simplify/Webhook.php b/includes/gateways/simplify-commerce/includes/Simplify/Webhook.php index ab32aa4cfdc..84e20cb2c13 100644 --- a/includes/gateways/simplify-commerce/includes/Simplify/Webhook.php +++ b/includes/gateways/simplify-commerce/includes/Simplify/Webhook.php @@ -48,13 +48,13 @@ class Simplify_Webhook extends Simplify_Object { } - - - /** - * Deletes an Simplify_Webhook object. - * - * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. - */ + /** + * Deletes an Simplify_Webhook object. + * + * @param $authentication - information used for the API call. If no value is passed the global keys Simplify::public_key and Simplify::private_key are used. For backwards compatibility the public and private keys may be passed instead of the authentication object. + * + * @return true + */ public function deleteWebhook($authentication = null) { $args = func_get_args(); diff --git a/includes/wc-cart-functions.php b/includes/wc-cart-functions.php index 2c3478cd034..893ca13c8c1 100644 --- a/includes/wc-cart-functions.php +++ b/includes/wc-cart-functions.php @@ -85,6 +85,8 @@ function wc_get_raw_referer() { * @param int|array $products * @param bool $show_qty Should qty's be shown? Added in 2.6.0 * @param bool $return Return message rather than add it. + * + * @return mixed|void */ function wc_add_to_cart_message( $products, $show_qty = false, $return = false ) { $titles = array(); @@ -245,8 +247,11 @@ function wc_cart_totals_taxes_total_html() { * Get a coupon label. * * @access public + * * @param string $coupon * @param bool $echo or return + * + * @return string */ function wc_cart_totals_coupon_label( $coupon, $echo = true ) { if ( is_string( $coupon ) ) { diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index cb3c1b8e605..af538d8bd01 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -211,7 +211,10 @@ function wc_get_template( $template_name, $args = array(), $template_path = '', * Like wc_get_template, but returns the HTML instead of outputting. * @see wc_get_template * @since 2.5.0 + * * @param string $template_name + * + * @return string */ function wc_get_template_html( $template_name, $args = array(), $template_path = '', $default_path = '' ) { ob_start(); diff --git a/includes/wc-stock-functions.php b/includes/wc-stock-functions.php index 6ea700002f0..14e08a8fb68 100644 --- a/includes/wc-stock-functions.php +++ b/includes/wc-stock-functions.php @@ -19,9 +19,12 @@ if ( ! defined( 'ABSPATH' ) ) { * Uses queries rather than update_post_meta so we can do this in one query (to avoid stock issues). * * @since 3.0.0 this supports set, increase and decrease. + * * @param int|WC_Product $product * @param int|null $stock_quantity * @param string $operation set, increase and decrease. + * + * @return bool|int|null */ function wc_update_product_stock( $product, $stock_quantity = null, $operation = 'set' ) { if ( ! $product = wc_get_product( $product ) ) { diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index e879e09a8c8..e984b081871 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -286,8 +286,11 @@ function wc_get_loop_class() { * Get the classes for the product cat div. * * @since 2.4.0 + * * @param string|array $class One or more classes to add to the class list. * @param object $category object Optional. + * + * @return array */ function wc_get_product_cat_class( $class = '', $category = null ) { $classes = is_array( $class ) ? $class : array_map( 'trim', explode( ' ', $class ) ); @@ -367,9 +370,12 @@ function wc_product_post_class( $classes, $class = '', $post_id = '' ) { /** * Outputs hidden form inputs for each query string variable. * @since 3.0.0 + * * @param array $values Name value pairs. * @param array $exclude Keys to exclude. * @param string $current_key Current key we are outputting. + * + * @return string */ function wc_query_string_form_fields( $values = null, $exclude = array(), $current_key = '', $return = false ) { if ( is_null( $values ) ) { @@ -1056,6 +1062,8 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) { * @param array $args Args for the input * @param WC_Product|null $product * @param boolean $echo Whether to return or echo|string + * + * @return string */ function woocommerce_quantity_input( $args = array(), $product = null, $echo = true ) { if ( is_null( $product ) ) { @@ -1876,10 +1884,13 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) { /** * Outputs a checkout/address form field. * - * @subpackage Forms + * @subpackage Forms + * * @param string $key * @param mixed $args * @param string $value (default: null) + * + * @return string */ function woocommerce_form_field( $key, $args, $value = null ) { $defaults = array( @@ -2377,9 +2388,12 @@ if ( ! function_exists( 'wc_no_products_found' ) ) { if ( ! function_exists( 'wc_get_email_order_items' ) ) { /** * Get HTML for the order items to be shown in emails. + * * @param WC_Order $order * @param array $args + * * @since 3.0.0 + * @return string */ function wc_get_email_order_items( $order, $args = array() ) { ob_start(); From 4a3902cd4899565db39a9b4a0a179f9bad8e9ee2 Mon Sep 17 00:00:00 2001 From: Rasmus Bengtsson Date: Fri, 12 May 2017 10:52:26 +0200 Subject: [PATCH 2/2] PHPDoc: Add missing throws statement --- includes/api/class-wc-rest-orders-controller.php | 2 ++ includes/api/legacy/v1/class-wc-api-coupons.php | 3 +++ includes/api/v1/class-wc-rest-orders-controller.php | 3 +++ includes/class-wc-data-store.php | 2 ++ .../data-stores/abstract-wc-order-data-store-cpt.php | 5 ++++- .../abstract-wc-order-item-type-data-store.php | 3 +++ includes/data-stores/class-wc-coupon-data-store-cpt.php | 5 ++++- includes/data-stores/class-wc-customer-data-store.php | 5 ++++- .../class-wc-customer-download-data-store.php | 4 +++- .../data-stores/class-wc-payment-token-data-store.php | 9 +++++++++ includes/data-stores/class-wc-product-data-store-cpt.php | 5 ++++- .../class-wc-product-variation-data-store-cpt.php | 5 ++++- .../data-stores/class-wc-shipping-zone-data-store.php | 5 ++++- 13 files changed, 49 insertions(+), 7 deletions(-) diff --git a/includes/api/class-wc-rest-orders-controller.php b/includes/api/class-wc-rest-orders-controller.php index 5e0d48230c7..15f6cdae9b5 100644 --- a/includes/api/class-wc-rest-orders-controller.php +++ b/includes/api/class-wc-rest-orders-controller.php @@ -544,7 +544,9 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller { * Gets the product ID from the SKU or posted ID. * * @param array $posted Request data + * * @return int + * @throws WC_REST_Exception */ protected function get_product_id( $posted ) { if ( ! empty( $posted['sku'] ) ) { diff --git a/includes/api/legacy/v1/class-wc-api-coupons.php b/includes/api/legacy/v1/class-wc-api-coupons.php index 5257652cff6..de0fefa9734 100644 --- a/includes/api/legacy/v1/class-wc-api-coupons.php +++ b/includes/api/legacy/v1/class-wc-api-coupons.php @@ -91,9 +91,12 @@ class WC_API_Coupons extends WC_API_Resource { * Get the coupon for the given ID * * @since 2.1 + * * @param int $id the coupon ID * @param string $fields fields to include in response + * * @return array|WP_Error + * @throws WC_API_Exception */ public function get_coupon( $id, $fields = null ) { $id = $this->validate_request( $id, 'shop_coupon', 'read' ); diff --git a/includes/api/v1/class-wc-rest-orders-controller.php b/includes/api/v1/class-wc-rest-orders-controller.php index 99613982bf9..1cb891051b6 100644 --- a/includes/api/v1/class-wc-rest-orders-controller.php +++ b/includes/api/v1/class-wc-rest-orders-controller.php @@ -601,8 +601,11 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { /** * Gets the product ID from the SKU or posted ID. + * * @param array $posted Request data + * * @return int + * @throws WC_REST_Exception */ protected function get_product_id( $posted ) { if ( ! empty( $posted['sku'] ) ) { diff --git a/includes/class-wc-data-store.php b/includes/class-wc-data-store.php index 9c88f550186..a4beeea738b 100644 --- a/includes/class-wc-data-store.php +++ b/includes/class-wc-data-store.php @@ -65,6 +65,8 @@ class WC_Data_Store { * store we want to work with. * * @param string $object_type Name of object. + * + * @throws Exception */ public function __construct( $object_type ) { $this->object_type = $object_type; diff --git a/includes/data-stores/abstract-wc-order-data-store-cpt.php b/includes/data-stores/abstract-wc-order-data-store-cpt.php index 4aedd9f9cad..e9ec665554f 100644 --- a/includes/data-stores/abstract-wc-order-data-store-cpt.php +++ b/includes/data-stores/abstract-wc-order-data-store-cpt.php @@ -77,7 +77,10 @@ abstract class Abstract_WC_Order_Data_Store_CPT extends WC_Data_Store_WP impleme /** * Method to read an order from the database. - * @param WC_Order + * + * @param WC_Data $order + * + * @throws Exception */ public function read( &$order ) { $order->set_defaults(); diff --git a/includes/data-stores/abstract-wc-order-item-type-data-store.php b/includes/data-stores/abstract-wc-order-item-type-data-store.php index 13c05c45ab5..83ec7a467c0 100644 --- a/includes/data-stores/abstract-wc-order-item-type-data-store.php +++ b/includes/data-stores/abstract-wc-order-item-type-data-store.php @@ -98,7 +98,10 @@ abstract class Abstract_WC_Order_Item_Type_Data_Store extends WC_Data_Store_WP i * Read a order item from the database. * * @since 3.0.0 + * * @param WC_Order_Item $item + * + * @throws Exception */ public function read( &$item ) { global $wpdb; diff --git a/includes/data-stores/class-wc-coupon-data-store-cpt.php b/includes/data-stores/class-wc-coupon-data-store-cpt.php index f0be9e30946..812bbb16a21 100644 --- a/includes/data-stores/class-wc-coupon-data-store-cpt.php +++ b/includes/data-stores/class-wc-coupon-data-store-cpt.php @@ -81,7 +81,10 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat * Method to read a coupon. * * @since 3.0.0 - * @param WC_Coupon + * + * @param WC_Data $coupon + * + * @throws Exception */ public function read( &$coupon ) { $coupon->set_defaults(); diff --git a/includes/data-stores/class-wc-customer-data-store.php b/includes/data-stores/class-wc-customer-data-store.php index b3b8f407ada..2fd8e3c0a89 100644 --- a/includes/data-stores/class-wc-customer-data-store.php +++ b/includes/data-stores/class-wc-customer-data-store.php @@ -91,7 +91,10 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat * Method to create a new customer in the database. * * @since 3.0.0 - * @param WC_Customer + * + * @param WC_Data $customer + * + * @throws WC_Data_Exception */ public function create( &$customer ) { $id = wc_create_new_customer( $customer->get_email(), $customer->get_username(), $customer->get_password() ); diff --git a/includes/data-stores/class-wc-customer-download-data-store.php b/includes/data-stores/class-wc-customer-download-data-store.php index abeb077294f..f55fe4e2bc4 100644 --- a/includes/data-stores/class-wc-customer-download-data-store.php +++ b/includes/data-stores/class-wc-customer-download-data-store.php @@ -68,7 +68,9 @@ class WC_Customer_Download_Data_Store implements WC_Customer_Download_Data_Store /** * Method to read a download permission from the database. * - * @param WC_Customer_Download + * @param $download + * + * @throws Exception */ public function read( &$download ) { global $wpdb; diff --git a/includes/data-stores/class-wc-payment-token-data-store.php b/includes/data-stores/class-wc-payment-token-data-store.php index c6e72017019..72ac6741f45 100644 --- a/includes/data-stores/class-wc-payment-token-data-store.php +++ b/includes/data-stores/class-wc-payment-token-data-store.php @@ -27,7 +27,10 @@ class WC_Payment_Token_Data_Store extends WC_Data_Store_WP implements WC_Payment * Create a new payment token in the database. * * @since 3.0.0 + * * @param WC_Payment_Token $token + * + * @throws Exception */ public function create( &$token ) { if ( false === $token->validate() ) { @@ -68,7 +71,10 @@ class WC_Payment_Token_Data_Store extends WC_Data_Store_WP implements WC_Payment * Update a payment token. * * @since 3.0.0 + * * @param WC_Payment_Token $token + * + * @throws Exception */ public function update( &$token ) { if ( false === $token->validate() ) { @@ -129,7 +135,10 @@ class WC_Payment_Token_Data_Store extends WC_Data_Store_WP implements WC_Payment * Read a token from the database. * * @since 3.0.0 + * * @param WC_Payment_Token $token + * + * @throws Exception */ public function read( &$token ) { global $wpdb; diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index 5f758d98b4a..b6e09fb0d92 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -124,7 +124,10 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da /** * Method to read a product from the database. - * @param WC_Product + * + * @param WC_Data $product + * + * @throws Exception */ public function read( &$product ) { $product->set_defaults(); diff --git a/includes/data-stores/class-wc-product-variation-data-store-cpt.php b/includes/data-stores/class-wc-product-variation-data-store-cpt.php index 80ef0148fa8..9c1b775f5c9 100644 --- a/includes/data-stores/class-wc-product-variation-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-variation-data-store-cpt.php @@ -32,7 +32,10 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl * Reads a product from the database and sets its data to the class. * * @since 3.0.0 - * @param WC_Product + * + * @param WC_Data $product + * + * @throws Exception */ public function read( &$product ) { $product->set_defaults(); diff --git a/includes/data-stores/class-wc-shipping-zone-data-store.php b/includes/data-stores/class-wc-shipping-zone-data-store.php index 5af1a1c7ce4..e29c3bac14a 100644 --- a/includes/data-stores/class-wc-shipping-zone-data-store.php +++ b/includes/data-stores/class-wc-shipping-zone-data-store.php @@ -57,7 +57,10 @@ class WC_Shipping_Zone_Data_Store extends WC_Data_Store_WP implements WC_Shippin * Method to read a shipping zone from the database. * * @since 3.0.0 - * @param WC_Shipping_Zone + * + * @param WC_Data $zone + * + * @throws Exception */ public function read( &$zone ) { global $wpdb;