Skip to content

Commit d156fb4

Browse files
authored
Merge pull request #95 from Art4/77-remove-support-for-php-74-and-php-80
Remove support for PHP 7.4 and PHP 8.0
2 parents b2b886f + 63e764a commit d156fb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+209
-544
lines changed

Diff for: .github/workflows/unit-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
operating-system: ['ubuntu-latest']
17-
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
17+
php: ['8.1', '8.2', '8.3', '8.4']
1818

1919
steps:
2020
- name: Checkout

Diff for: .php-cs-fixer.dist.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
->setRules([
1414
'@PER-CS2.0' => true,
1515
'@PER-CS2.0:risky' => true,
16-
'@PHP74Migration' => true,
17-
'@PHP74Migration:risky' => true,
16+
'@PHP81Migration' => true,
17+
'@PHP80Migration:risky' => true,
1818
'@PHPUnit84Migration:risky' => true,
1919
'no_alias_functions' => true,
2020
])

Diff for: CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased](https://github.com/Art4/json-api-client/compare/1.2.0...v1.x)
99

10+
### Changed
11+
12+
- Dropped support for PHP 7.4 and PHP 8.0
13+
14+
### Deprecated
15+
16+
- `\Art4\Accessable::get()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors.
17+
- `\Art4\Manager::getParam()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors.
18+
1019
## [1.2.0 - 2023-11-28](https://github.com/Art4/json-api-client/compare/1.1.0...1.2.0)
1120

1221
### Added

Diff for: composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
}
1414
],
1515
"require": {
16-
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
16+
"php": "~8.1.0 || ~8.2.0 || ~8.3.0"
1717
},
1818
"require-dev": {
19-
"friendsofphp/php-cs-fixer": "^3.35",
19+
"friendsofphp/php-cs-fixer": "^3.40",
2020
"phpstan/phpstan": "^1.10",
2121
"phpstan/phpstan-phpunit": "^1.3",
22-
"phpunit/phpunit": "^9 || ^10"
22+
"phpunit/phpunit": "^10.4"
2323
},
2424
"autoload": {
2525
"psr-4": {

Diff for: src/Accessable.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,20 @@ interface Accessable
1818
/**
1919
* Get a value by a key
2020
*
21-
* @param mixed $key The key
21+
* @return-type-will-change mixed `\Art4\JsonApiClient\Accessable::get()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors.
2222
*
2323
* @return mixed
2424
*/
25-
public function get($key);
25+
public function get(mixed $key)/*: mixed */;
2626

2727
/**
2828
* Check if a value exists
2929
*
3030
* @return-type-will-change bool `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors.
3131
*
32-
* @param mixed $key The key
33-
*
3432
* @return bool
3533
*/
36-
public function has($key)/*: bool */;
34+
public function has(mixed $key)/*: bool */;
3735

3836
/**
3937
* Returns the keys of all setted values

Diff for: src/Element.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ interface Element
1818
*
1919
* @param mixed $data The data for this Element
2020
*/
21-
public function __construct($data, Manager $manager, Accessable $parent);
21+
public function __construct(mixed $data, Manager $manager, Accessable $parent);
2222
}

Diff for: src/Helper/AbstractElement.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract class AbstractElement implements Accessable, Element
3030
*
3131
* @param mixed $data The data for this Element
3232
*/
33-
public function __construct($data, Manager $manager, Accessable $parent)
33+
public function __construct(mixed $data, Manager $manager, Accessable $parent)
3434
{
3535
$this->manager = $manager;
3636
$this->parent = $parent;
@@ -56,10 +56,8 @@ protected function getParent(): Accessable
5656

5757
/**
5858
* Create an element
59-
*
60-
* @param mixed $data
6159
*/
62-
protected function create(string $name, $data): Accessable
60+
protected function create(string $name, mixed $data): Accessable
6361
{
6462
return $this->getManager()->getFactory()->make(
6563
$name,
@@ -69,8 +67,6 @@ protected function create(string $name, $data): Accessable
6967

7068
/**
7169
* Parse the data
72-
*
73-
* @param mixed $data
7470
*/
75-
abstract protected function parse($data): void;
71+
abstract protected function parse(mixed $data): void;
7672
}

Diff for: src/Helper/AccessableTrait.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ trait AccessableTrait
2525

2626
/**
2727
* Set a value
28-
*
29-
* @param mixed $value The Value
3028
*/
31-
final protected function set(string $key, $value): void
29+
final protected function set(string $key, mixed $value): void
3230
{
3331
// Allow non-associative array for collections
3432
if ($key === '') {
@@ -93,10 +91,8 @@ final public function has($key): bool
9391
* Get a value by a key
9492
*
9593
* @param int|string|AccessKey<string> $key The key
96-
*
97-
* @return mixed
9894
*/
99-
public function get($key)
95+
public function get($key): mixed
10096
{
10197
if (!is_int($key) && !is_string($key) && (!is_object($key) || !$key instanceof AccessKey)) {
10298
trigger_error(sprintf(
@@ -131,10 +127,8 @@ public function get($key)
131127
* Get a value by the key
132128
*
133129
* @throws AccessException
134-
*
135-
* @return mixed The value
136130
*/
137-
private function getValue(string $key)
131+
private function getValue(string $key): mixed
138132
{
139133
if (array_key_exists($key, $this->data)) {
140134
return $this->data[$key];

Diff for: src/Input/StringInputTrait.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ final public function prepareString($string): string
4141
* Decodes a json string
4242
*
4343
* @throws InputException if something went wrong with the input
44-
*
45-
* @return mixed
4644
*/
47-
final protected function decodeJson(string $jsonString)
45+
final protected function decodeJson(string $jsonString): mixed
4846
{
4947
$jsonErrors = [
5048
\JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded',

Diff for: src/Manager.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public function getFactory()/*: Factory */;
3939
/**
4040
* Get a param by key
4141
*
42-
* @param mixed $default
42+
* @return-type-will-change mixed `\Art4\JsonApiClient\Manager::getParam()` will add `mixed` as a native return type declaration in 2.0.0, do the same in your implementation now to avoid errors.
4343
*
4444
* @return mixed
4545
*/
46-
public function getParam(string $key, $default);
46+
public function getParam(string $key, mixed $default)/*: mixed*/;
4747
}

Diff for: src/Manager/ErrorAbortManager.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,8 @@ public function getFactory(): Factory
7878

7979
/**
8080
* Get a param by key
81-
*
82-
* @param mixed $default
83-
*
84-
* @return mixed
8581
*/
86-
public function getParam(string $key, $default)
82+
public function getParam(string $key, mixed $default): mixed
8783
{
8884
if (array_key_exists($key, $this->config)) {
8985
return $this->config[$key];

Diff for: src/Serializer/ArraySerializer.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,8 @@ public function serialize(Accessable $data): ?array
6262

6363
/**
6464
* Transforms objects to arrays
65-
*
66-
* @param mixed $val
67-
*
68-
* @return mixed
6965
*/
70-
private function objectTransform($val)
66+
private function objectTransform(mixed $val): mixed
7167
{
7268
if (!is_object($val)) {
7369
return $val;

Diff for: src/V1/Attributes.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class Attributes extends AbstractElement
2323
/**
2424
* Parses the data for this element
2525
*
26-
* @param mixed $object The data
27-
*
2826
* @throws ValidationException
2927
*/
30-
protected function parse($object): void
28+
protected function parse(mixed $object): void
3129
{
3230
if (!is_object($object)) {
3331
throw new ValidationException('Attributes has to be an object, "' . gettype($object) . '" given.');
@@ -52,10 +50,8 @@ protected function parse($object): void
5250
* Get a value by the key of this object
5351
*
5452
* @param int|string|AccessKey<string> $key The key of the value
55-
*
56-
* @return mixed The value
5753
*/
58-
public function get($key)
54+
public function get($key): mixed
5955
{
6056
try {
6157
return parent::get($key);

Diff for: src/V1/Document.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ final class Document extends AbstractElement
2424
/**
2525
* Parses the data for this element
2626
*
27-
* @param mixed $object The data
28-
*
2927
* @throws ValidationException
3028
*/
31-
protected function parse($object): void
29+
protected function parse(mixed $object): void
3230
{
3331
if (!is_object($object)) {
3432
throw new ValidationException('Document has to be an object, "' . gettype($object) . '" given.');
@@ -75,10 +73,8 @@ protected function parse($object): void
7573
* Get a value by the key of this object
7674
*
7775
* @param int|string|AccessKey<string> $key The key of the value
78-
*
79-
* @return mixed The value
8076
*/
81-
public function get($key)
77+
public function get($key): mixed
8278
{
8379
try {
8480
return parent::get($key);

Diff for: src/V1/DocumentLink.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ final class DocumentLink extends AbstractElement
2828
/**
2929
* Parses the data for this element
3030
*
31-
* @param mixed $object The data
32-
*
3331
* @throws ValidationException
3432
*/
35-
protected function parse($object): void
33+
protected function parse(mixed $object): void
3634
{
3735
if (!is_object($object)) {
3836
throw new ValidationException(
@@ -105,10 +103,8 @@ protected function parse($object): void
105103
* Get a value by the key of this object
106104
*
107105
* @param int|string|AccessKey<string> $key The key of the value
108-
*
109-
* @return mixed The value
110106
*/
111-
public function get($key)
107+
public function get($key): mixed
112108
{
113109
try {
114110
return parent::get($key);

Diff for: src/V1/Error.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class Error extends AbstractElement
2323
/**
2424
* Parses the data for this element
2525
*
26-
* @param mixed $object The data
27-
*
2826
* @throws ValidationException
2927
*/
30-
protected function parse($object): void
28+
protected function parse(mixed $object): void
3129
{
3230
if (!is_object($object)) {
3331
throw new ValidationException(
@@ -107,10 +105,8 @@ protected function parse($object): void
107105
* Get a value by the key of this object
108106
*
109107
* @param int|string|AccessKey<string> $key The key of the value
110-
*
111-
* @return mixed The value
112108
*/
113-
public function get($key)
109+
public function get($key): mixed
114110
{
115111
try {
116112
return parent::get($key);

Diff for: src/V1/ErrorCollection.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class ErrorCollection extends AbstractElement
2323
/**
2424
* Parses the data for this element
2525
*
26-
* @param mixed $object The data
27-
*
2826
* @throws ValidationException
2927
*/
30-
protected function parse($object): void
28+
protected function parse(mixed $object): void
3129
{
3230
if (!is_array($object)) {
3331
throw new ValidationException('Errors for a collection has to be in an array, "' . gettype($object) . '" given.');
@@ -46,10 +44,8 @@ protected function parse($object): void
4644
* Get a value by the key of this document
4745
*
4846
* @param int|string|AccessKey<string> $key The key of the value
49-
*
50-
* @return mixed The value
5147
*/
52-
public function get($key)
48+
public function get($key): mixed
5349
{
5450
try {
5551
return parent::get($key);

Diff for: src/V1/ErrorLink.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ final class ErrorLink extends AbstractElement
2727
/**
2828
* Parses the data for this element
2929
*
30-
* @param mixed $object The data
31-
*
3230
* @throws ValidationException
3331
*/
34-
protected function parse($object): void
32+
protected function parse(mixed $object): void
3533
{
3634
if (!is_object($object)) {
3735
throw new ValidationException('Link has to be an object, "' . gettype($object) . '" given.');
@@ -65,10 +63,8 @@ protected function parse($object): void
6563
* Get a value by the key of this object
6664
*
6765
* @param int|string|AccessKey<string> $key The key of the value
68-
*
69-
* @return mixed The value
7066
*/
71-
public function get($key)
67+
public function get($key): mixed
7268
{
7369
try {
7470
return parent::get($key);

Diff for: src/V1/ErrorSource.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ final class ErrorSource extends AbstractElement
2323
/**
2424
* Parses the data for this element
2525
*
26-
* @param mixed $object The data
27-
*
2826
* @throws ValidationException
2927
*/
30-
protected function parse($object): void
28+
protected function parse(mixed $object): void
3129
{
3230
if (!is_object($object)) {
3331
throw new ValidationException('ErrorSource has to be an object, "' . gettype($object) . '" given.');
@@ -54,10 +52,8 @@ protected function parse($object): void
5452
* Get a value by the key of this document
5553
*
5654
* @param int|string|AccessKey<string> $key The key of the value
57-
*
58-
* @return mixed The value
5955
*/
60-
public function get($key)
56+
public function get($key): mixed
6157
{
6258
try {
6359
return parent::get($key);

0 commit comments

Comments
 (0)