Skip to content

Commit 207c903

Browse files
CS fixes
1 parent c70af36 commit 207c903

32 files changed

+57
-94
lines changed

src/Encoder/Encoder.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,6 @@ protected function encodeErrorsToArray(iterable $errors): array
314314
return $array;
315315
}
316316

317-
/**
318-
* @param $meta
319-
*/
320317
protected function encodeMetaToArray($meta): array
321318
{
322319
$this->withMeta($meta);

src/Exceptions/BaseJsonApiException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
* limitations under the License.
2121
*/
2222

23-
use RuntimeException;
24-
25-
abstract class BaseJsonApiException extends RuntimeException
23+
abstract class BaseJsonApiException extends \RuntimeException
2624
{
2725
}

src/Exceptions/JsonApiException.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* limitations under the License.
2121
*/
2222

23-
use Exception;
2423
use Neomerx\JsonApi\Contracts\Schema\ErrorInterface;
2524
use Neomerx\JsonApi\Schema\ErrorCollection;
2625

@@ -57,7 +56,7 @@ class JsonApiException extends BaseJsonApiException
5756
* @SuppressWarnings(PHPMD.StaticAccess)
5857
* @SuppressWarnings(PHPMD.ElseExpression)
5958
*/
60-
public function __construct($errors, int $httpCode = self::DEFAULT_HTTP_CODE, Exception $previous = null)
59+
public function __construct($errors, int $httpCode = self::DEFAULT_HTTP_CODE, \Exception $previous = null)
6160
{
6261
parent::__construct('JSON API error', 0, $previous);
6362

src/Http/Headers/AcceptMediaType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* limitations under the License.
2121
*/
2222

23-
use Closure;
2423
use Neomerx\JsonApi\Contracts\Http\Headers\AcceptMediaTypeInterface;
2524
use Neomerx\JsonApi\Exceptions\InvalidArgumentException;
2625

@@ -76,7 +75,7 @@ public function getQuality(): float
7675
return $this->quality;
7776
}
7877

79-
public static function getCompare(): Closure
78+
public static function getCompare(): \Closure
8079
{
8180
return function (AcceptMediaTypeInterface $lhs, AcceptMediaTypeInterface $rhs) {
8281
$qualityCompare = self::compareQuality($lhs->getQuality(), $rhs->getQuality());

src/Parser/IdentifierAndResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function getRelationships(): iterable
186186

187187
\assert(
188188
$hasData || $hasMeta || $hasLinks,
189-
"Relationship `${name}` for type `" . $this->getType() .
189+
"Relationship `{$name}` for type `" . $this->getType() .
190190
'` MUST contain at least one of the following: links, data or meta.'
191191
);
192192

@@ -270,7 +270,7 @@ private function assertRelationshipNameAndDescription(string $name, array $descr
270270
);
271271
\assert(
272272
true === \is_array($description) && false === empty($description),
273-
"Relationship `${name}` for type `" . $this->getType() . '` should be a non-empty array.'
273+
"Relationship `{$name}` for type `" . $this->getType() . '` should be a non-empty array.'
274274
);
275275

276276
return true;

src/Parser/Parser.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* limitations under the License.
2121
*/
2222

23-
use IteratorAggregate;
2423
use Neomerx\JsonApi\Contracts\Factories\FactoryInterface;
2524
use Neomerx\JsonApi\Contracts\Parser\DocumentDataInterface;
2625
use Neomerx\JsonApi\Contracts\Parser\EditableContextInterface;
@@ -33,8 +32,8 @@
3332
use Neomerx\JsonApi\Contracts\Schema\PositionInterface;
3433
use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
3534
use Neomerx\JsonApi\Exceptions\InvalidArgumentException;
35+
3636
use function Neomerx\JsonApi\I18n\format as _;
37-
use Traversable;
3837

3938
/**
4039
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -104,8 +103,8 @@ public function parse($data, array $paths = []): iterable
104103
} elseif (true === \is_array($data)) {
105104
yield $this->createDocumentDataIsCollection($rootPosition);
106105
yield from $this->parseAsResourcesOrIdentifiers($rootPosition, $data);
107-
} elseif ($data instanceof Traversable) {
108-
$data = $data instanceof IteratorAggregate ? $data->getIterator() : $data;
106+
} elseif ($data instanceof \Traversable) {
107+
$data = $data instanceof \IteratorAggregate ? $data->getIterator() : $data;
109108
yield $this->createDocumentDataIsCollection($rootPosition);
110109
yield from $this->parseAsResourcesOrIdentifiers($rootPosition, $data);
111110
} elseif (null === $data) {

src/Parser/RelationshipData/ParseRelationshipDataTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
* limitations under the License.
2121
*/
2222

23-
use IteratorAggregate;
2423
use Neomerx\JsonApi\Contracts\Factories\FactoryInterface;
2524
use Neomerx\JsonApi\Contracts\Parser\EditableContextInterface;
2625
use Neomerx\JsonApi\Contracts\Parser\RelationshipDataInterface;
@@ -29,9 +28,10 @@
2928
use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
3029
use Neomerx\JsonApi\Contracts\Schema\SchemaInterface;
3130
use Neomerx\JsonApi\Exceptions\InvalidArgumentException;
31+
3232
use function Neomerx\JsonApi\I18n\format as _;
33+
3334
use Neomerx\JsonApi\Parser\IdentifierAndResource;
34-
use Traversable;
3535

3636
trait ParseRelationshipDataTrait
3737
{
@@ -98,12 +98,12 @@ private function parseData(
9898
return $factory->createRelationshipDataIsIdentifier($container, $context, $position, $data);
9999
} elseif (true === \is_array($data)) {
100100
return $factory->createRelationshipDataIsCollection($container, $context, $position, $data);
101-
} elseif ($data instanceof Traversable) {
101+
} elseif ($data instanceof \Traversable) {
102102
return $factory->createRelationshipDataIsCollection(
103103
$container,
104104
$context,
105105
$position,
106-
$data instanceof IteratorAggregate ? $data->getIterator() : $data
106+
$data instanceof \IteratorAggregate ? $data->getIterator() : $data
107107
);
108108
} elseif (null === $data) {
109109
return $factory->createRelationshipDataIsNull();

src/Parser/RelationshipData/RelationshipDataIsCollection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Neomerx\JsonApi\Contracts\Schema\PositionInterface;
3030
use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
3131
use Neomerx\JsonApi\Exceptions\LogicException;
32+
3233
use function Neomerx\JsonApi\I18n\format as _;
3334

3435
class RelationshipDataIsCollection extends BaseRelationshipData implements RelationshipDataInterface

src/Parser/RelationshipData/RelationshipDataIsIdentifier.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Neomerx\JsonApi\Contracts\Schema\PositionInterface;
3030
use Neomerx\JsonApi\Contracts\Schema\SchemaContainerInterface;
3131
use Neomerx\JsonApi\Exceptions\LogicException;
32+
3233
use function Neomerx\JsonApi\I18n\format as _;
3334

3435
class RelationshipDataIsIdentifier extends BaseRelationshipData implements RelationshipDataInterface

src/Parser/RelationshipData/RelationshipDataIsNull.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Neomerx\JsonApi\Contracts\Parser\RelationshipDataInterface;
2525
use Neomerx\JsonApi\Contracts\Parser\ResourceInterface;
2626
use Neomerx\JsonApi\Exceptions\LogicException;
27+
2728
use function Neomerx\JsonApi\I18n\format as _;
2829

2930
class RelationshipDataIsNull implements RelationshipDataInterface

0 commit comments

Comments
 (0)