Skip to content

Commit 9033e05

Browse files
authored
Drop support for php7.4 (#34)
1 parent 993c42c commit 9033e05

29 files changed

+183
-295
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A clear and concise description of what the bug is.
1212

1313
**To Reproduce**
1414
Steps to reproduce the behavior:
15+
1516
1. Go to '...'
1617
2. Click on '....'
1718
3. Scroll down to '....'

.github/workflows/php.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
os: [ubuntu-latest, windows-latest]
12-
php: [8.1, 8.0, 7.4]
12+
php: [8.3, 8.2, 8.1]
1313
stability: [prefer-stable]
1414

1515
name: PHP${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

composer.json

+7-10
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^7.4|^8.0|^8.1",
20+
"php": "^8.1|^8.2|^8.3",
2121
"ext-json": "*",
2222
"brick/money": "^0.5.2",
2323
"phpjuice/paypal-http-client": "^1.0"
2424
},
2525
"require-dev": {
26-
"squizlabs/php_codesniffer": "^3.4",
27-
"phpstan/phpstan": "^0.12",
28-
"pestphp/pest": "^1.18"
26+
"laravel/pint": "^1.18",
27+
"pestphp/pest": "^1.18",
28+
"phpstan/phpstan": "^0.12"
2929
},
3030
"autoload": {
3131
"psr-4": {
@@ -41,16 +41,13 @@
4141
"prefer-stable": true,
4242
"scripts": {
4343
"test": "vendor/bin/pest --colors=always",
44-
"analyse": "phpstan analyse --ansi --debug",
45-
"php-cs-fixer": [
46-
"php-cs-fixer fix src --rules=@PSR2",
47-
"php-cs-fixer fix tests --rules=@PSR2"
48-
]
44+
"pint": "./vendor/bin/pint",
45+
"analyse": "phpstan analyse --ansi --debug"
4946
},
5047
"config": {
5148
"sort-packages": true,
5249
"allow-plugins": {
5350
"pestphp/pest-plugin": true
5451
}
5552
}
56-
}
53+
}

src/Concerns/CastsToJson.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ public function __toString()
1919
/**
2020
* Convert the model instance to JSON.
2121
*
22-
* @param int $options
2322
*
24-
* @return string
2523
*
2624
* @throws JsonEncodingException
2725
*/
2826
public function toJson(int $options = 0): string
2927
{
3028
$json = json_encode($this->toArray(), $options);
3129

32-
if (JSON_ERROR_NONE !== json_last_error() || !$json) {
30+
if (json_last_error() !== JSON_ERROR_NONE || ! $json) {
3331
throw new JsonEncodingException(json_last_error_msg());
3432
}
3533

src/Concerns/HasCollection.php

+2-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ trait HasCollection
99
/**
1010
* Determine if an attribute or relation exists on the model.
1111
*
12-
* @param string $key
1312
*
1413
* @return bool
1514
*/
@@ -20,9 +19,6 @@ public function __isset(string $key)
2019

2120
/**
2221
* Determine if a key exists on the items.
23-
*
24-
* @param string $offset
25-
* @return bool
2622
*/
2723
public function offsetExists(string $offset): bool
2824
{
@@ -32,7 +28,6 @@ public function offsetExists(string $offset): bool
3228
/**
3329
* Unset an attribute on the model.
3430
*
35-
* @param string $key
3631
*
3732
* @return void
3833
*/
@@ -44,7 +39,6 @@ public function __unset(string $key)
4439
/**
4540
* Unset an attribute on the model.
4641
*
47-
* @param string $offset
4842
* @return void
4943
*/
5044
public function offsetUnset(string $offset)
@@ -53,8 +47,8 @@ public function offsetUnset(string $offset)
5347
}
5448

5549
/**
56-
* @param mixed $offset
57-
* @param mixed $value
50+
* @param mixed $offset
51+
* @param mixed $value
5852
* @return void
5953
*/
6054
public function offsetSet($offset, $value)
@@ -67,7 +61,6 @@ public function offsetSet($offset, $value)
6761
}
6862

6963
/**
70-
* @param string $offset
7164
* @return mixed|Item|null
7265
*/
7366
public function offsetGet(string $offset)
@@ -77,8 +70,6 @@ public function offsetGet(string $offset)
7770

7871
/**
7972
* Determine if the purchase unit is empty or not.
80-
*
81-
* @return bool
8273
*/
8374
public function isEmpty(): bool
8475
{

src/Contracts/Amount.php

-11
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,15 @@ interface Amount
66
{
77
/**
88
* convert amount to an array.
9-
* @return array
109
*/
1110
public function toArray(): array;
1211

13-
/**
14-
* @return string
15-
*/
1612
public function getCurrencyCode(): string;
1713

18-
/**
19-
* @return string
20-
*/
2114
public function getValue(): string;
2215

2316
/**
2417
* Convert the object to its JSON representation.
25-
*
26-
* @param int $options
27-
*
28-
* @return string
2918
*/
3019
public function toJson(int $options = 0): string;
3120
}

src/Contracts/Arrayable.php

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ interface Arrayable
66
{
77
/**
88
* Get the instance as an array.
9-
*
10-
* @return array
119
*/
1210
public function toArray(): array;
1311
}

src/Contracts/Jsonable.php

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ interface Jsonable
66
{
77
/**
88
* Convert the object to its JSON representation.
9-
*
10-
* @param int $options
11-
*
12-
* @return string
139
*/
1410
public function toJson(int $options = 0): string;
1511
}

src/Exceptions/InvalidOrderException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ class InvalidOrderException extends RuntimeException
88
{
99
public static function invalidPurchaseUnit(): InvalidOrderException
1010
{
11-
return new self("Paypal orders must have 1 purchase_unit at least.");
11+
return new self('Paypal orders must have 1 purchase_unit at least.');
1212
}
1313
}

src/Exceptions/JsonEncodingException.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
use RuntimeException;
66

7-
class JsonEncodingException extends RuntimeException
8-
{
9-
}
7+
class JsonEncodingException extends RuntimeException {}

src/Orders/Amount.php

+1-14
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ class Amount implements AmountContract
1616

1717
/**
1818
* The three-character ISO-4217 currency code that identifies the currency.
19-
*
20-
* @var Money
2119
*/
2220
protected Money $money;
2321

2422
/**
2523
* create a new amount instance.
26-
* @param string $value
27-
* @param string $currency_code
24+
*
2825
* @throws UnknownCurrencyException
2926
*/
3027
public function __construct(string $value, string $currency_code = 'USD')
@@ -33,9 +30,6 @@ public function __construct(string $value, string $currency_code = 'USD')
3330
}
3431

3532
/**
36-
* @param string $value
37-
* @param string $currency_code
38-
* @return Amount
3933
* @throws UnknownCurrencyException
4034
*/
4135
public static function of(string $value, string $currency_code = 'USD'): Amount
@@ -45,7 +39,6 @@ public static function of(string $value, string $currency_code = 'USD'): Amount
4539

4640
/**
4741
* convert amount to an array.
48-
* @return array
4942
*/
5043
public function toArray(): array
5144
{
@@ -55,17 +48,11 @@ public function toArray(): array
5548
];
5649
}
5750

58-
/**
59-
* @return string
60-
*/
6151
public function getCurrencyCode(): string
6252
{
6353
return $this->money->getCurrency()->getCurrencyCode();
6454
}
6555

66-
/**
67-
* @return string
68-
*/
6956
public function getValue(): string
7057
{
7158
return (string) $this->money->getAmount();

src/Orders/AmountBreakdown.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@ class AmountBreakdown extends Amount
1414
* The subtotal for all items. Required if the request includes purchase_units[].items[].unit_amount.
1515
* Must equal the sum of (items[].unit_amount * items[].quantity) for all items.
1616
* item_total.value can not be a negative number.
17-
* @var Money
1817
*/
1918
protected Money $item_total;
2019

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

2725
/**
2826
* create a new AmountBreakdown instance.
29-
* @param string $value
30-
* @param string $currency_code
27+
*
3128
* @throws UnknownCurrencyException
3229
*/
3330
public function __construct(string $value, string $currency_code = 'USD')
@@ -37,9 +34,6 @@ public function __construct(string $value, string $currency_code = 'USD')
3734
}
3835

3936
/**
40-
* @param string $value
41-
* @param string $currency_code
42-
* @return AmountBreakdown
4337
* @throws UnknownCurrencyException
4438
*/
4539
public static function of(string $value, string $currency_code = 'USD'): self
@@ -49,7 +43,6 @@ public static function of(string $value, string $currency_code = 'USD'): self
4943

5044
/**
5145
* Get the instance as an array.
52-
* @return array
5346
*/
5447
public function toArray(): array
5548
{

0 commit comments

Comments
 (0)