Skip to content

Commit 9cc96af

Browse files
committed
style: fix (updated) code style
1 parent 80cf312 commit 9cc96af

File tree

13 files changed

+26
-26
lines changed

13 files changed

+26
-26
lines changed

src/Client.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class Client implements ClientInterface
3030
];
3131

3232
public function __construct(
33-
HttpClientInterface $client = null,
34-
RequestFactoryInterface $requestFactory = null,
35-
StreamFactoryInterface $streamFactory = null
33+
?HttpClientInterface $client = null,
34+
?RequestFactoryInterface $requestFactory = null,
35+
?StreamFactoryInterface $streamFactory = null
3636
) {
3737
$this->client = $client ?: Psr18ClientDiscovery::find();
3838
$this->requestFactory = $requestFactory ?: Psr17FactoryDiscovery::findRequestFactory();

src/Concerns/HasRelations.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ trait HasRelations
3131
*
3232
* @return \Swis\JsonApi\Client\Relations\HasOneRelation
3333
*/
34-
public function hasOne(string $itemClass, string $name = null): OneRelationInterface
34+
public function hasOne(string $itemClass, ?string $name = null): OneRelationInterface
3535
{
3636
$name = $name ?: $this->guessRelationName();
3737

@@ -55,7 +55,7 @@ protected function newHasOne(string $type): OneRelationInterface
5555
*
5656
* @return \Swis\JsonApi\Client\Relations\HasManyRelation
5757
*/
58-
public function hasMany(string $itemClass, string $name = null): ManyRelationInterface
58+
public function hasMany(string $itemClass, ?string $name = null): ManyRelationInterface
5959
{
6060
$name = $name ?: $this->guessRelationName();
6161

@@ -78,7 +78,7 @@ protected function newHasMany(string $type): ManyRelationInterface
7878
*
7979
* @return \Swis\JsonApi\Client\Relations\MorphToRelation
8080
*/
81-
public function morphTo(string $name = null): OneRelationInterface
81+
public function morphTo(?string $name = null): OneRelationInterface
8282
{
8383
$name = $name ?: $this->guessRelationName();
8484

@@ -101,7 +101,7 @@ protected function newMorphTo(): OneRelationInterface
101101
*
102102
* @return \Swis\JsonApi\Client\Relations\MorphToManyRelation
103103
*/
104-
public function morphToMany(string $name = null): ManyRelationInterface
104+
public function morphToMany(?string $name = null): ManyRelationInterface
105105
{
106106
$name = $name ?: $this->guessRelationName();
107107

@@ -182,7 +182,7 @@ public function getRelationValue(string $name): ?DataInterface
182182
*
183183
* @return static
184184
*/
185-
public function setRelation(string $relation, $value = false, Links $links = null, Meta $meta = null)
185+
public function setRelation(string $relation, $value = false, ?Links $links = null, ?Meta $meta = null)
186186
{
187187
$method = Util::stringCamel($relation);
188188
if (method_exists($this, $method)) {

src/DocumentClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(ClientInterface $client, ResponseParserInterface $pa
3232
*
3333
* @return static
3434
*/
35-
public static function create(TypeMapperInterface $typeMapper = null, HttpClientInterface $client = null): self
35+
public static function create(?TypeMapperInterface $typeMapper = null, ?HttpClientInterface $client = null): self
3636
{
3737
return new static(new Client($client), ResponseParser::create($typeMapper));
3838
}

src/Error.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ class Error
5353
* @param \Swis\JsonApi\Client\Meta|null $meta
5454
*/
5555
public function __construct(
56-
string $id = null,
57-
Links $links = null,
58-
string $status = null,
59-
string $code = null,
60-
string $title = null,
61-
string $detail = null,
62-
ErrorSource $source = null,
63-
Meta $meta = null
56+
?string $id = null,
57+
?Links $links = null,
58+
?string $status = null,
59+
?string $code = null,
60+
?string $title = null,
61+
?string $detail = null,
62+
?ErrorSource $source = null,
63+
?Meta $meta = null
6464
) {
6565
$this->id = $id;
6666
$this->links = $links;

src/ErrorSource.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ErrorSource
2020
* @param string|null $pointer
2121
* @param string|null $parameter
2222
*/
23-
public function __construct(string $pointer = null, string $parameter = null)
23+
public function __construct(?string $pointer = null, ?string $parameter = null)
2424
{
2525
$this->pointer = $pointer;
2626
$this->parameter = $parameter;

src/Interfaces/ItemInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function getAvailableRelations(): array;
136136
*
137137
* @return static
138138
*/
139-
public function setRelation(string $relation, $value = false, Links $links = null, Meta $meta = null);
139+
public function setRelation(string $relation, $value = false, ?Links $links = null, ?Meta $meta = null);
140140

141141
/**
142142
* @return \Swis\JsonApi\Client\Interfaces\OneRelationInterface[]|\Swis\JsonApi\Client\Interfaces\ManyRelationInterface[]

src/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function toArray()
196196
*
197197
* @return static
198198
*/
199-
public function replicate(array $except = null)
199+
public function replicate(?array $except = null)
200200
{
201201
$attributes = Util::arrayExcept($this->getAttributes(), $except ?? []);
202202

src/ItemHydrator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(TypeMapperInterface $typeMapper)
3838
*
3939
* @return \Swis\JsonApi\Client\Interfaces\ItemInterface
4040
*/
41-
public function hydrate(ItemInterface $item, array $attributes, string $id = null): ItemInterface
41+
public function hydrate(ItemInterface $item, array $attributes, ?string $id = null): ItemInterface
4242
{
4343
$this->fill($item, $attributes);
4444
$this->fillRelations($item, $attributes);

src/Jsonapi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Jsonapi implements Arrayable, Jsonable, \JsonSerializable
2121
* @param string|null $version
2222
* @param \Swis\JsonApi\Client\Meta|null $meta
2323
*/
24-
public function __construct(string $version = null, Meta $meta = null)
24+
public function __construct(?string $version = null, ?Meta $meta = null)
2525
{
2626
$this->version = $version;
2727
$this->meta = $meta;

src/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Link
1919
* @param string $href
2020
* @param \Swis\JsonApi\Client\Meta|null $meta
2121
*/
22-
public function __construct(string $href, Meta $meta = null)
22+
public function __construct(string $href, ?Meta $meta = null)
2323
{
2424
$this->href = $href;
2525
$this->meta = $meta;

0 commit comments

Comments
 (0)