Skip to content

Commit fddfbad

Browse files
authored
Merge pull request #70 from Art4/add-support-for-php-8.2-8.3
Add support for PHP 8.2
2 parents 898d9ea + 77d7de4 commit fddfbad

File tree

8 files changed

+66
-60
lines changed

8 files changed

+66
-60
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/.docker export-ignore
22
/.gitattributes export-ignore
33
/.gitignore export-ignore
4-
/.travis.yml export-ignore
4+
/.phpstan.neon export-ignore
55
/docker-compose.yml export-ignore
66
/docs export-ignore
77
/phpunit.xml export-ignore

.github/workflows/phpstan.yml

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,30 @@ on:
77
jobs:
88

99
tests:
10-
name: Run with PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }}
10+
name: Run PHPStan with PHP ${{ matrix.php }}
1111
runs-on: ubuntu-latest
1212

1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
operating-system: ['ubuntu-latest']
17-
php-versions: ['7.4', '8.0', '8.1']
17+
php: ['8.2']
1818

1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222
with:
2323
fetch-depth: 2
2424

25-
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
26-
27-
- name: Setup PHP, with composer and extensions
25+
- name: Setup PHP with composer and extensions
2826
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
2927
with:
30-
php-version: ${{ matrix.php-versions }}
31-
tools: phpunit
32-
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
28+
php-version: ${{ matrix.php }}
3329
coverage: xdebug
34-
35-
- name: Get composer cache directory
36-
id: composer-cache
37-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
38-
39-
- name: Cache composer dependencies
40-
uses: actions/cache@v2
41-
with:
42-
path: ${{ steps.composer-cache.outputs.dir }}
43-
# Use composer.json for key, if composer.lock is not committed.
44-
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
45-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
46-
restore-keys: ${{ runner.os }}-composer-
30+
tools: none
4731

4832
- name: Install Composer dependencies
49-
run: composer install --no-progress --prefer-dist --optimize-autoloader
33+
uses: "ramsey/composer-install@v2"
5034

5135
- name: Run PHPStan
52-
run: vendor/bin/phpstan.phar analyze src --level 8
53-
54-
- run: echo "🍏 This job's status is ${{ job.status }}."
36+
run: composer run phpstan

.github/workflows/unit-tests.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,37 @@ on:
77
jobs:
88

99
tests:
10-
name: Tests (PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }})
10+
name: Tests (PHP ${{ matrix.php }})
1111
runs-on: ubuntu-latest
1212

1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
operating-system: ['ubuntu-latest']
17-
php-versions: ['7.4', '8.0', '8.1']
17+
php: ['7.4', '8.0', '8.1', '8.2', '8.3']
1818

1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v2
21+
uses: actions/checkout@v3
2222
with:
2323
fetch-depth: 2
2424

25-
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
26-
27-
- name: Setup PHP, with composer and extensions
25+
- name: Setup PHP with composer and extensions
2826
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
2927
with:
30-
php-version: ${{ matrix.php-versions }}
31-
tools: phpunit
32-
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
28+
php-version: ${{ matrix.php }}
3329
coverage: xdebug
30+
tools: none
3431

35-
- name: Get composer cache directory
36-
id: composer-cache
37-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
32+
- name: "Install Composer dependencies"
33+
if: ${{ matrix.php < '8.3' }}
34+
uses: "ramsey/composer-install@v2"
3835

39-
- name: Cache composer dependencies
40-
uses: actions/cache@v2
36+
- name: "Install Composer dependencies (PHP 8.3)"
37+
if: ${{ matrix.php >= '8.3' }}
38+
uses: "ramsey/composer-install@v2"
4139
with:
42-
path: ${{ steps.composer-cache.outputs.dir }}
43-
# Use composer.json for key, if composer.lock is not committed.
44-
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
45-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
46-
restore-keys: ${{ runner.os }}-composer-
47-
48-
- name: Install Composer dependencies
49-
run: composer install --no-progress --prefer-dist --optimize-autoloader
40+
composer-options: --ignore-platform-reqs
5041

5142
- name: Run tests
52-
run: vendor/bin/phpunit --coverage-text
53-
54-
- run: echo "🍏 This job's status is ${{ job.status }}."
43+
run: composer run phpunit -- --coverage-text

.phpstan.neon

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
parameters:
2+
level: 8
3+
4+
paths:
5+
- src/
6+
7+
scanDirectories:
8+
- vendor
9+
10+
ignoreErrors:
11+
-
12+
message: "#^Class Art4\\\\JsonApiClient\\\\Helper\\\\AccessKey extends generic class SplStack but does not specify its types\\: TValue$#"
13+
count: 1
14+
path: src/Helper/AccessKey.php
15+
16+
-
17+
message: "#^Property Art4\\\\JsonApiClient\\\\V1\\\\ResourceNull\\:\\:\\$data is never read, only written\\.$#"
18+
count: 1
19+
path: src/V1/ResourceNull.php
20+
21+
-
22+
message: "#^Property Art4\\\\JsonApiClient\\\\V1\\\\ResourceNull\\:\\:\\$manager is never read, only written\\.$#"
23+
count: 1
24+
path: src/V1/ResourceNull.php
25+
26+
-
27+
message: "#^Property Art4\\\\JsonApiClient\\\\V1\\\\ResourceNull\\:\\:\\$parent is never read, only written\\.$#"
28+
count: 1
29+
path: src/V1/ResourceNull.php

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@ 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.1.0...v1.x)
99

10+
### Added
11+
12+
- Add support for PHP 8.2
13+
1014
## [1.1.0 - 2021-10-05](https://github.com/Art4/json-api-client/compare/1.0.0...1.1.0)
1115

1216
### Added
1317

1418
- Added type hints for parameters and return types in internal and final classes
1519
- New tests for improving backward compatibility in interfaces
16-
- Support for PHP 8.1 is added in CI tests
20+
- Add support for PHP 8.1
1721

1822
### Changed
1923

2024
- Switched from Travis-CI to Github Actions
2125

2226
### Deprecated
2327

24-
- `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors.
28+
- `\Art4\JsonApiClient\Accessable::has()` will add `bool` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors.
2529
- `\Art4\JsonApiClient\Accessable::getKeys()` will add `array` as a native return type declaration in v2.0, do the same in your implementation now to avoid errors.
2630
- `\Art4\JsonApiClient\Exception\Exception` will extend `\Throwable` in v2.0, do the same in your implementation now to avoid errors.
2731
- `\Art4\JsonApiClient\Factory::make()` methods first parameter signature will be `string` in v2.0.

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
}
1414
],
1515
"require": {
16-
"php": "^7.4 || ^8.0"
16+
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0"
1717
},
1818
"require-dev": {
1919
"friendsofphp/php-cs-fixer": "^3.2",
20-
"phpstan/phpstan": "^0.12.99",
20+
"phpstan/phpstan": "^1.10",
2121
"phpunit/phpunit": "^9"
2222
},
2323
"autoload": {
@@ -30,10 +30,11 @@
3030
"Art4\\JsonApiClient\\Tests\\": "tests"
3131
}
3232
},
33+
"scripts": {
34+
"phpstan": "phpstan analyze --memory-limit 512M --configuration .phpstan.neon",
35+
"phpunit": "phpunit"
36+
},
3337
"config": {
34-
"//platform": {
35-
"php": "7.4"
36-
},
3738
"sort-packages": true
3839
}
3940
}

src/V1/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class Factory implements FactoryInterface
5454
];
5555

5656
/**
57-
* @param array<string, string> $overload specs to be overloaded with custom classes
57+
* @param array<string, class-string> $overload specs to be overloaded with custom classes
5858
*/
5959
public function __construct(array $overload = [])
6060
{

tests/Fixtures/TestCase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
namespace Art4\JsonApiClient\Tests\Fixtures;
2121

22+
#[\AllowDynamicProperties]
2223
class TestCase extends \PHPUnit\Framework\TestCase
2324
{
2425
/**

0 commit comments

Comments
 (0)