More docblocks; the check for WP_POST isn't needed as the second case (isset) runs regardless and is true for posts

This commit is contained in:
Mike Jolley 2015-02-03 13:13:07 +00:00
parent c038001eab
commit 7c019c0c50
3 changed files with 7 additions and 9 deletions

View File

@ -37,7 +37,7 @@
* @property string $shipping_method_title < 2.1 was used for shipping method title. Now @deprecated.
* @property int $customer_user User ID who the order belongs to. 0 for guests.
* @property string $order_key Random key/password unqique to each order.
* @property string $order_discount. Stored after tax discounts pre-2.3. Now @deprecated.
* @property string $order_discount Stored after tax discounts pre-2.3. Now @deprecated.
* @property string $order_tax Stores order tax total.
* @property string $order_shipping_tax Stores shipping tax total.
* @property string $order_shipping Stores shipping total.
@ -108,8 +108,7 @@ abstract class WC_Abstract_Order {
/**
* Init/load the order object. Called from the constructor.
*
* @var WP_Post
* @param int|WP_Post|WC_Order $order Order to init
* @param int|object|WC_Order $order Order to init
*/
protected function init( $order ) {
if ( is_numeric( $order ) ) {
@ -120,7 +119,7 @@ abstract class WC_Abstract_Order {
$this->id = absint( $order->id );
$this->post = $order->post;
$this->get_order( $this->id );
} elseif ( $order instanceof WP_Post || isset( $order->ID ) ) {
} elseif ( isset( $order->ID ) {
$this->id = absint( $order->ID );
$this->post = $order;
$this->get_order( $this->id );

View File

@ -59,8 +59,7 @@ class WC_Product {
/**
* Constructor gets the post object and sets the ID for the loaded product.
*
* @param int|WC_Product|WP_Post $product Product ID, post object, or product object
* @var WP_POST
* @param int|WC_Product|object $product Product ID, post object, or product object
*/
public function __construct( $product ) {
if ( is_numeric( $product ) ) {
@ -69,7 +68,7 @@ class WC_Product {
} elseif ( $product instanceof WC_Product ) {
$this->id = absint( $product->id );
$this->post = $product->post;
} elseif ( $product instanceof WP_Post || isset( $product->ID ) ) {
} elseif ( isset( $product->ID ) ) {
$this->id = absint( $product->ID );
$this->post = $product;
}

View File

@ -2,8 +2,8 @@
/**
* Shows an order item fee
*
* @var int $item_id The id of the item being displayed
* @var object $item The item being displayed
* @var $item_id int The id of the item being displayed
* @var $item object The item being displayed
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;