Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit b0500c6

Browse files
d8vjorkStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent b576af7 commit b0500c6

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed

src/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ public function jsonPaginate()
1313
* Paginate the given query using JSON:API.
1414
*
1515
* @param int|string $perPage
16-
* @param array $columns
16+
* @param array $columns
1717
*
1818
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
1919
*/
2020
return function ($perPage = null, $columns = ['*']) {
2121
$perPage = $perPage ?: $this->model->getPerPage();
2222
$clientPerPage = (int) request('page.size', config('json-api.pagination.default_size'));
23-
23+
2424
if (!$perPage || $perPage < $clientPerPage) {
2525
$perPage = $clientPerPage;
2626
}

src/Contracts/JsonApiable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ interface JsonApiable
66
{
77
/**
88
* Get a custom resource type for JSON:API formatting.
9-
*
10-
* @return string
9+
*
10+
* @return string
1111
*/
1212
public function resourceType(): string;
1313
}

src/Support/JsonApi.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44

55
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
66
use Illuminate\Support\Collection;
7+
use Illuminate\Support\Str;
78
use SkoreLabs\JsonApi\Contracts\JsonApiable;
89
use SkoreLabs\JsonApi\Http\Resources\JsonApiCollection;
910
use SkoreLabs\JsonApi\Http\Resources\JsonApiResource;
10-
use Illuminate\Support\Str;
1111

1212
class JsonApi
1313
{
1414
/**
1515
* Format the input contents to JSON:API.
16-
*
17-
* @param mixed $value
18-
* @return \SkoreLabs\JsonApi\Http\Resources\JsonApiResource
16+
*
17+
* @param mixed $value
18+
*
19+
* @return \SkoreLabs\JsonApi\Http\Resources\JsonApiResource
1920
*/
2021
public static function format($value)
2122
{
@@ -28,9 +29,10 @@ public static function format($value)
2829

2930
/**
3031
* Get resource type from a model.
31-
*
32-
* @param \Illuminate\Database\Eloquent\Model|string $model
33-
* @return string
32+
*
33+
* @param \Illuminate\Database\Eloquent\Model|string $model
34+
*
35+
* @return string
3436
*/
3537
public static function getResourceType($model)
3638
{

src/Testing/Assert.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
use Illuminate\Support\Traits\Macroable;
77
use PHPUnit\Framework\Assert as PHPUnit;
88
use PHPUnit\Framework\AssertionFailedError;
9-
use SkoreLabs\JsonApi\Testing\Concerns\HasRelationships;
109
use SkoreLabs\JsonApi\Testing\Concerns\HasAttributes;
1110
use SkoreLabs\JsonApi\Testing\Concerns\HasCollections;
1211
use SkoreLabs\JsonApi\Testing\Concerns\HasIdentifications;
12+
use SkoreLabs\JsonApi\Testing\Concerns\HasRelationships;
1313

1414
class Assert implements Arrayable
1515
{
16-
use HasIdentifications,
17-
HasAttributes,
18-
HasRelationships,
19-
HasCollections,
20-
Macroable;
16+
use HasIdentifications;
17+
use HasAttributes;
18+
use HasRelationships;
19+
use HasCollections;
20+
use Macroable;
2121

2222
/**
2323
* @var string
@@ -38,7 +38,7 @@ class Assert implements Arrayable
3838
* @var array
3939
*/
4040
protected $relationships;
41-
41+
4242
/**
4343
* @var array
4444
*/
@@ -68,7 +68,7 @@ public static function fromTestResponse($response)
6868
PHPUnit::assertArrayHasKey('data', $content);
6969
$data = $content['data'];
7070
$collection = [];
71-
71+
7272
if (static::isCollection($data)) {
7373
$collection = $data;
7474
$data = head($data);

tests/JsonApiCollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ public function testCollectionsAtHasAttribute()
6363
$json->at(1)->hasAttribute('title', 'Test Title 2');
6464
});
6565
}
66-
66+
6767
public function testCollectionsTakeByDefaultFirstItem()
6868
{
6969
$this->get('/', ['Accept' => 'application/json'])->assertJsonApi(function (Assert $json) {
7070
$json->hasAttribute('title', 'Test Title');
7171
});
7272
}
73-
73+
7474
public function testCollectionsHasSize()
7575
{
7676
$this->get('/', ['Accept' => 'application/json'])->assertJsonApi(function (Assert $json) {

tests/JsonApiPaginationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public function setUp(): void
3131

3232
protected function defineDatabaseMigrations()
3333
{
34-
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
34+
$this->loadMigrationsFrom(__DIR__.'/database/migrations');
3535
}
3636

3737
public function testJsonApiPaginationWithPageSize()
3838
{
3939
$response = $this->getJson('/posts?page[size]=2');
40-
40+
4141
$response->assertJsonApi(function (Assert $json) {
4242
$json->hasSize(2);
4343
});

0 commit comments

Comments
 (0)