Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.x] Supports PHP 8.4 #284

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: fix code styling

on:
push:
workflow_dispatch:

jobs:
pint:
uses: laravel/.github/.github/workflows/coding-standards.yml@main
with:
message: "Pint: fix code styling"
9 changes: 5 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.1, 8.2, 8.3]
php: [8.1, 8.2, 8.3, 8.4]
laravel: [10, 11]
exclude:
- php: 8.1
laravel: 11
- php: 8.4
laravel: 10

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

Expand All @@ -39,11 +41,10 @@ jobs:

- name: Install dependencies
run: |
composer require "illuminate/contracts=^${{ matrix.laravel }}" --no-update
composer update --prefer-dist --no-interaction --no-progress
composer update --prefer-dist --no-interaction --no-progress --with="illuminate/contracts=^${{ matrix.laravel }}"

- name: Execute tests
run: vendor/bin/phpunit
run: vendor/bin/phpunit --display-deprecations --fail-on-deprecation
env:
PADDLE_SELLER_ID: ${{ secrets.PADDLE_SELLER_ID }}
PADDLE_API_KEY: ${{ secrets.PADDLE_API_KEY }}
Expand Down
9 changes: 1 addition & 8 deletions src/Cashier.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class Cashier
* Preview prices for a given set of items.
*
* @param array|string $items
* @param array $options
* @return \Illuminate\Support\Collection
*/
public static function previewPrices($items, array $options = [])
Expand Down Expand Up @@ -108,7 +107,6 @@ public static function webhookUrl()
*
* @param string $method
* @param string $uri
* @param array|null $payload
* @return \Illuminate\Http\Client\Response
*
* @throws \Laravel\Paddle\Exceptions\PaddleException
Expand Down Expand Up @@ -154,8 +152,6 @@ public static function apiUrl()
* Normalize the given items to a Paddle accepted format.
*
* @param array|string $items
* @param string $priceKey
* @return array
*/
public static function normalizeItems($items, string $priceKey = 'price_id'): array
{
Expand All @@ -181,7 +177,6 @@ public static function normalizeItems($items, string $priceKey = 'price_id'): ar
/**
* Set the custom currency formatter.
*
* @param callable $callback
* @return void
*/
public static function formatCurrencyUsing(callable $callback)
Expand All @@ -195,7 +190,6 @@ public static function formatCurrencyUsing(callable $callback)
* @param int $amount
* @param string $currency
* @param string|null $locale
* @param array $options
* @return string
*/
public static function formatAmount($amount, $currency, $locale = null, array $options = [])
Expand All @@ -214,15 +208,14 @@ public static function formatAmount($amount, $currency, $locale = null, array $o
$numberFormatter->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, $options['min_fraction_digits']);
}

$moneyFormatter = new IntlMoneyFormatter($numberFormatter, new ISOCurrencies());
$moneyFormatter = new IntlMoneyFormatter($numberFormatter, new ISOCurrencies);

return $moneyFormatter->format($money);
}

/**
* Determine if the given currency uses cents.
*
* @param \Money\Currency $currency
* @return bool
*/
public static function currencyUsesCents(Currency $currency)
Expand Down
8 changes: 0 additions & 8 deletions src/CashierFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class CashierFake
/**
* Initialize the fake instance and fake Cashier's events and API calls.
*
* @param array $endpoints
* @param string|array $events
* @return void
*/
Expand Down Expand Up @@ -65,8 +64,6 @@ public static function fake(...$arguments)
/**
* Set the successful response for a given endpoint.
*
* @param string $endpoint
* @param array $data
* @return self
*/
public function response(string $endpoint, array $data)
Expand All @@ -81,7 +78,6 @@ public function response(string $endpoint, array $data)
/**
* Set an error response for a given endpoint.
*
* @param string $endpoint
* @param string $message
* @param int $code
* @return self
Expand All @@ -100,7 +96,6 @@ public function error(string $endpoint, $message = '', $code = 0)
/**
* Fake the given endpoint with the provided response.
*
* @param string $endpoint
* @param mixed $response
* @return void
*/
Expand All @@ -119,9 +114,6 @@ protected function fakeHttpResponse(string $endpoint, $response)

/**
* Format the given path into a full API url.
*
* @param string $path
* @return string
*/
public static function getFormattedApiUrl(string $path): string
{
Expand Down
1 change: 0 additions & 1 deletion src/Concerns/ManagesCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public function customer()
* Get price previews for a set of price ids for this billable model.
*
* @param array|string $items
* @param array $options
* @return \Illuminate\Support\Collection
*/
public function previewPrices($items, array $options = [])
Expand Down
9 changes: 0 additions & 9 deletions src/Concerns/PerformsCharges.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ trait PerformsCharges
* Get a checkout instance for a given list of prices.
*
* @param string|array $prices
* @param int $quantity
* @return \Laravel\Paddle\Checkout
*/
public function checkout($prices, int $quantity = 1)
Expand All @@ -27,7 +26,6 @@ public function checkout($prices, int $quantity = 1)
* Subscribe the customer to a new plan variant.
*
* @param string|array $prices
* @param string $type
* @return \Laravel\Paddle\Checkout
*/
public function subscribe($prices, string $type = Subscription::DEFAULT_TYPE)
Expand All @@ -38,9 +36,6 @@ public function subscribe($prices, string $type = Subscription::DEFAULT_TYPE)
/**
* Subscribe the customer to a new product.
*
* @param int $amount
* @param string $name
* @param string $type
* @return \Laravel\Paddle\SubscriptionBuilder
*/
public function newSubscription(int $amount, string $name, string $type = Subscription::DEFAULT_TYPE)
Expand All @@ -51,9 +46,6 @@ public function newSubscription(int $amount, string $name, string $type = Subscr
/**
* Creates a transaction for a "one off" charge for the given amount and returns a checkout instance.
*
* @param int $amount
* @param string $name
* @param array $options
* @return \Laravel\Paddle\Checkout
*/
public function charge(int $amount, string $name, array $options = [])
Expand All @@ -77,7 +69,6 @@ public function charge(int $amount, string $name, array $options = [])
/**
* Creates a transaction for a "one off" charge for the given items and returns a checkout instance.
*
* @param array $items
* @return \Laravel\Paddle\Checkout
*/
public function chargeMany(array $items)
Expand Down
3 changes: 0 additions & 3 deletions src/Events/CustomerUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class CustomerUpdated
/**
* Create a new event instance.
*
* @param \Illuminate\Database\Eloquent\Model $billable
* @param \Laravel\Paddle\Customer $customer
* @param array $payload
* @return void
*/
public function __construct(Model $billable, Customer $customer, array $payload)
Expand Down
2 changes: 0 additions & 2 deletions src/Events/SubscriptionCanceled.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class SubscriptionCanceled
/**
* Create a new event instance.
*
* @param \Laravel\Paddle\Subscription $subscription
* @param array $payload
* @return void
*/
public function __construct(Subscription $subscription, array $payload)
Expand Down
3 changes: 0 additions & 3 deletions src/Events/SubscriptionCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class SubscriptionCreated
/**
* Create a new event instance.
*
* @param \Illuminate\Database\Eloquent\Model $billable
* @param \Laravel\Paddle\Subscription $subscription
* @param array $payload
* @return void
*/
public function __construct(Model $billable, Subscription $subscription, array $payload)
Expand Down
2 changes: 0 additions & 2 deletions src/Events/SubscriptionPaused.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class SubscriptionPaused
/**
* Create a new event instance.
*
* @param \Laravel\Paddle\Subscription $subscription
* @param array $payload
* @return void
*/
public function __construct(Subscription $subscription, array $payload)
Expand Down
2 changes: 0 additions & 2 deletions src/Events/SubscriptionUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ class SubscriptionUpdated
/**
* Create a new event instance.
*
* @param \Laravel\Paddle\Subscription $subscription
* @param array $payload
* @return void
*/
public function __construct(Subscription $subscription, array $payload)
Expand Down
3 changes: 0 additions & 3 deletions src/Events/TransactionCompleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class TransactionCompleted
/**
* Create a new event instance.
*
* @param \Illuminate\Database\Eloquent\Model $billable
* @param \Laravel\Paddle\Transaction $transaction
* @param array $payload
* @return void
*/
public function __construct(Model $billable, Transaction $transaction, array $payload)
Expand Down
3 changes: 0 additions & 3 deletions src/Events/TransactionUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class TransactionUpdated
/**
* Create a new event instance.
*
* @param \Illuminate\Database\Eloquent\Model $billable
* @param \Laravel\Paddle\Transaction $transaction
* @param array $payload
* @return void
*/
public function __construct(Model $billable, Transaction $transaction, array $payload)
Expand Down
1 change: 0 additions & 1 deletion src/Events/WebhookHandled.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class WebhookHandled
/**
* Create a new event instance.
*
* @param array $payload
* @return void
*/
public function __construct(array $payload)
Expand Down
1 change: 0 additions & 1 deletion src/Events/WebhookReceived.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class WebhookReceived
/**
* Create a new event instance.
*
* @param array $payload
* @return void
*/
public function __construct(array $payload)
Expand Down
7 changes: 0 additions & 7 deletions src/Exceptions/PaddleException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ class PaddleException extends Exception
{
/**
* The error response from Paddle.
*
* @var array
*/
protected array $error = [];

/**
* Get the error response from Paddle.
*
* @return array
*/
public function getError(): array
{
Expand All @@ -25,9 +21,6 @@ public function getError(): array

/**
* Set the error response from Paddle.
*
* @param array $error
* @return self
*/
public function setError(array $error): self
{
Expand Down
Loading
Loading