Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"minimum-stability": "stable",
"require": {
"php": ">=7.2",
"psr/http-message": "^1.0"
"psr/http-message": "^1.0 || ^2.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class HttpException extends JsonApiException
* @param int $code
* @param \Throwable|null $previous
*/
public function __construct(int $statusCode, string $message = '', $code = 0, \Throwable $previous = null)
public function __construct(int $statusCode, string $message = '', $code = 0, ?\Throwable $previous = null)
{
$this->statusCode = $statusCode;
parent::__construct($message, $code, $previous);
Expand Down
4 changes: 2 additions & 2 deletions src/JsonApiTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function resource(string $type, string $id): ResourceInterface
* @param ResourceInterface|null $resource
* @return DocumentInterface
*/
protected function singleResourceDocument(ResourceInterface $resource = null): DocumentInterface
protected function singleResourceDocument(?ResourceInterface $resource = null): DocumentInterface
{
return new Document($resource);
}
Expand All @@ -48,7 +48,7 @@ protected function multiResourceDocument(array $resource = []): DocumentInterfac
* @param ResourceInterface|null $related
* @return RelationshipInterface
*/
protected function toOneRelationship(string $name, ResourceInterface $related = null): RelationshipInterface
protected function toOneRelationship(string $name, ?ResourceInterface $related = null): RelationshipInterface
{
return new Relationship($name, $related);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Request/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public function hasFilter(string $name): bool
* @param string|null $explodeBy
* @return array|string|int|float
*/
public function filterValue(string $name, string $explodeBy = null)
public function filterValue(string $name, ?string $explodeBy = null)
{
if ($explodeBy) {
return explode($explodeBy, $this->filter[$name]);
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Request/RequestInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function hasFilter(string $name): bool;
* @param string|null $explodeBy
* @return array|string|int|float
*/
public function filterValue(string $name, string $explodeBy = null);
public function filterValue(string $name, ?string $explodeBy = null);

/**
* Define a sort parameter. This method will manipulate the uri of the request.
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Resource/JsonResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function metaInformation(): KeyValueCollectionInterface
* @return ResourceInterface
* @throws \InvalidArgumentException
*/
public function duplicate(string $id = null): ResourceInterface
public function duplicate(?string $id = null): ResourceInterface
{
$resource = new self($this->type(), $id ?? $this->id(), $this->attributes()->all());

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Resource/Link/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function metaInformation(): KeyValueCollectionInterface
* @return LinkInterface
* @throws \InvalidArgumentException
*/
public function duplicate(string $name = null): LinkInterface
public function duplicate(?string $name = null): LinkInterface
{
$link = new self($name ?? $this->name(), $this->href());
$link->metaInformation()->mergeCollection($this->metaInformation());
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Resource/Link/LinkInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public function metaInformation(): KeyValueCollectionInterface;
* @param string|null $name
* @return LinkInterface
*/
public function duplicate(string $name = null): LinkInterface;
public function duplicate(?string $name = null): LinkInterface;
}
2 changes: 1 addition & 1 deletion src/Model/Resource/Relationship/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function related(): ResourceCollectionInterface
* @return RelationshipInterface
* @throws \InvalidArgumentException
*/
public function duplicate(string $name = null): RelationshipInterface
public function duplicate(?string $name = null): RelationshipInterface
{
if ($this->shouldBeHandledAsCollection()) {
$related = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Resource/Relationship/RelationshipInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ public function metaInformation(): KeyValueCollectionInterface;
* @param string|null $name
* @return RelationshipInterface
*/
public function duplicate(string $name = null): RelationshipInterface;
public function duplicate(?string $name = null): RelationshipInterface;
}
2 changes: 1 addition & 1 deletion src/Model/Resource/ResourceCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function get(string $type, string $id): ResourceInterface
* @return ResourceInterface
* @throws \LogicException
*/
public function first(string $type = null): ResourceInterface
public function first(?string $type = null): ResourceInterface
{
if ($this->isEmpty()) {
throw new \LogicException('Collection does not contain any resources!');
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Resource/ResourceCollectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function get(string $type, string $id): ResourceInterface;
* @param string $type
* @return ResourceInterface
*/
public function first(string $type = null): ResourceInterface;
public function first(?string $type = null): ResourceInterface;

/**
* @param ResourceInterface $resource
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Resource/ResourceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ public function metaInformation(): KeyValueCollectionInterface;
* @param string $id
* @return ResourceInterface
*/
public function duplicate(string $id = null): ResourceInterface;
public function duplicate(?string $id = null): ResourceInterface;
}