Skip to content

Commit 2472776

Browse files
committed
Merge branch 'release/2.0.0'
2 parents ccf2bb0 + 6cdbe01 commit 2472776

File tree

15 files changed

+59
-33
lines changed

15 files changed

+59
-33
lines changed

.github/workflows/tests.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ 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']
18-
laravel: ['^8.0']
17+
php: [7.4, '8.0', 8.1]
18+
laravel: [8, 9]
19+
exclude:
20+
- php: 7.4
21+
laravel: 9
1922

2023
steps:
2124
- name: Checkout Code
@@ -28,16 +31,17 @@ jobs:
2831
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
2932
tools: composer:v2
3033
coverage: none
34+
ini-values: error_reporting=E_ALL
3135

3236
- name: Set Laravel Version
33-
run: composer require "laravel/framework:${{ matrix.laravel }}" --no-update -n
37+
run: composer require "illuminate/database:^${{ matrix.laravel }}" --no-update
3438

3539
- name: Install dependencies
3640
uses: nick-invision/retry@v1
3741
with:
3842
timeout_minutes: 5
3943
max_attempts: 5
40-
command: composer install --no-suggest --prefer-dist -n -o
41-
44+
command: composer update --prefer-dist --no-interaction --no-progress
45+
4246
- name: Execute tests
4347
run: vendor/bin/phpunit

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@
33
All notable changes to this project will be documented in this file. This project adheres to
44
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
55

6+
## [2.0.0] - 2022-02-09
7+
8+
### Added
9+
10+
- Package now supports Laravel 9.
11+
- Package now supports PHP 8.1.
12+
- Upgraded to v2 of the `laravel-json-api/eloquent` dependency.
13+
14+
### Changed
15+
16+
- Added return types to internal methods to remove deprecation messages in PHP 8.1.
17+
618
## [1.0.0] - 2021-07-21
719

820
Initial release. This brought in the code from `laravel-json-api/eloquent:1.0.0-beta.6`, with the only changes being new

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
"require": {
2626
"php": "^7.4|^8.0",
2727
"ext-json": "*",
28-
"illuminate/database": "^8.0",
29-
"illuminate/pagination": "^8.0",
30-
"illuminate/support": "^8.0",
31-
"laravel-json-api/eloquent": "^1.0.0"
28+
"illuminate/database": "^8.0|^9.0",
29+
"illuminate/pagination": "^8.0|^9.0",
30+
"illuminate/support": "^8.0|^9.0",
31+
"laravel-json-api/eloquent": "^2.0"
3232
},
3333
"require-dev": {
34-
"orchestra/testbench": "^6.9",
35-
"phpunit/phpunit": "^9.5"
34+
"orchestra/testbench": "^6.23|^7.0",
35+
"phpunit/phpunit": "^9.5.10"
3636
},
3737
"autoload": {
3838
"psr-4": {
@@ -48,7 +48,7 @@
4848
},
4949
"extra": {
5050
"branch-alias": {
51-
"dev-develop": "1.x-dev"
51+
"dev-develop": "2.x-dev"
5252
}
5353
},
5454
"minimum-stability": "stable",

phpunit.xml

Lines changed: 2 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"
@@ -31,6 +32,7 @@
3132
</testsuite>
3233
</testsuites>
3334
<php>
35+
<ini name="error_reporting" value="E_ALL"/>
3436
<env name="DB_CONNECTION" value="testing"/>
3537
</php>
3638
</phpunit>

src/Cursor/Cursor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/Cursor/CursorBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

src/Cursor/CursorPaginator.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
use Illuminate\Pagination\Paginator;
2525
use IteratorAggregate;
2626
use LogicException;
27+
use Traversable;
2728

2829
class CursorPaginator implements IteratorAggregate, Countable
2930
{
@@ -154,15 +155,15 @@ public function getTo(): ?string
154155
/**
155156
* @inheritDoc
156157
*/
157-
public function getIterator()
158+
public function getIterator(): Traversable
158159
{
159160
yield from $this->items;
160161
}
161162

162163
/**
163164
* @inheritDoc
164165
*/
165-
public function count()
166+
public function count(): int
166167
{
167168
return $this->items->count();
168169
}

src/CursorPage.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
2323
use LaravelJsonApi\Core\Document\Link;
2424
use LaravelJsonApi\Core\Pagination\AbstractPage;
2525
use LaravelJsonApi\CursorPagination\Cursor\CursorPaginator;
26+
use Traversable;
2627

2728
class CursorPage extends AbstractPage
2829
{
@@ -179,15 +180,15 @@ public function url(array $page): string
179180
/**
180181
* @inheritDoc
181182
*/
182-
public function getIterator()
183+
public function getIterator(): Traversable
183184
{
184185
yield from $this->paginator;
185186
}
186187

187188
/**
188189
* @inheritDoc
189190
*/
190-
public function count()
191+
public function count(): int
191192
{
192193
return $this->paginator->count();
193194
}

src/CursorPagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/app/Video.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/app/VideoSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/database/factories/VideoFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/database/migrations/2021_07_31_1405_create_video_table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/lib/Acceptance/Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

tests/lib/Acceptance/TestCase.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2021 Cloud Creativity Limited
3+
* Copyright 2022 Cloud Creativity Limited
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -19,28 +19,34 @@
1919

2020
namespace LaravelJsonApi\CursorPagination\Tests\Acceptance;
2121

22+
use Illuminate\Foundation\Testing\Concerns\InteractsWithDeprecationHandling;
2223
use LaravelJsonApi\Contracts\Schema\Container as SchemaContainerContract;
2324
use LaravelJsonApi\Contracts\Server\Server;
2425
use LaravelJsonApi\Core\Schema\Container as SchemaContainer;
26+
use LaravelJsonApi\Core\Support\ContainerResolver;
2527
use Orchestra\Testbench\TestCase as BaseTestCase;
2628

2729
class TestCase extends BaseTestCase
2830
{
31+
use InteractsWithDeprecationHandling;
32+
2933
/**
3034
* @inheritDoc
3135
*/
3236
protected function setUp(): void
3337
{
3438
parent::setUp();
3539

40+
$this->withoutDeprecationHandling();
41+
3642
$this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
3743

38-
$this->app->singleton(
39-
SchemaContainerContract::class,
40-
fn($container) => new SchemaContainer($container, $container->make(Server::class), [
44+
$this->app->singleton(SchemaContainerContract::class, static function ($container) {
45+
$resolver = new ContainerResolver(static fn () => $container);
46+
return new SchemaContainer($resolver, $container->make(Server::class), [
4147
\App\VideoSchema::class,
42-
])
43-
);
48+
]);
49+
});
4450

4551
$this->app->singleton(Server::class, function () {
4652
$server = $this->createMock(Server::class);

0 commit comments

Comments
 (0)