Skip to content

Commit b40960a

Browse files
committedMar 5, 2024
style: various cs fixes
1 parent 5bd9f45 commit b40960a

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed
 

‎Factory/OpenApiFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ final class OpenApiFactory implements OpenApiFactoryInterface
6969
*/
7070
public const OPENAPI_DEFINITION_NAME = 'openapi_definition_name';
7171

72-
public function __construct(private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, private readonly SchemaFactoryInterface $jsonSchemaFactory, private readonly TypeFactoryInterface $jsonSchemaTypeFactory, ContainerInterface $filterLocator, private readonly array $formats = [], Options $openApiOptions = null, PaginationOptions $paginationOptions = null, private readonly ?RouterInterface $router = null)
72+
public function __construct(private readonly ResourceNameCollectionFactoryInterface $resourceNameCollectionFactory, private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory, private readonly PropertyNameCollectionFactoryInterface $propertyNameCollectionFactory, private readonly PropertyMetadataFactoryInterface $propertyMetadataFactory, private readonly SchemaFactoryInterface $jsonSchemaFactory, private readonly TypeFactoryInterface $jsonSchemaTypeFactory, ContainerInterface $filterLocator, private readonly array $formats = [], ?Options $openApiOptions = null, ?PaginationOptions $paginationOptions = null, private readonly ?RouterInterface $router = null)
7373
{
7474
$this->filterLocator = $filterLocator;
7575
$this->openApiOptions = $openApiOptions ?: new Options('API Platform');
@@ -387,7 +387,7 @@ private function collectPaths(ApiResource $resource, ResourceMetadataCollection
387387
}
388388
}
389389

390-
private function buildOpenApiResponse(array $existingResponses, int|string $status, string $description, Model\Operation $openapiOperation = null, HttpOperation $operation = null, array $responseMimeTypes = null, array $operationOutputSchemas = null, ResourceMetadataCollection $resourceMetadataCollection = null): Model\Operation
390+
private function buildOpenApiResponse(array $existingResponses, int|string $status, string $description, ?Model\Operation $openapiOperation = null, ?HttpOperation $operation = null, ?array $responseMimeTypes = null, ?array $operationOutputSchemas = null, ?ResourceMetadataCollection $resourceMetadataCollection = null): Model\Operation
391391
{
392392
if (isset($existingResponses[$status])) {
393393
return $openapiOperation;

‎Model/Components.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class Components
3131
* @param \ArrayObject<string, array<string, PathItem>>|\ArrayObject<string, array<string, Reference>> $callbacks
3232
* @param \ArrayObject<string, PathItem>|\ArrayObject<string, Reference> $pathItems
3333
*/
34-
public function __construct(\ArrayObject $schemas = null, private ?\ArrayObject $responses = null, private ?\ArrayObject $parameters = null, private ?\ArrayObject $examples = null, private ?\ArrayObject $requestBodies = null, private ?\ArrayObject $headers = null, private ?\ArrayObject $securitySchemes = null, private ?\ArrayObject $links = null, private ?\ArrayObject $callbacks = null, private ?\ArrayObject $pathItems = null)
34+
public function __construct(?\ArrayObject $schemas = null, private ?\ArrayObject $responses = null, private ?\ArrayObject $parameters = null, private ?\ArrayObject $examples = null, private ?\ArrayObject $requestBodies = null, private ?\ArrayObject $headers = null, private ?\ArrayObject $securitySchemes = null, private ?\ArrayObject $links = null, private ?\ArrayObject $callbacks = null, private ?\ArrayObject $pathItems = null)
3535
{
3636
$schemas?->ksort();
3737

‎Model/Operation.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function withParameter(Parameter $parameter): self
167167
return $clone;
168168
}
169169

170-
public function withRequestBody(RequestBody $requestBody = null): self
170+
public function withRequestBody(?RequestBody $requestBody = null): self
171171
{
172172
$clone = clone $this;
173173
$clone->requestBody = $requestBody;
@@ -191,15 +191,15 @@ public function withDeprecated(bool $deprecated): self
191191
return $clone;
192192
}
193193

194-
public function withSecurity(array $security = null): self
194+
public function withSecurity(?array $security = null): self
195195
{
196196
$clone = clone $this;
197197
$clone->security = $security;
198198

199199
return $clone;
200200
}
201201

202-
public function withServers(array $servers = null): self
202+
public function withServers(?array $servers = null): self
203203
{
204204
$clone = clone $this;
205205
$clone->servers = $servers;

‎Model/PathItem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public function withTrace(Operation $trace): self
176176
return $clone;
177177
}
178178

179-
public function withServers(array $servers = null): self
179+
public function withServers(?array $servers = null): self
180180
{
181181
$clone = clone $this;
182182
$clone->servers = $servers;

‎Serializer/ApiGatewayNormalizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(private readonly NormalizerInterface $documentationN
4444
*
4545
* @throws UnexpectedValueException
4646
*/
47-
public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
47+
public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null
4848
{
4949
$data = $this->documentationNormalizer->normalize($object, $format, $context);
5050
if (!\is_array($data)) {
@@ -116,7 +116,7 @@ public function normalize(mixed $object, string $format = null, array $context =
116116
/**
117117
* {@inheritdoc}
118118
*/
119-
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
119+
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
120120
{
121121
return $this->documentationNormalizer->supportsNormalization($data, $format);
122122
}

‎Serializer/OpenApiNormalizer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(private readonly NormalizerInterface $decorated)
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function normalize(mixed $object, string $format = null, array $context = []): array
38+
public function normalize(mixed $object, ?string $format = null, array $context = []): array
3939
{
4040
$pathsCallback = static fn ($innerObject): array => $innerObject instanceof Paths ? $innerObject->getPaths() : [];
4141
$context[AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS] = true;
@@ -70,7 +70,7 @@ private function recursiveClean(array $data): array
7070
/**
7171
* {@inheritdoc}
7272
*/
73-
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
73+
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
7474
{
7575
return self::FORMAT === $format && $data instanceof OpenApi;
7676
}

‎Tests/Fixtures/Dummy.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ public function getFoo(): ?array
156156
return $this->foo;
157157
}
158158

159-
public function setFoo(array $foo = null): void
159+
public function setFoo(?array $foo = null): void
160160
{
161161
$this->foo = $foo;
162162
}
163163

164-
public function setDummyDate(\DateTime $dummyDate = null): void
164+
public function setDummyDate(?\DateTime $dummyDate = null): void
165165
{
166166
$this->dummyDate = $dummyDate;
167167
}

0 commit comments

Comments
 (0)
Please sign in to comment.