Skip to content

Commit d672eb5

Browse files
authored
[Refactor] PHP 8.1 support (#4)
* PHP 8.1 support * Update dependencies
1 parent cdb8b6d commit d672eb5

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ name: Tests
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main, develop, 2.x ]
66
pull_request:
7-
branches: [ main, develop ]
7+
branches: [ main, develop, 2.x ]
88

99
jobs:
1010
build:
1111

1212
runs-on: ubuntu-latest
13-
13+
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: ['7.4', '8.0']
17+
php: ['7.4', '8.0', '8.1']
1818
laravel: ['^8.0']
1919

2020
steps:
@@ -28,6 +28,7 @@ jobs:
2828
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
2929
tools: composer:v2
3030
coverage: none
31+
ini-values: error_reporting=E_ALL
3132

3233
- name: Set Laravel Version
3334
run: composer require "laravel/framework:${{ matrix.laravel }}" --no-update -n
@@ -38,6 +39,6 @@ jobs:
3839
timeout_minutes: 5
3940
max_attempts: 5
4041
command: composer install --no-suggest --prefer-dist -n -o
41-
42+
4243
- name: Execute tests
4344
run: vendor/bin/phpunit

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"php": "^7.4|^8.0",
2727
"ext-json": "*",
2828
"illuminate/support": "^8.0",
29-
"laravel-json-api/core": "^1.1",
30-
"laravel-json-api/neomerx-json-api": "^4.0.2"
29+
"laravel-json-api/core": "^2.0",
30+
"laravel-json-api/neomerx-json-api": "^5.0"
3131
},
3232
"require-dev": {
33-
"phpunit/phpunit": "^9.5"
33+
"phpunit/phpunit": "^9.5.10"
3434
},
3535
"autoload": {
3636
"psr-4": {
@@ -44,15 +44,16 @@
4444
},
4545
"extra": {
4646
"branch-alias": {
47-
"dev-develop": "1.x-dev"
47+
"dev-develop": "1.x-dev",
48+
"dev-2.x": "2.x-dev"
4849
},
4950
"laravel": {
5051
"providers": [
5152
"LaravelJsonApi\\Encoder\\Neomerx\\ServiceProvider"
5253
]
5354
}
5455
},
55-
"minimum-stability": "stable",
56+
"minimum-stability": "dev",
5657
"prefer-stable": true,
5758
"config": {
5859
"sort-packages": true

phpunit.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
convertErrorsToExceptions="true"
99
convertNoticesToExceptions="true"
1010
convertWarningsToExceptions="true"
11+
convertDeprecationsToExceptions="true"
1112
processIsolation="false"
1213
stopOnError="false"
1314
stopOnFailure="false"
@@ -27,4 +28,8 @@
2728
<directory suffix="Test.php">./tests/Integration/</directory>
2829
</testsuite>
2930
</testsuites>
31+
32+
<php>
33+
<ini name="error_reporting" value="E_ALL"/>
34+
</php>
3035
</phpunit>

src/Schema/Relationships.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use LaravelJsonApi\Core\Resources\JsonApiResource;
2929
use LaravelJsonApi\Encoder\Neomerx\Mapper;
3030
use Neomerx\JsonApi\Contracts\Schema\ContextInterface;
31+
use Traversable;
3132
use UnexpectedValueException;
3233

3334
/**
@@ -97,7 +98,7 @@ public function __construct(
9798
/**
9899
* @inheritDoc
99100
*/
100-
public function getIterator()
101+
public function getIterator(): Traversable
101102
{
102103
foreach ($this->iterator() as $relation) {
103104
if (!$relation instanceof JsonApiRelation) {

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ServiceProvider extends BaseServiceProvider implements DeferrableProvider
3131
/**
3232
* @inheritDoc
3333
*/
34-
public function provides()
34+
public function provides(): array
3535
{
3636
return [
3737
EncoderFactoryContract::class,

0 commit comments

Comments
 (0)