@@ -76,6 +76,6 @@ |
||
76 | 76 | #[\ReturnTypeWillChange] |
77 | 77 | public function jsonSerialize() |
78 | 78 | { |
79 | - return (object) $this->toArray(); |
|
79 | + return (object)$this->toArray(); |
|
80 | 80 | } |
81 | 81 | } |
@@ -76,6 +76,6 @@ |
||
76 | 76 | #[\ReturnTypeWillChange] |
77 | 77 | public function jsonSerialize() |
78 | 78 | { |
79 | - return (object) $this->toArray(); |
|
79 | + return (object)$this->toArray(); |
|
80 | 80 | } |
81 | 81 | } |
@@ -76,6 +76,6 @@ |
||
76 | 76 | #[\ReturnTypeWillChange] |
77 | 77 | public function jsonSerialize() |
78 | 78 | { |
79 | - return (object) $this->toArray(); |
|
79 | + return (object)$this->toArray(); |
|
80 | 80 | } |
81 | 81 | } |
@@ -39,13 +39,13 @@ |
||
39 | 39 | { |
40 | 40 | return Collection::make($item->getRelations()) |
41 | 41 | ->reject( |
42 | - static function ($relationship) { |
|
42 | + static function($relationship) { |
|
43 | 43 | /* @var \Swis\JsonApi\Client\Interfaces\OneRelationInterface|\Swis\JsonApi\Client\Interfaces\ManyRelationInterface $relationship */ |
44 | - return $relationship->shouldOmitIncluded() || ! $relationship->hasIncluded(); |
|
44 | + return $relationship->shouldOmitIncluded() || !$relationship->hasIncluded(); |
|
45 | 45 | } |
46 | 46 | ) |
47 | 47 | ->flatMap( |
48 | - static function ($relationship) { |
|
48 | + static function($relationship) { |
|
49 | 49 | /* @var \Swis\JsonApi\Client\Interfaces\OneRelationInterface|\Swis\JsonApi\Client\Interfaces\ManyRelationInterface $relationship */ |
50 | 50 | return Collection::wrap($relationship->getIncluded()); |
51 | 51 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function parse($data): ErrorCollection |
26 | 26 | { |
27 | - if (! is_array($data)) { |
|
27 | + if (!is_array($data)) { |
|
28 | 28 | throw new ValidationException(sprintf('ErrorCollection MUST be an array, "%s" given.', gettype($data))); |
29 | 29 | } |
30 | 30 | if (count($data) === 0) { |
@@ -24,10 +24,10 @@ |
||
24 | 24 | */ |
25 | 25 | public function parse($data): Jsonapi |
26 | 26 | { |
27 | - if (! is_object($data)) { |
|
27 | + if (!is_object($data)) { |
|
28 | 28 | throw new ValidationException(sprintf('Jsonapi MUST be an object, "%s" given.', gettype($data))); |
29 | 29 | } |
30 | - if (property_exists($data, 'version') && ! is_string($data->version)) { |
|
30 | + if (property_exists($data, 'version') && !is_string($data->version)) { |
|
31 | 31 | throw new ValidationException(sprintf('Jsonapi property "version" MUST be a string, "%s" given.', gettype($data->version))); |
32 | 32 | } |
33 | 33 |
@@ -17,10 +17,10 @@ |
||
17 | 17 | */ |
18 | 18 | public function parse($data): Meta |
19 | 19 | { |
20 | - if (! is_object($data)) { |
|
20 | + if (!is_object($data)) { |
|
21 | 21 | throw new ValidationException(sprintf('Meta MUST be an object, "%s" given.', gettype($data))); |
22 | 22 | } |
23 | 23 | |
24 | - return new Meta((array) $data); |
|
24 | + return new Meta((array)$data); |
|
25 | 25 | } |
26 | 26 | } |
@@ -39,15 +39,15 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function parse($data, string $source): Links |
41 | 41 | { |
42 | - if (! is_object($data)) { |
|
42 | + if (!is_object($data)) { |
|
43 | 43 | throw new ValidationException(sprintf('Links MUST be an object, "%s" given.', gettype($data))); |
44 | 44 | } |
45 | - if ($source === self::SOURCE_RELATIONSHIP && ! property_exists($data, 'self') && ! property_exists($data, 'related')) { |
|
45 | + if ($source === self::SOURCE_RELATIONSHIP && !property_exists($data, 'self') && !property_exists($data, 'related')) { |
|
46 | 46 | throw new ValidationException('Relationship links object MUST contain at least one of the following properties: `self`, `related`.'); |
47 | 47 | } |
48 | 48 | |
49 | 49 | return new Links( |
50 | - Collection::wrap((array) $data) |
|
50 | + Collection::wrap((array)$data) |
|
51 | 51 | ->map(fn ($link, $name) => $this->buildLink($link, $name)) |
52 | 52 | ->toArray() |
53 | 53 | ); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | private function buildLink($data, string $name): ?Link |
60 | 60 | { |
61 | - if (in_array($name, self::LINKS_THAT_MAY_NOT_BE_NULL_WHEN_PRESENT, true) && ! is_string($data) && ! is_object($data)) { |
|
61 | + if (in_array($name, self::LINKS_THAT_MAY_NOT_BE_NULL_WHEN_PRESENT, true) && !is_string($data) && !is_object($data)) { |
|
62 | 62 | throw new ValidationException(sprintf('Link "%s" MUST be an object or string, "%s" given.', $name, gettype($data))); |
63 | 63 | } |
64 | 64 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | return new Link($data); |
71 | 71 | } |
72 | 72 | |
73 | - if (! is_object($data)) { |
|
73 | + if (!is_object($data)) { |
|
74 | 74 | throw new ValidationException(sprintf('Link "%s" MUST be an object, string or null, "%s" given.', $name, gettype($data))); |
75 | 75 | } |
76 | - if (! property_exists($data, 'href')) { |
|
76 | + if (!property_exists($data, 'href')) { |
|
77 | 77 | throw new ValidationException(sprintf('Link "%s" MUST have a "href" attribute.', $name)); |
78 | 78 | } |
79 | 79 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function parse($data): Collection |
26 | 26 | { |
27 | - if (! is_array($data)) { |
|
27 | + if (!is_array($data)) { |
|
28 | 28 | throw new ValidationException(sprintf('ResourceCollection MUST be an array, "%s" given.', gettype($data))); |
29 | 29 | } |
30 | 30 |