@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $scheme = array_shift($classPath); |
| 59 | 59 | assert(is_string($scheme)); |
| 60 | 60 | |
| 61 | - return strtolower("{$scheme}://self/" . implode('/', $classPath)); |
|
| 61 | + return strtolower("{$scheme}://self/".implode('/', $classPath)); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | private function getOptions(string $class): Options |
| 70 | 70 | { |
| 71 | - if (! class_exists($class)) { |
|
| 71 | + if (!class_exists($class)) { |
|
| 72 | 72 | throw new LogicException(); // @codeCoverageIgnore |
| 73 | 73 | } |
| 74 | 74 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $allows = []; |
| 94 | 94 | foreach ($methods as $method) { |
| 95 | - $isRequestMethod = str_starts_with($method->name, 'on') && ! str_starts_with($method->name, 'onLink'); |
|
| 96 | - if (! $isRequestMethod) { |
|
| 95 | + $isRequestMethod = str_starts_with($method->name, 'on') && !str_starts_with($method->name, 'onLink'); |
|
| 96 | + if (!$isRequestMethod) { |
|
| 97 | 97 | continue; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** @param ResourceClassName $class */ |
| 107 | 107 | private function getParams(string $class, string $method): Params |
| 108 | 108 | { |
| 109 | - $refMethod = new ReflectionMethod($class, 'on' . $method); |
|
| 109 | + $refMethod = new ReflectionMethod($class, 'on'.$method); |
|
| 110 | 110 | $parameters = $refMethod->getParameters(); |
| 111 | 111 | $optionalParams = $requiredParams = []; |
| 112 | 112 | foreach ($parameters as $parameter) { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @psalm-suppress RedundantCondition for BC |
| 40 | 40 | */ |
| 41 | - private function getParameterType(ReflectionParameter $parameter, array $paramDoc, string $name): string|null |
|
| 41 | + private function getParameterType(ReflectionParameter $parameter, array $paramDoc, string $name): string | null |
|
| 42 | 42 | { |
| 43 | 43 | /** @phpstan-ignore function.alreadyNarrowedType */ |
| 44 | 44 | $hasType = method_exists($parameter, 'getType') && $parameter->getType(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $paramDoc[$name]['in'] = $ins[$parameter->name]; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if (! isset($paramDoc[$parameter->name])) { |
|
| 67 | + if (!isset($paramDoc[$parameter->name])) { |
|
| 68 | 68 | $paramDoc[$name] = []; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $method = new ReflectionMethod($callable[0], $callable[1]); // @phpstan-ignore-line |
| 40 | 40 | $paramMetas = $this->getAttributeParamMetas($method); |
| 41 | 41 | |
| 42 | - if (! $paramMetas) { |
|
| 42 | + if (!$paramMetas) { |
|
| 43 | 43 | $paramMetas = $this->getAnnotationParamMetas($method); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $names[$annotation->param] = new AssistedResourceParam($annotation); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if (! ($annotation instanceof Assisted)) { |
|
| 124 | + if (!($annotation instanceof Assisted)) { |
|
| 125 | 125 | continue; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | $webcontext = []; |
| 144 | 144 | foreach ($annotations as $annotation) { |
| 145 | - if (! ($annotation instanceof AbstractWebContextParam)) { |
|
| 145 | + if (!($annotation instanceof AbstractWebContextParam)) { |
|
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** @psalm-return DefaultParam<mixed>|NoDefaultParam */ |
| 221 | - private function getDefault(ReflectionParameter $parameter): DefaultParam|NoDefaultParam |
|
| 221 | + private function getDefault(ReflectionParameter $parameter): DefaultParam | NoDefaultParam |
|
| 222 | 222 | { |
| 223 | 223 | return $parameter->isDefaultValueAvailable() === true ? new DefaultParam($parameter->getDefaultValue()) : new NoDefaultParam(); |
| 224 | 224 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | private function getParam(ReflectionParameter $parameter): ParamInterface |
| 249 | 249 | { |
| 250 | 250 | $type = $parameter->getType(); |
| 251 | - if ($type instanceof ReflectionNamedType && ! $type->isBuiltin()) { |
|
| 251 | + if ($type instanceof ReflectionNamedType && !$type->isBuiltin()) { |
|
| 252 | 252 | return new ClassParam($type, $parameter); |
| 253 | 253 | } |
| 254 | 254 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function addHalLink(array $body, array $methodAnnotations, Hal $hal): Hal |
| 37 | 37 | { |
| 38 | - if (! empty($methodAnnotations)) { |
|
| 38 | + if (!empty($methodAnnotations)) { |
|
| 39 | 39 | $hal = $this->linkAnnotation($body, $methodAnnotations, $hal); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | private function linkAnnotation(array $body, array $methodAnnotations, Hal $hal): Hal |
| 55 | 55 | { |
| 56 | 56 | foreach ($methodAnnotations as $annotation) { |
| 57 | - if (! $annotation instanceof Link) { |
|
| 57 | + if (!$annotation instanceof Link) { |
|
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | private function bodyLink(array $body, Hal $hal): Hal |
| 81 | 81 | { |
| 82 | 82 | foreach ($body['_links'] as $rel => $link) { |
| 83 | - if (! isset($link['href'])) { |
|
| 83 | + if (!isset($link['href'])) { |
|
| 84 | 84 | // @codeCoverageIgnoreStart |
| 85 | 85 | continue; |
| 86 | 86 | // @codeCoverageIgnoreEnd |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | private function annotationLink(LinkType $link, ResourceObject $current, AbstractRequest $request): ResourceObject |
| 111 | 111 | { |
| 112 | - if (! is_array($current->body)) { |
|
| 113 | - throw new Exception\LinkQueryException('Only array is allowed for link in ' . $current::class, 500); |
|
| 112 | + if (!is_array($current->body)) { |
|
| 113 | + throw new Exception\LinkQueryException('Only array is allowed for link in '.$current::class, 500); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $classMethod = 'on' . ucfirst($request->method); |
|
| 116 | + $classMethod = 'on'.ucfirst($request->method); |
|
| 117 | 117 | /** @var list<Link> $annotations */ |
| 118 | 118 | $annotations = (new ReflectionMethod($current::class, $classMethod))->getAnnotations(); |
| 119 | 119 | if ($link->type === LinkType::CRAWL_LINK) { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | return $this->invoker->invoke($request); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - throw new LinkRelException("rel:{$link->key} class:" . $current::class, 500); |
|
| 154 | + throw new LinkRelException("rel:{$link->key} class:".$current::class, 500); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | private function crawl(array $annotations, LinkType $link, array &$body): void |
| 191 | 191 | { |
| 192 | 192 | foreach ($annotations as $annotation) { |
| 193 | - if (! $annotation instanceof Link || $annotation->crawl !== $link->key) { |
|
| 193 | + if (!$annotation instanceof Link || $annotation->crawl !== $link->key) { |
|
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | 196 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** @return Body|null */ |
| 215 | - private function getResponseBody(Request $request): array|null |
|
| 215 | + private function getResponseBody(Request $request): array | null |
|
| 216 | 216 | { |
| 217 | 217 | $body = $this->invokeRecursive($request)->body; |
| 218 | 218 | assert(is_array($body) || $body === null); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** @return Body */ |
| 36 | 36 | private function fakeResponse(string $schemaFile): array |
| 37 | 37 | { |
| 38 | - if (! class_exists(Faker::class)) { |
|
| 38 | + if (!class_exists(Faker::class)) { |
|
| 39 | 39 | throw new LogicException('"koriym/json-schema-faker" not installed. Please run "composer require koriym/json-schema-faker --dev". See more at https://github.com/bearsunday/BEAR.Resource/wiki/json_schema_faker_required'); // @codeCoverageIgnore |
| 40 | 40 | } |
| 41 | 41 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return Body |
| 52 | 52 | */ |
| 53 | - private function deepArray(array|stdClass $values): array |
|
| 53 | + private function deepArray(array | stdClass $values): array |
|
| 54 | 54 | { |
| 55 | 55 | $result = []; |
| 56 | 56 | /** @psalm-suppress MixedAssignment */ |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | private function getUserFileUploads(string $varName, array $query): array |
| 66 | 66 | { |
| 67 | 67 | $fileUploads = $query[$varName]; |
| 68 | - if (! is_array($fileUploads)) { |
|
| 68 | + if (!is_array($fileUploads)) { |
|
| 69 | 69 | throw new InvalidArgumentException($varName); // Invalid type of array |
| 70 | 70 | } |
| 71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | assert(count($fileUploads) > 0); |
| 75 | 75 | foreach ($fileUploads as $fileUpload) { |
| 76 | - if (! ($fileUpload instanceof FileUpload) && ! ($fileUpload instanceof ErrorFileUpload)) { |
|
| 76 | + if (!($fileUpload instanceof FileUpload) && !($fileUpload instanceof ErrorFileUpload)) { |
|
| 77 | 77 | throw new InvalidArgumentException($varName); // Invalid item of array tye of FileUpload or ErrorFileUpload |
| 78 | 78 | } |
| 79 | 79 | } |