PHPDoc: Add missing throws statement

This commit is contained in:
Rasmus Bengtsson 2017-05-12 10:52:26 +02:00
parent 4f00d7e5e3
commit 4a3902cd48
13 changed files with 49 additions and 7 deletions

View File

@ -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. * Gets the product ID from the SKU or posted ID.
* *
* @param array $posted Request data * @param array $posted Request data
*
* @return int * @return int
* @throws WC_REST_Exception
*/ */
protected function get_product_id( $posted ) { protected function get_product_id( $posted ) {
if ( ! empty( $posted['sku'] ) ) { if ( ! empty( $posted['sku'] ) ) {

View File

@ -91,9 +91,12 @@ class WC_API_Coupons extends WC_API_Resource {
* Get the coupon for the given ID * Get the coupon for the given ID
* *
* @since 2.1 * @since 2.1
*
* @param int $id the coupon ID * @param int $id the coupon ID
* @param string $fields fields to include in response * @param string $fields fields to include in response
*
* @return array|WP_Error * @return array|WP_Error
* @throws WC_API_Exception
*/ */
public function get_coupon( $id, $fields = null ) { public function get_coupon( $id, $fields = null ) {
$id = $this->validate_request( $id, 'shop_coupon', 'read' ); $id = $this->validate_request( $id, 'shop_coupon', 'read' );

View File

@ -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. * Gets the product ID from the SKU or posted ID.
*
* @param array $posted Request data * @param array $posted Request data
*
* @return int * @return int
* @throws WC_REST_Exception
*/ */
protected function get_product_id( $posted ) { protected function get_product_id( $posted ) {
if ( ! empty( $posted['sku'] ) ) { if ( ! empty( $posted['sku'] ) ) {

View File

@ -65,6 +65,8 @@ class WC_Data_Store {
* store we want to work with. * store we want to work with.
* *
* @param string $object_type Name of object. * @param string $object_type Name of object.
*
* @throws Exception
*/ */
public function __construct( $object_type ) { public function __construct( $object_type ) {
$this->object_type = $object_type; $this->object_type = $object_type;

View File

@ -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. * Method to read an order from the database.
* @param WC_Order *
* @param WC_Data $order
*
* @throws Exception
*/ */
public function read( &$order ) { public function read( &$order ) {
$order->set_defaults(); $order->set_defaults();

View File

@ -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. * Read a order item from the database.
* *
* @since 3.0.0 * @since 3.0.0
*
* @param WC_Order_Item $item * @param WC_Order_Item $item
*
* @throws Exception
*/ */
public function read( &$item ) { public function read( &$item ) {
global $wpdb; global $wpdb;

View File

@ -81,7 +81,10 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
* Method to read a coupon. * Method to read a coupon.
* *
* @since 3.0.0 * @since 3.0.0
* @param WC_Coupon *
* @param WC_Data $coupon
*
* @throws Exception
*/ */
public function read( &$coupon ) { public function read( &$coupon ) {
$coupon->set_defaults(); $coupon->set_defaults();

View File

@ -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. * Method to create a new customer in the database.
* *
* @since 3.0.0 * @since 3.0.0
* @param WC_Customer *
* @param WC_Data $customer
*
* @throws WC_Data_Exception
*/ */
public function create( &$customer ) { public function create( &$customer ) {
$id = wc_create_new_customer( $customer->get_email(), $customer->get_username(), $customer->get_password() ); $id = wc_create_new_customer( $customer->get_email(), $customer->get_username(), $customer->get_password() );

View File

@ -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. * Method to read a download permission from the database.
* *
* @param WC_Customer_Download * @param $download
*
* @throws Exception
*/ */
public function read( &$download ) { public function read( &$download ) {
global $wpdb; global $wpdb;

View File

@ -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. * Create a new payment token in the database.
* *
* @since 3.0.0 * @since 3.0.0
*
* @param WC_Payment_Token $token * @param WC_Payment_Token $token
*
* @throws Exception
*/ */
public function create( &$token ) { public function create( &$token ) {
if ( false === $token->validate() ) { 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. * Update a payment token.
* *
* @since 3.0.0 * @since 3.0.0
*
* @param WC_Payment_Token $token * @param WC_Payment_Token $token
*
* @throws Exception
*/ */
public function update( &$token ) { public function update( &$token ) {
if ( false === $token->validate() ) { 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. * Read a token from the database.
* *
* @since 3.0.0 * @since 3.0.0
*
* @param WC_Payment_Token $token * @param WC_Payment_Token $token
*
* @throws Exception
*/ */
public function read( &$token ) { public function read( &$token ) {
global $wpdb; global $wpdb;

View File

@ -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. * Method to read a product from the database.
* @param WC_Product *
* @param WC_Data $product
*
* @throws Exception
*/ */
public function read( &$product ) { public function read( &$product ) {
$product->set_defaults(); $product->set_defaults();

View File

@ -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. * Reads a product from the database and sets its data to the class.
* *
* @since 3.0.0 * @since 3.0.0
* @param WC_Product *
* @param WC_Data $product
*
* @throws Exception
*/ */
public function read( &$product ) { public function read( &$product ) {
$product->set_defaults(); $product->set_defaults();

View File

@ -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. * Method to read a shipping zone from the database.
* *
* @since 3.0.0 * @since 3.0.0
* @param WC_Shipping_Zone *
* @param WC_Data $zone
*
* @throws Exception
*/ */
public function read( &$zone ) { public function read( &$zone ) {
global $wpdb; global $wpdb;