fix bug, add type hints, fix annotations
This commit is contained in:
parent
6f76bb4a97
commit
a06bca38d4
|
|
@ -9,7 +9,7 @@ class AppointmentSlot extends Booking
|
|||
* @param \Webkul\BookingProduct\Contracts\BookingProduct $bookingProduct
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty, $bookingProduct)
|
||||
public function haveSufficientQuantity(int $qty, $bookingProduct): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class Booking extends Virtual
|
|||
* @param int $qty
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty)
|
||||
public function haveSufficientQuantity(int $qty): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -795,7 +795,13 @@ class Cart
|
|||
*/
|
||||
public function isItemsHaveSufficientQuantity(): bool
|
||||
{
|
||||
foreach ($this->getCart()->items as $item) {
|
||||
$cart = cart()->getCart();
|
||||
|
||||
if (! $cart) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($cart->items as $item) {
|
||||
if (! $this->isItemHaveQuantity($item)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -261,11 +261,11 @@ class Product extends Model implements ProductContract
|
|||
}
|
||||
|
||||
/**
|
||||
* @param integer $qty
|
||||
* @param int $qty
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty)
|
||||
public function haveSufficientQuantity(int $qty): bool
|
||||
{
|
||||
return $this->getTypeInstance()->haveSufficientQuantity($qty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ class ProductFlat extends Model implements ProductFlatContract
|
|||
}
|
||||
|
||||
/**
|
||||
* @param integer $qty
|
||||
* @param int $qty
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty)
|
||||
public function haveSufficientQuantity(int $qty): bool
|
||||
{
|
||||
return $this->product->haveSufficientQuantity($qty);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ abstract class AbstractType
|
|||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty)
|
||||
public function haveSufficientQuantity(int $qty): bool
|
||||
{
|
||||
return $this->haveSufficientQuantity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -685,7 +685,15 @@ class Bundle extends AbstractType
|
|||
}
|
||||
|
||||
foreach ($item->children as $childItem) {
|
||||
$childItem->product->getTypeInstance()->validateCartItem($childItem);
|
||||
$childResult = $childItem->product->getTypeInstance()->validateCartItem($childItem);
|
||||
|
||||
if ($childResult->isItemInactive()) {
|
||||
$result->itemIsInactive();
|
||||
}
|
||||
|
||||
if ($childResult->isCartDirty()) {
|
||||
$result->cartIsDirty();
|
||||
}
|
||||
|
||||
$price += $childItem->base_price * $childItem->quantity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -592,7 +592,7 @@ class Configurable extends AbstractType
|
|||
* @param int $qty
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty)
|
||||
public function haveSufficientQuantity(int $qty): bool
|
||||
{
|
||||
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Simple extends AbstractType
|
|||
* @param int $qty
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty)
|
||||
public function haveSufficientQuantity(int $qty): bool
|
||||
{
|
||||
$backorders = core()->getConfigData('catalog.inventory.stock_options.backorders');
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class Virtual extends AbstractType
|
|||
* @param int $qty
|
||||
* @return bool
|
||||
*/
|
||||
public function haveSufficientQuantity($qty)
|
||||
public function haveSufficientQuantity(int $qty): bool
|
||||
{
|
||||
return $qty <= $this->totalQuantity() ? true : false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue