Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/MongoDbOdm/PropertyHelperTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function addLookupsForNestedProperty(string $property, Builder $aggreg
}

if ($classMetadata->hasReference($association)) {
$propertyAlias = "${association}_lkup";
$propertyAlias = "{$association}_lkup";
// previous_association_lkup.association
$localField = "$alias$association";
// previous_association_lkup.association_lkup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getDescription(string $resourceClass): array
continue;
}

foreach ([$property, "${property}[]"] as $filterParameterName) {
foreach ([$property, "{$property}[]"] as $filterParameterName) {
$description[$filterParameterName] = [
'property' => $property,
'type' => $hasAssociation ? 'string' : $this->getPhpType($type),
Expand Down Expand Up @@ -138,7 +138,7 @@ protected function getPhpType(Type $type): string
return \DateTimeInterface::class;
}

// no break
// no break
default:
return 'string';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Symfony/Bundle/Command/SwaggerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*
* @author Amrouche Hamza <hamza.simperfit@gmail.com>
*/
#[AsCommand(name: 'swagger:export', description: 'Dump the Swagger v2 documentation')]
#[AsCommand(name: 'api:swagger:export', description: 'Dump the Swagger v2 documentation')]
final class SwaggerCommand extends Command
{
/**
Expand Down
12 changes: 6 additions & 6 deletions src/Bridge/Symfony/Messenger/DataTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public function supportsTransformation($data, string $to, array $context = []):
}

return 'input' === $metadata->getTypedOperationAttribute(
$context['operation_type'],
$context[$context['operation_type'].'_operation_name'] ?? '',
'messenger',
null,
true
);
$context['operation_type'],
$context[$context['operation_type'].'_operation_name'] ?? '',
'messenger',
null,
true
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ public function onKernelException(ExceptionEvent $event): void
$format = ErrorFormatGuesser::guessErrorFormat($event->getRequest(), $this->errorFormats);

$event->setResponse(new Response(
$this->serializer->serialize($exception instanceof ValidationException ? $exception->getConstraintViolationList() : $exception, $format['key']),
$statusCode,
[
'Content-Type' => sprintf('%s; charset=utf-8', $format['value'][0]),
'X-Content-Type-Options' => 'nosniff',
'X-Frame-Options' => 'deny',
]
$this->serializer->serialize($exception instanceof ValidationException ? $exception->getConstraintViolationList() : $exception, $format['key']),
$statusCode,
[
'Content-Type' => sprintf('%s; charset=utf-8', $format['value'][0]),
'X-Content-Type-Options' => 'nosniff',
'X-Frame-Options' => 'deny',
]
));
}
}
6 changes: 3 additions & 3 deletions src/EventListener/AddFormatListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public function onKernelRequest(RequestEvent $event): void
{
$request = $event->getRequest();
if (
!($request->attributes->has('_api_resource_class')
|| $request->attributes->getBoolean('_api_respond', false)
|| $request->attributes->getBoolean('_graphql', false))
!($request->attributes->has('_api_resource_class')
|| $request->attributes->getBoolean('_api_respond', false)
|| $request->attributes->getBoolean('_graphql', false))
) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/OpenApi/Factory/OpenApiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,12 @@ private function getFiltersParameters(ResourceMetadata $resourceMetadata, string
$data['openapi']['allowEmptyValue'] ?? true,
$schema,
'array' === $schema['type'] && \in_array($data['type'],
[Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_OBJECT], true) ? 'deepObject' : 'form',
[Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_OBJECT], true) ? 'deepObject' : 'form',
$data['openapi']['explode'] ?? ('array' === $schema['type']),
$data['openapi']['allowReserved'] ?? false,
$data['openapi']['example'] ?? null,
isset($data['openapi']['examples']
) ? new \ArrayObject($data['openapi']['examples']) : null);
) ? new \ArrayObject($data['openapi']['examples']) : null);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Swagger/Serializer/DocumentationNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ private function getPathOperation(bool $v3, string $operationName, array $operat
return $this->updatePostOperation($v3, $pathOperation, $requestMimeTypes, $responseMimeTypes, $operationType, $resourceMetadata, $resourceClass, $resourceShortName, $operationName, $definitions, $links);
case 'PATCH':
$pathOperation['summary'] ?? $pathOperation['summary'] = sprintf('Updates the %s resource.', $resourceShortName);
// no break
// no break
case 'PUT':
return $this->updatePutOperation($v3, $pathOperation, $requestMimeTypes, $responseMimeTypes, $operationType, $resourceMetadata, $resourceClass, $resourceShortName, $operationName, $definitions);
case 'DELETE':
Expand Down
2 changes: 1 addition & 1 deletion tests/Annotation/ApiFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testAssignationAttribute()
$filter = eval(<<<'PHP'
return new \ApiPlatform\Core\Annotation\ApiFilter(\ApiPlatform\Core\Tests\Fixtures\DummyFilter::class, strategy: 'test', properties: ['one', 'two'], arguments: ['args']);
PHP
);
);

$this->assertEquals($filter->filterClass, DummyFilter::class);
$this->assertEquals($filter->strategy, 'test');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public function testToString()
message 1
foo: message 2
TXT
), $e->__toString());
), $e->__toString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ public function testCreateWithPropertyLengthRestriction(): void
$decoratedPropertyMetadataFactory = $this->prophesize(PropertyMetadataFactoryInterface::class);
$property = 'dummy';
$decoratedPropertyMetadataFactory->create(DummyValidatedEntity::class, $property, [])->willReturn(
new PropertyMetadata(new Type(Type::BUILTIN_TYPE_STRING))
)->shouldBeCalled();
new PropertyMetadata(new Type(Type::BUILTIN_TYPE_STRING))
)->shouldBeCalled();

$lengthRestrictions = new PropertySchemaLengthRestriction();
$validatorPropertyMetadataFactory = new ValidatorPropertyMetadataFactory(
Expand All @@ -283,8 +283,8 @@ public function testCreateWithPropertyRegexRestriction(): void

$decoratedPropertyMetadataFactory = $this->prophesize(PropertyMetadataFactoryInterface::class);
$decoratedPropertyMetadataFactory->create(DummyValidatedEntity::class, 'dummy', [])->willReturn(
new PropertyMetadata()
)->shouldBeCalled();
new PropertyMetadata()
)->shouldBeCalled();

$validationPropertyMetadataFactory = new ValidatorPropertyMetadataFactory(
$validatorMetadataFactory->reveal(), $decoratedPropertyMetadataFactory->reveal(),
Expand Down
2 changes: 1 addition & 1 deletion tests/EventListener/RespondListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function testHandleResponse()

$response = new Response();
$event = new ViewEvent(
$this->prophesize(HttpKernelInterface::class)->reveal(),
$this->prophesize(HttpKernelInterface::class)->reveal(),
new Request([], [], ['_api_resource_class' => Dummy::class, '_api_item_operation_name' => 'get', '_api_respond' => true]),
\defined(HttpKernelInterface::class.'::MAIN_REQUEST') ? HttpKernelInterface::MAIN_REQUEST : HttpKernelInterface::MASTER_REQUEST,
$response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ public function testCreateWithCollectionTypedParentPropertyMetadataFactoryYaml(P
$configPath = __DIR__.'/../../../Fixtures/FileConfigurations/resources.yml';

$collectionType = new Type(Type::BUILTIN_TYPE_OBJECT,
false,
ArrayCollection::class,
true,
new Type(Type::BUILTIN_TYPE_INT),
new Type(Type::BUILTIN_TYPE_OBJECT, false, RelatedDummy::class)
);
false,
ArrayCollection::class,
true,
new Type(Type::BUILTIN_TYPE_INT),
new Type(Type::BUILTIN_TYPE_OBJECT, false, RelatedDummy::class)
);

$expectedPropertyMetadata = $expectedPropertyMetadata->withType($collectionType);
$expectedPropertyMetadata = $expectedPropertyMetadata->withSubresource(new SubresourceMetadata(RelatedDummy::class, true, 1));
Expand Down
30 changes: 15 additions & 15 deletions tests/Operation/Factory/SubresourceOperationFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ public function testCreateWithMaxDepth()
$identifiersExtractorProphecy->getIdentifiersFromResourceClass(Argument::type('string'))->willReturn(['id']);

$subresourceOperationFactory = new SubresourceOperationFactory(
$resourceMetadataFactoryProphecy->reveal(),
$propertyNameCollectionFactoryProphecy->reveal(),
$propertyMetadataFactoryProphecy->reveal(),
$pathSegmentNameGeneratorProphecy->reveal(),
$identifiersExtractorProphecy->reveal()
$resourceMetadataFactoryProphecy->reveal(),
$propertyNameCollectionFactoryProphecy->reveal(),
$propertyMetadataFactoryProphecy->reveal(),
$pathSegmentNameGeneratorProphecy->reveal(),
$identifiersExtractorProphecy->reveal()
);

$this->assertEquals([
Expand Down Expand Up @@ -638,11 +638,11 @@ public function testCreateWithEnd()
$identifiersExtractorProphecy->getIdentifiersFromResourceClass(Argument::type('string'))->willReturn(['id']);

$subresourceOperationFactory = new SubresourceOperationFactory(
$resourceMetadataFactoryProphecy->reveal(),
$propertyNameCollectionFactoryProphecy->reveal(),
$propertyMetadataFactoryProphecy->reveal(),
$pathSegmentNameGeneratorProphecy->reveal(),
$identifiersExtractorProphecy->reveal()
$resourceMetadataFactoryProphecy->reveal(),
$propertyNameCollectionFactoryProphecy->reveal(),
$propertyMetadataFactoryProphecy->reveal(),
$pathSegmentNameGeneratorProphecy->reveal(),
$identifiersExtractorProphecy->reveal()
);

$result = $subresourceOperationFactory->create(DummyEntity::class);
Expand Down Expand Up @@ -700,11 +700,11 @@ public function testCreateWithEndButNoCollection()
$identifiersExtractorProphecy->getIdentifiersFromResourceClass(Argument::type('string'))->willReturn(['id']);

$subresourceOperationFactory = new SubresourceOperationFactory(
$resourceMetadataFactoryProphecy->reveal(),
$propertyNameCollectionFactoryProphecy->reveal(),
$propertyMetadataFactoryProphecy->reveal(),
$pathSegmentNameGeneratorProphecy->reveal(),
$identifiersExtractorProphecy->reveal()
$resourceMetadataFactoryProphecy->reveal(),
$propertyNameCollectionFactoryProphecy->reveal(),
$propertyMetadataFactoryProphecy->reveal(),
$pathSegmentNameGeneratorProphecy->reveal(),
$identifiersExtractorProphecy->reveal()
);

$result = $subresourceOperationFactory->create(DummyEntity::class);
Expand Down