Skip to content

Commit

Permalink
Added the ?CheckoutSubject return type to Checkout::getCart()
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Dec 6, 2023
1 parent 5729834 commit a7224a8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
- Added the `units_sold` and the `last_sale_at` attributes to the master product model (SUM/MAX from variants)
- Added the `Stockable` interface (Contracts)
- Added the `Stockable` interface to the `Product` and `MasterProductVariant` models
- Added the `backorder` field to products and product variants
- Added the `backorder` field to products and product variants
- BC: Added the `?CheckoutSubject` return type to the `getCart()` method of the `Checkout` interface
- Fixed possible null return type on Billpayer::getName() when is_organization is true but the company name is null

## 3.x Series
Expand Down
1 change: 1 addition & 0 deletions src/Checkout/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Dropped Laravel 9 Support
- Dropped Enum v3 Support
- Changed minimal Enum requirement to v4.1
- BC: Added the `?CheckoutSubject` return type to the `getCart()` method of the `Checkout` interface

## 3.x Series

Expand Down
2 changes: 1 addition & 1 deletion src/Checkout/CheckoutManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __get(string $name)
/**
* @inheritDoc
*/
public function getCart()
public function getCart(): ?CheckoutSubject
{
return $this->store->getCart();
}
Expand Down
7 changes: 1 addition & 6 deletions src/Checkout/Contracts/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@

interface Checkout
{
/**
* Returns the cart
* @todo add typehint in v4
* @return CheckoutSubject|null
*/
public function getCart();
public function getCart(): ?CheckoutSubject;

/**
* Set the cart for the checkout
Expand Down
2 changes: 1 addition & 1 deletion src/Checkout/Drivers/BaseCheckoutStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(
) {
}

public function getCart()
public function getCart(): ?CheckoutSubject
{
return $this->cart;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Checkout/Tests/Example/MemoryStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __get(string $name)
}
}

public function getCart()
public function getCart(): ?CheckoutSubject
{
return $this->cart;
}
Expand Down

0 comments on commit a7224a8

Please sign in to comment.