Skip to content

Commit 7d7dcb3

Browse files
committed
Rename AdapterInterface parameter
1 parent bc09e00 commit 7d7dcb3

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/Adapter/AdapterInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ public function getAttribute($model, Attribute $attribute);
9393
*
9494
* @return mixed|null|Deferred
9595
*/
96-
public function getHasOne($model, HasOne $relationship, bool $linkage, Context $context);
96+
public function getHasOne($model, HasOne $relationship, bool $linkageOnly, Context $context);
9797

9898
/**
9999
* Get a list of models for a has-many relationship for the model.
100100
*
101101
* @return array|Deferred
102102
*/
103-
public function getHasMany($model, HasMany $relationship, bool $linkage, Context $context);
103+
public function getHasMany($model, HasMany $relationship, bool $linkageOnly, Context $context);
104104

105105
/**
106106
* Determine whether this resource type represents the given model.

src/Adapter/EloquentAdapter.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
namespace Tobyz\JsonApiServer\Adapter;
1313

1414
use Closure;
15+
use Illuminate\Database\Eloquent\Builder;
1516
use Illuminate\Database\Eloquent\Collection;
1617
use Illuminate\Database\Eloquent\Model;
1718
use Illuminate\Database\Eloquent\Relations\BelongsTo;
1819
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
19-
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
20-
use Illuminate\Database\Eloquent\Relations\MorphOneOrMany;
2120
use InvalidArgumentException;
2221
use Tobyz\JsonApiServer\Context;
2322
use Tobyz\JsonApiServer\Deferred;
@@ -42,7 +41,7 @@ public function __construct($model)
4241
}
4342
}
4443

45-
public function query()
44+
public function query(): Builder
4645
{
4746
return $this->model->query();
4847
}
@@ -97,13 +96,13 @@ public function getAttribute($model, Attribute $attribute)
9796
return $model->getAttribute($this->getAttributeProperty($attribute));
9897
}
9998

100-
public function getHasOne($model, HasOne $relationship, bool $linkage, Context $context)
99+
public function getHasOne($model, HasOne $relationship, bool $linkageOnly, Context $context)
101100
{
102101
// If this is a belongs-to relationship, and we only need to get the ID
103102
// for linkage, then we don't have to actually load the relation because
104103
// the ID is stored in a column directly on the model. We will mock up a
105104
// related model with the value of the ID filled.
106-
if ($linkage) {
105+
if ($linkageOnly) {
107106
$relation = $this->getEloquentRelation($model, $relationship);
108107

109108
if ($relation instanceof BelongsTo) {
@@ -122,7 +121,7 @@ public function getHasOne($model, HasOne $relationship, bool $linkage, Context $
122121
return $this->getRelationship($model, $relationship, $context);
123122
}
124123

125-
public function getHasMany($model, HasMany $relationship, bool $linkage, Context $context)
124+
public function getHasMany($model, HasMany $relationship, bool $linkageOnly, Context $context)
126125
{
127126
return $this->getRelationship($model, $relationship, $context);
128127
}
@@ -147,7 +146,7 @@ public function represents($model): bool
147146
return $model instanceof $this->model;
148147
}
149148

150-
public function model()
149+
public function model(): Model
151150
{
152151
return $this->model->newInstance();
153152
}

src/Adapter/NullAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ public function getAttribute($model, Attribute $attribute)
5858
{
5959
}
6060

61-
public function getHasOne($model, HasOne $relationship, bool $linkage, Context $context)
61+
public function getHasOne($model, HasOne $relationship, bool $linkageOnly, Context $context)
6262
{
6363
}
6464

65-
public function getHasMany($model, HasMany $relationship, bool $linkage, Context $context)
65+
public function getHasMany($model, HasMany $relationship, bool $linkageOnly, Context $context)
6666
{
6767
}
6868

0 commit comments

Comments
 (0)