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

Drop support for php7.4 #34

Merged
merged 2 commits into from
Oct 30, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.0, 7.4]
php: [8.3, 8.2, 8.1]
stability: [prefer-stable]

name: PHP${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
Expand Down
17 changes: 7 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
}
],
"require": {
"php": "^7.4|^8.0|^8.1",
"php": "^8.1|^8.2|^8.3",
"ext-json": "*",
"brick/money": "^0.5.2",
"phpjuice/paypal-http-client": "^1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.4",
"phpstan/phpstan": "^0.12",
"pestphp/pest": "^1.18"
"laravel/pint": "^1.18",
"pestphp/pest": "^1.18",
"phpstan/phpstan": "^0.12"
},
"autoload": {
"psr-4": {
Expand All @@ -41,16 +41,13 @@
"prefer-stable": true,
"scripts": {
"test": "vendor/bin/pest --colors=always",
"analyse": "phpstan analyse --ansi --debug",
"php-cs-fixer": [
"php-cs-fixer fix src --rules=@PSR2",
"php-cs-fixer fix tests --rules=@PSR2"
]
"pint": "./vendor/bin/pint",
"analyse": "phpstan analyse --ansi --debug"
},
"config": {
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
}
}
}
4 changes: 1 addition & 3 deletions src/Concerns/CastsToJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,15 @@ public function __toString()
/**
* Convert the model instance to JSON.
*
* @param int $options
*
* @return string
*
* @throws JsonEncodingException
*/
public function toJson(int $options = 0): string
{
$json = json_encode($this->toArray(), $options);

if (JSON_ERROR_NONE !== json_last_error() || !$json) {
if (json_last_error() !== JSON_ERROR_NONE || ! $json) {
throw new JsonEncodingException(json_last_error_msg());
}

Expand Down
13 changes: 2 additions & 11 deletions src/Concerns/HasCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ trait HasCollection
/**
* Determine if an attribute or relation exists on the model.
*
* @param string $key
*
* @return bool
*/
Expand All @@ -20,9 +19,6 @@ public function __isset(string $key)

/**
* Determine if a key exists on the items.
*
* @param string $offset
* @return bool
*/
public function offsetExists(string $offset): bool
{
Expand All @@ -32,7 +28,6 @@ public function offsetExists(string $offset): bool
/**
* Unset an attribute on the model.
*
* @param string $key
*
* @return void
*/
Expand All @@ -44,7 +39,6 @@ public function __unset(string $key)
/**
* Unset an attribute on the model.
*
* @param string $offset
* @return void
*/
public function offsetUnset(string $offset)
Expand All @@ -53,8 +47,8 @@ public function offsetUnset(string $offset)
}

/**
* @param mixed $offset
* @param mixed $value
* @param mixed $offset
* @param mixed $value
* @return void
*/
public function offsetSet($offset, $value)
Expand All @@ -67,7 +61,6 @@ public function offsetSet($offset, $value)
}

/**
* @param string $offset
* @return mixed|Item|null
*/
public function offsetGet(string $offset)
Expand All @@ -77,8 +70,6 @@ public function offsetGet(string $offset)

/**
* Determine if the purchase unit is empty or not.
*
* @return bool
*/
public function isEmpty(): bool
{
Expand Down
11 changes: 0 additions & 11 deletions src/Contracts/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,15 @@ interface Amount
{
/**
* convert amount to an array.
* @return array
*/
public function toArray(): array;

/**
* @return string
*/
public function getCurrencyCode(): string;

/**
* @return string
*/
public function getValue(): string;

/**
* Convert the object to its JSON representation.
*
* @param int $options
*
* @return string
*/
public function toJson(int $options = 0): string;
}
2 changes: 0 additions & 2 deletions src/Contracts/Arrayable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ interface Arrayable
{
/**
* Get the instance as an array.
*
* @return array
*/
public function toArray(): array;
}
4 changes: 0 additions & 4 deletions src/Contracts/Jsonable.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ interface Jsonable
{
/**
* Convert the object to its JSON representation.
*
* @param int $options
*
* @return string
*/
public function toJson(int $options = 0): string;
}
2 changes: 1 addition & 1 deletion src/Exceptions/InvalidOrderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class InvalidOrderException extends RuntimeException
{
public static function invalidPurchaseUnit(): InvalidOrderException
{
return new self("Paypal orders must have 1 purchase_unit at least.");
return new self('Paypal orders must have 1 purchase_unit at least.');
}
}
4 changes: 1 addition & 3 deletions src/Exceptions/JsonEncodingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use RuntimeException;

class JsonEncodingException extends RuntimeException
{
}
class JsonEncodingException extends RuntimeException {}
15 changes: 1 addition & 14 deletions src/Orders/Amount.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@ class Amount implements AmountContract

/**
* The three-character ISO-4217 currency code that identifies the currency.
*
* @var Money
*/
protected Money $money;

/**
* create a new amount instance.
* @param string $value
* @param string $currency_code
*
* @throws UnknownCurrencyException
*/
public function __construct(string $value, string $currency_code = 'USD')
Expand All @@ -33,9 +30,6 @@ public function __construct(string $value, string $currency_code = 'USD')
}

/**
* @param string $value
* @param string $currency_code
* @return Amount
* @throws UnknownCurrencyException
*/
public static function of(string $value, string $currency_code = 'USD'): Amount
Expand All @@ -45,7 +39,6 @@ public static function of(string $value, string $currency_code = 'USD'): Amount

/**
* convert amount to an array.
* @return array
*/
public function toArray(): array
{
Expand All @@ -55,17 +48,11 @@ public function toArray(): array
];
}

/**
* @return string
*/
public function getCurrencyCode(): string
{
return $this->money->getCurrency()->getCurrencyCode();
}

/**
* @return string
*/
public function getValue(): string
{
return (string) $this->money->getAmount();
Expand Down
9 changes: 1 addition & 8 deletions src/Orders/AmountBreakdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@ class AmountBreakdown extends Amount
* The subtotal for all items. Required if the request includes purchase_units[].items[].unit_amount.
* Must equal the sum of (items[].unit_amount * items[].quantity) for all items.
* item_total.value can not be a negative number.
* @var Money
*/
protected Money $item_total;

/**
* The discount for all items within a given purchase_unit. discount.value can not be a negative number.
* @var Money|null
*/
protected ?Money $discount = null;

/**
* create a new AmountBreakdown instance.
* @param string $value
* @param string $currency_code
*
* @throws UnknownCurrencyException
*/
public function __construct(string $value, string $currency_code = 'USD')
Expand All @@ -37,9 +34,6 @@ public function __construct(string $value, string $currency_code = 'USD')
}

/**
* @param string $value
* @param string $currency_code
* @return AmountBreakdown
* @throws UnknownCurrencyException
*/
public static function of(string $value, string $currency_code = 'USD'): self
Expand All @@ -49,7 +43,6 @@ public static function of(string $value, string $currency_code = 'USD'): self

/**
* Get the instance as an array.
* @return array
*/
public function toArray(): array
{
Expand Down
Loading
Loading