Skip to content

Commit 1371f1c

Browse files
loic425soyuka
andauthored
Apply suggestions from code review
Co-authored-by: Antoine Bluchet <[email protected]>
1 parent 1b3ab0e commit 1371f1c

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

src/Metadata/AsOperationMutator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\Metadata;
1515

1616
#[\Attribute(\Attribute::TARGET_CLASS)]
17-
final class AsOperationMutator
17+
class AsOperationMutator
1818
{
1919
public function __construct(
2020
public readonly string $operationName,

src/Metadata/AsResourceMutator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
namespace ApiPlatform\Metadata;
1515

1616
#[\Attribute(\Attribute::TARGET_CLASS)]
17-
final class AsResourceMutator
17+
class AsResourceMutator
1818
{
1919
/**
2020
* @param class-string $resourceClass

src/Metadata/Mutator/OperationMutatorCollection.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818

1919
final class OperationMutatorCollection implements ContainerInterface
2020
{
21-
private array $mutators;
21+
private array $mutators = [];
2222

23-
public function addMutator(string $operationName, OperationMutatorInterface $mutator): void
23+
/**
24+
* Adds a mutator to the container for a given operation name.
25+
*/
26+
public function add(string $operationName, OperationMutatorInterface $mutator): void
2427
{
2528
$this->mutators[$operationName][] = $mutator;
2629
}

src/Symfony/Bundle/DependencyInjection/Compiler/OperationMutatorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function process(ContainerBuilder $container): void
3131

3232
foreach ($mutators as $id => $tags) {
3333
foreach ($tags as $tag) {
34-
$definition->addMethodCall('addMutator', [
34+
$definition->addMethodCall('add', [
3535
$tag['operationName'],
3636
new Reference($id),
3737
]);

src/Symfony/Bundle/DependencyInjection/Compiler/ResourceMutatorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function process(ContainerBuilder $container): void
3131

3232
foreach ($mutators as $id => $tags) {
3333
foreach ($tags as $tag) {
34-
$definition->addMethodCall('addMutator', [
34+
$definition->addMethodCall('add', [
3535
$tag['resourceClass'],
3636
new Reference($id),
3737
]);

0 commit comments

Comments
 (0)