@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | if (is_array($this->body)) { |
| 90 | 90 | /** @psalm-suppress MixedAssignment */ |
| 91 | 91 | foreach ($this->body as &$item) { |
| 92 | - if (! ($item instanceof RequestInterface)) { |
|
| 92 | + if (!($item instanceof RequestInterface)) { |
|
| 93 | 93 | continue; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $this->body = []; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if (! is_array($this->body)) { |
|
| 137 | + if (!is_array($this->body)) { |
|
| 138 | 138 | throw new IlligalAccessException((string) $offset); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function ksort(): void |
| 192 | 192 | { |
| 193 | - if (! is_array($this->body)) { |
|
| 193 | + if (!is_array($this->body)) { |
|
| 194 | 194 | return; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function asort(): void |
| 204 | 204 | { |
| 205 | - if (! is_array($this->body)) { |
|
| 205 | + if (!is_array($this->body)) { |
|
| 206 | 206 | return; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | return $this->view; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if (! $this->renderer instanceof RenderInterface) { |
|
| 241 | + if (!$this->renderer instanceof RenderInterface) { |
|
| 242 | 242 | $this->renderer = new JsonRenderer(); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | public function jsonSerialize(): array |
| 251 | 251 | { |
| 252 | 252 | /** @psalm-suppress MixedAssignment */ |
| 253 | - if (! is_iterable($this->body)) { |
|
| 253 | + if (!is_iterable($this->body)) { |
|
| 254 | 254 | return ['value' => $this->body]; |
| 255 | 255 | } |
| 256 | 256 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | final class ResourceNotFoundException extends BadRequestException |
| 11 | 11 | { |
| 12 | - public function __construct(string $message = '', int $code = Code::NOT_FOUND, Throwable|null $previous = null) |
|
| 12 | + public function __construct(string $message = '', int $code = Code::NOT_FOUND, Throwable | null $previous = null) |
|
| 13 | 13 | { |
| 14 | 14 | parent::__construct($message, $code, $previous); |
| 15 | 15 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | final class ServerErrorException extends ErrorException implements ExceptionInterface |
| 12 | 12 | { |
| 13 | - public function __construct(string $message = '', int $code = Code::ERROR, Throwable|null $previous = null) |
|
| 13 | + public function __construct(string $message = '', int $code = Code::ERROR, Throwable | null $previous = null) |
|
| 14 | 14 | { |
| 15 | 15 | parent::__construct($message, $code, 1, '', 0, $previous); |
| 16 | 16 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | class BadRequestException extends BadMethodCallException implements ExceptionInterface |
| 12 | 12 | { |
| 13 | - public function __construct(string $message = '', int $code = Code::BAD_REQUEST, Throwable|null $previous = null) |
|
| 13 | + public function __construct(string $message = '', int $code = Code::BAD_REQUEST, Throwable | null $previous = null) |
|
| 14 | 14 | { |
| 15 | 15 | parent::__construct($message, $code, $previous); |
| 16 | 16 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | public array $query = [], |
| 91 | 91 | // phpcs:ignore SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingAnyTypeHint |
| 92 | 92 | public array $links = [], |
| 93 | - private readonly LinkerInterface|null $linker = null, |
|
| 93 | + private readonly LinkerInterface | null $linker = null, |
|
| 94 | 94 | ) { |
| 95 | - if (! in_array(strtolower($method), ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'], true)) { |
|
| 95 | + if (!in_array(strtolower($method), ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'], true)) { |
|
| 96 | 96 | throw new MethodException($method, 400); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | return (string) $this->result; |
| 110 | 110 | } catch (Throwable $e) { |
| 111 | - trigger_error($e->getMessage() . PHP_EOL . $e->getTraceAsString(), E_USER_ERROR); |
|
| 111 | + trigger_error($e->getMessage().PHP_EOL.$e->getTraceAsString(), E_USER_ERROR); |
|
| 112 | 112 | |
| 113 | 113 | /** @noinspection PhpUnreachableStatementInspection */ |
| 114 | 114 | return ''; // @phpstan-ignore-line |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * @param Query $query |
| 122 | 122 | */ |
| 123 | 123 | #[Override] |
| 124 | - public function __invoke(array|null $query = null): ResourceObject |
|
| 124 | + public function __invoke(array | null $query = null): ResourceObject |
|
| 125 | 125 | { |
| 126 | 126 | if (is_array($query)) { |
| 127 | 127 | $this->query = array_merge($this->query, $query); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | #[ReturnTypeWillChange] |
| 159 | 159 | public function offsetSet($offset, $value) |
| 160 | 160 | { |
| 161 | - throw new OutOfBoundsException(__METHOD__ . ' is unavailable.', 400); |
|
| 161 | + throw new OutOfBoundsException(__METHOD__.' is unavailable.', 400); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | unset($offset); |
| 178 | 178 | |
| 179 | - throw new OutOfBoundsException(__METHOD__ . ' is unavailable.', 400); |
|
| 179 | + throw new OutOfBoundsException(__METHOD__.' is unavailable.', 400); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -209,8 +209,8 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | $this->invoke(); |
| 211 | 211 | assert($this->result instanceof ResourceObject); |
| 212 | - if (! is_array($this->result->body) || ! array_key_exists($offset, $this->result->body)) { |
|
| 213 | - throw new OutOfBoundsException("[{$offset}] for object[" . $this->result::class . ']', 400); |
|
| 212 | + if (!is_array($this->result->body) || !array_key_exists($offset, $this->result->body)) { |
|
| 213 | + throw new OutOfBoundsException("[{$offset}] for object[".$this->result::class.']', 400); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | return $this->result->body[$offset]; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | #[Override] |
| 251 | 251 | public function hash(): string |
| 252 | 252 | { |
| 253 | - return md5($this->resourceObject::class . $this->method . serialize($this->query) . serialize($this->links)); |
|
| 253 | + return md5($this->resourceObject::class.$this->method.serialize($this->query).serialize($this->links)); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function __serialize() |
| 264 | 264 | { |
| 265 | - throw new LogicException(__METHOD__ . ' not supported'); |
|
| 265 | + throw new LogicException(__METHOD__.' not supported'); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ) { |
| 39 | 39 | $this->type = $type->getName(); |
| 40 | 40 | $this->isDefaultAvailable = $parameter->isDefaultValueAvailable(); |
| 41 | - if (! $this->isDefaultAvailable) { |
|
| 41 | + if (!$this->isDefaultAvailable) { |
|
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | $refEnum = new ReflectionEnum($type); |
| 117 | 117 | assert(enum_exists($type)); |
| 118 | 118 | |
| 119 | - if (! $refEnum->isBacked()) { |
|
| 119 | + if (!$refEnum->isBacked()) { |
|
| 120 | 120 | throw new NotBackedEnumException($type); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | assert(is_a($type, BackedEnum::class, true)); |
| 124 | - if (! (is_int($props) || is_string($props))) { |
|
| 124 | + if (!(is_int($props) || is_string($props))) { |
|
| 125 | 125 | throw new ParameterEnumTypeException($varName); |
| 126 | 126 | } |
| 127 | 127 | |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | |
| 46 | 46 | $path = str_replace('-', '', ucwords($uri->path, '/-')); |
| 47 | 47 | /** @var ''|class-string $class */ |
| 48 | - $class = sprintf('%s\Resource\%s', $this->namespace, str_replace('/', '\\', ucwords($uri->scheme) . $path)); |
|
| 48 | + $class = sprintf('%s\Resource\%s', $this->namespace, str_replace('/', '\\', ucwords($uri->scheme).$path)); |
|
| 49 | 49 | try { |
| 50 | 50 | $instance = $this->injector->getInstance($class); |
| 51 | 51 | assert($instance instanceof ResourceObject); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | private function embedResource(array $embeds, ResourceObject $ro, array $query): void |
| 61 | 61 | { |
| 62 | 62 | foreach ($embeds as $embed) { |
| 63 | - if (! $embed instanceof Embed) { |
|
| 63 | + if (!$embed instanceof Embed) { |
|
| 64 | 64 | continue; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | private function getFullUri(string $uri, ResourceObject $ro): string |
| 91 | 91 | { |
| 92 | 92 | if ($uri[0] === '/') { |
| 93 | - $uri = "{$ro->uri->scheme}://{$ro->uri->host}" . $uri; |
|
| 93 | + $uri = "{$ro->uri->scheme}://{$ro->uri->host}".$uri; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | return $uri; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $ro->body = []; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if (! is_array($ro->body)) { |
|
| 105 | + if (!is_array($ro->body)) { |
|
| 106 | 106 | throw new LinkException($embed->rel); // @codeCoverageIgnore |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | 'headers' => $this->headers, |
| 47 | 47 | 'body' => $this->body, |
| 48 | 48 | 'view' => $this->view, |
| 49 | - ] = $this->httpRequest->request($method, (string) $uri, $uri->query); |
|
| 49 | + ] = $this->httpRequest->request($method, (string) $uri, $uri->query); |
|
| 50 | 50 | |
| 51 | 51 | return $this; |
| 52 | 52 | } |