Skip to content

Commit 85d60f5

Browse files
Merge pull request #4828 from vincentchalamon/fix/serialize-listener
fix: ignore no-operation on SerializeListener
2 parents 01c3c0c + 22bd1bf commit 85d60f5

File tree

36 files changed

+255
-131
lines changed

36 files changed

+255
-131
lines changed

features/main/operation.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ Feature: Operation support
8383
"id": 1
8484
}
8585
"""
86+
87+
Scenario: Call a non API Platform route
88+
When I send a "GET" request to "/common/custom/object"
89+
Then the response status code should be 200
90+
And the response should be in JSON
91+
And the JSON should be equal to:
92+
"""
93+
{
94+
"id": 1,
95+
"text": "Lorem ipsum dolor sit amet"
96+
}
97+
"""

src/Core/Bridge/Doctrine/MongoDbOdm/PropertyHelperTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function addLookupsForNestedProperty(string $property, Builder $aggreg
6161
}
6262

6363
if ($classMetadata->hasReference($association)) {
64-
$propertyAlias = "${association}_lkup";
64+
$propertyAlias = "{$association}_lkup";
6565
// previous_association_lkup.association
6666
$localField = "$alias$association";
6767
// previous_association_lkup.association_lkup

src/Core/Bridge/Elasticsearch/DataProvider/Filter/AbstractSearchFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function getDescription(string $resourceClass): array
104104
continue;
105105
}
106106

107-
foreach ([$property, "${property}[]"] as $filterParameterName) {
107+
foreach ([$property, "{$property}[]"] as $filterParameterName) {
108108
$description[$filterParameterName] = [
109109
'property' => $property,
110110
'type' => $hasAssociation ? 'string' : $this->getPhpType($type),
@@ -138,7 +138,7 @@ protected function getPhpType(Type $type): string
138138
return \DateTimeInterface::class;
139139
}
140140

141-
// no break
141+
// no break
142142
default:
143143
return 'string';
144144
}

src/Core/Bridge/Symfony/Messenger/DataTransformer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ public function supportsTransformation($data, string $to, array $context = []):
8888
}
8989

9090
return 'input' === $metadata->getTypedOperationAttribute(
91-
$context['operation_type'],
92-
$context[$context['operation_type'].'_operation_name'] ?? '',
93-
'messenger',
94-
null,
95-
true
96-
);
91+
$context['operation_type'],
92+
$context[$context['operation_type'].'_operation_name'] ?? '',
93+
'messenger',
94+
null,
95+
true
96+
);
9797
}
9898
}

src/Core/OpenApi/Factory/OpenApiFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,12 @@ private function getFiltersParameters(ResourceMetadata $resourceMetadata, string
424424
$data['openapi']['allowEmptyValue'] ?? true,
425425
$schema,
426426
'array' === $schema['type'] && \in_array($data['type'],
427-
[Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_OBJECT], true) ? 'deepObject' : 'form',
427+
[Type::BUILTIN_TYPE_ARRAY, Type::BUILTIN_TYPE_OBJECT], true) ? 'deepObject' : 'form',
428428
$data['openapi']['explode'] ?? ('array' === $schema['type']),
429429
$data['openapi']['allowReserved'] ?? false,
430430
$data['openapi']['example'] ?? null,
431431
isset($data['openapi']['examples']
432-
) ? new \ArrayObject($data['openapi']['examples']) : null);
432+
) ? new \ArrayObject($data['openapi']['examples']) : null);
433433
}
434434
}
435435

src/Core/Swagger/Serializer/DocumentationNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ private function getPathOperation(bool $v3, string $operationName, array $operat
346346
return $this->updatePostOperation($v3, $pathOperation, $requestMimeTypes, $responseMimeTypes, $operationType, $resourceMetadata, $resourceClass, $resourceShortName, $operationName, $definitions, $links);
347347
case 'PATCH':
348348
$pathOperation['summary'] ?? $pathOperation['summary'] = sprintf('Updates the %s resource.', $resourceShortName);
349-
// no break
349+
// no break
350350
case 'PUT':
351351
return $this->updatePutOperation($v3, $pathOperation, $requestMimeTypes, $responseMimeTypes, $operationType, $resourceMetadata, $resourceClass, $resourceShortName, $operationName, $definitions);
352352
case 'DELETE':

src/Core/Upgrade/UpgradeApiResourceVisitor.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,17 @@ public function enterNode(Node $node)
223223
$identifierNodes = [
224224
'compositeIdentifier' => new Node\Expr\ConstFetch(new Node\Name('false')),
225225
'fromClass' => new Node\Expr\ClassConstFetch(
226-
new Node\Name(
227-
'self'
228-
),
229-
'class'
226+
new Node\Name(
227+
'self'
230228
),
229+
'class'
230+
),
231231
'identifiers' => new Node\Expr\Array_(
232-
[
233-
new Node\Expr\ArrayItem(new Node\Scalar\String_($identifier)),
234-
],
235-
['kind' => Node\Expr\Array_::KIND_SHORT]
236-
),
232+
[
233+
new Node\Expr\ArrayItem(new Node\Scalar\String_($identifier)),
234+
],
235+
['kind' => Node\Expr\Array_::KIND_SHORT]
236+
),
237237
];
238238

239239
$identifierNodeItems[] = new Node\Expr\ArrayItem(

src/Core/Upgrade/UpgradeApiSubresourceVisitor.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ public function enterNode(Node $node)
123123
foreach ($this->subresourceMetadata['uri_variables'] as $identifier => $resource) {
124124
$identifierNodes = [
125125
'fromClass' => new Node\Expr\ClassConstFetch(
126-
new Node\Name(
127-
($resource['from_class'] === $this->subresourceMetadata['resource_class']) ? 'self' : '\\'.$resource['from_class']
128-
),
129-
'class'
126+
new Node\Name(
127+
($resource['from_class'] === $this->subresourceMetadata['resource_class']) ? 'self' : '\\'.$resource['from_class']
130128
),
129+
'class'
130+
),
131131
'identifiers' => new Node\Expr\Array_(
132-
isset($resource['identifiers'][0]) ? [
133-
new Node\Expr\ArrayItem(new Node\Scalar\String_($resource['identifiers'][0])),
134-
] : [],
135-
['kind' => Node\Expr\Array_::KIND_SHORT]
136-
),
132+
isset($resource['identifiers'][0]) ? [
133+
new Node\Expr\ArrayItem(new Node\Scalar\String_($resource['identifiers'][0])),
134+
] : [],
135+
['kind' => Node\Expr\Array_::KIND_SHORT]
136+
),
137137
];
138138

139139
if (isset($resource['expanded_value'])) {
@@ -256,23 +256,23 @@ public function enterNode(Node $node)
256256
}
257257

258258
$arguments[] = new Node\Arg(
259-
new Node\Expr\Array_(
260-
[
261-
new Node\Expr\ArrayItem(
262-
new Node\Expr\New_(
263-
new Node\Name($this->subresourceMetadata['collection'] ? 'GetCollection' : 'Get')
264-
),
259+
new Node\Expr\Array_(
260+
[
261+
new Node\Expr\ArrayItem(
262+
new Node\Expr\New_(
263+
new Node\Name($this->subresourceMetadata['collection'] ? 'GetCollection' : 'Get')
265264
),
266-
],
267-
[
268-
'kind' => Node\Expr\Array_::KIND_SHORT,
269-
]
270-
),
271-
false,
272-
false,
273-
[],
274-
new Node\Identifier('operations')
275-
);
265+
),
266+
],
267+
[
268+
'kind' => Node\Expr\Array_::KIND_SHORT,
269+
]
270+
),
271+
false,
272+
false,
273+
[],
274+
new Node\Identifier('operations')
275+
);
276276

277277
$apiResourceAttribute =
278278
new Node\AttributeGroup([

src/Doctrine/EventListener/PublishMercureUpdatesListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public function __construct(ResourceClassResolverInterface $resourceClassResolve
9999
$this->expressionLanguage->addFunction(
100100
new ExpressionFunction('iri', static function (string $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL): string {
101101
return sprintf('iri(%s, %d)', $apiResource, $referenceType);
102-
}, static function (array $arguments, $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL) use ($iriConverter): string {
103-
return $iriConverter->getIriFromResource($apiResource, $referenceType);
104-
})
102+
}, static function (array $arguments, $apiResource, int $referenceType = UrlGeneratorInterface::ABS_URL) use ($iriConverter): string {
103+
return $iriConverter->getIriFromResource($apiResource, $referenceType);
104+
})
105105
);
106106
}
107107
}

src/Doctrine/Odm/PropertyHelperTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function addLookupsForNestedProperty(string $property, Builder $aggreg
6161
}
6262

6363
if ($classMetadata->hasReference($association)) {
64-
$propertyAlias = "${association}_lkup";
64+
$propertyAlias = "{$association}_lkup";
6565
// previous_association_lkup.association
6666
$localField = "$alias$association";
6767
// previous_association_lkup.association_lkup

0 commit comments

Comments
 (0)