Skip to content

Commit 8a22893

Browse files
committed
fix: run cs fixer
1 parent 5761219 commit 8a22893

File tree

12 files changed

+78
-27
lines changed

12 files changed

+78
-27
lines changed

src/Doctrine/Common/State/ModelTransformerLocatorTrait.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <dunglas@gmail.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
314
namespace ApiPlatform\Doctrine\Common\State;
415

516
use ApiPlatform\Metadata\Operation;

src/Doctrine/Common/State/Options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Options implements OptionsInterface
2222
*/
2323
public function __construct(
2424
protected mixed $handleLinks = null,
25-
protected mixed $transformModel = null
25+
protected mixed $transformModel = null,
2626
) {
2727
}
2828

src/Doctrine/Odm/State/CollectionProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ApiPlatform\Doctrine\Odm\State;
1515

16-
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1716
use ApiPlatform\Doctrine\Common\State\LinksHandlerLocatorTrait;
17+
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1818
use ApiPlatform\Doctrine\Odm\Extension\AggregationCollectionExtensionInterface;
1919
use ApiPlatform\Doctrine\Odm\Extension\AggregationResultCollectionExtensionInterface;
2020
use ApiPlatform\Metadata\Exception\RuntimeException;
@@ -72,7 +72,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
7272
$extension->applyToCollection($aggregationBuilder, $documentClass, $operation, $context);
7373

7474
if ($extension instanceof AggregationResultCollectionExtensionInterface && $extension->supportsResult($documentClass, $operation, $context)) {
75-
$result = $extension->getResult($aggregationBuilder, $documentClass, $operation, $context);
75+
$result = $extension->getResult($aggregationBuilder, $documentClass, $operation, $context);
7676
break;
7777
}
7878
}
@@ -82,9 +82,9 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
8282

8383
$result = $result ?? $aggregationBuilder->hydrate($documentClass)->getAggregation($executeOptions)->getIterator();
8484

85-
return match($transformer = $this->getEntityTransformer($operation)){
85+
return match ($transformer = $this->getEntityTransformer($operation)) {
8686
null => $result,
87-
default => array_map($transformer, iterator_to_array($result))
87+
default => array_map($transformer, iterator_to_array($result)),
8888
};
8989
}
9090
}

src/Doctrine/Odm/State/ItemProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ApiPlatform\Doctrine\Odm\State;
1515

16-
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1716
use ApiPlatform\Doctrine\Common\State\LinksHandlerLocatorTrait;
17+
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1818
use ApiPlatform\Doctrine\Odm\Extension\AggregationItemExtensionInterface;
1919
use ApiPlatform\Doctrine\Odm\Extension\AggregationResultItemExtensionInterface;
2020
use ApiPlatform\Metadata\Exception\RuntimeException;
@@ -89,9 +89,9 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
8989

9090
$result = $result ?? ($aggregationBuilder->hydrate($documentClass)->getAggregation($executeOptions)->getIterator()->current() ?: null);
9191

92-
return match($transformer = $this->getEntityTransformer($operation)){
92+
return match ($transformer = $this->getEntityTransformer($operation)) {
9393
null => $result,
94-
default => ($result !== null)? $transformer($result) : null
94+
default => (null !== $result) ? $transformer($result) : null,
9595
};
9696
}
9797
}

src/Doctrine/Odm/State/Options.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class Options extends CommonOptions implements OptionsInterface
2020
{
2121
/**
22-
* @param mixed $handleLinks experimental callable, typed mixed as we may want a service name in the future
22+
* @param mixed $handleLinks experimental callable, typed mixed as we may want a service name in the future
2323
* @param mixed $transformDocument experimental callable, typed mixed as we may want a service name in the future
2424
*
2525
* @see LinksHandlerInterface
@@ -54,6 +54,7 @@ public function withTransformDocument(mixed $transformDocument): self
5454
{
5555
$self = clone $this;
5656
$self->transformModel = $transformDocument;
57+
5758
return $self;
5859
}
5960
}

src/Doctrine/Orm/State/CollectionProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ApiPlatform\Doctrine\Orm\State;
1515

16-
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1716
use ApiPlatform\Doctrine\Common\State\LinksHandlerLocatorTrait;
17+
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1818
use ApiPlatform\Doctrine\Orm\Extension\QueryCollectionExtensionInterface;
1919
use ApiPlatform\Doctrine\Orm\Extension\QueryResultCollectionExtensionInterface;
2020
use ApiPlatform\Doctrine\Orm\Util\QueryNameGenerator;
@@ -83,9 +83,9 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
8383

8484
$result = $result ?? $queryBuilder->getQuery()->getResult();
8585

86-
return match($transformer = $this->getEntityTransformer($operation)){
86+
return match ($transformer = $this->getEntityTransformer($operation)) {
8787
null => $result,
88-
default => array_map($transformer, iterator_to_array($result))
88+
default => array_map($transformer, iterator_to_array($result)),
8989
};
9090
}
9191
}

src/Doctrine/Orm/State/ItemProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
namespace ApiPlatform\Doctrine\Orm\State;
1515

16-
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1716
use ApiPlatform\Doctrine\Common\State\LinksHandlerLocatorTrait;
17+
use ApiPlatform\Doctrine\Common\State\ModelTransformerLocatorTrait;
1818
use ApiPlatform\Doctrine\Orm\Extension\QueryItemExtensionInterface;
1919
use ApiPlatform\Doctrine\Orm\Extension\QueryResultItemExtensionInterface;
2020
use ApiPlatform\Doctrine\Orm\Util\QueryNameGenerator;
@@ -92,9 +92,9 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
9292

9393
$result = $result ?? $queryBuilder->getQuery()->getOneOrNullResult();
9494

95-
return match($transformer = $this->getEntityTransformer($operation)){
95+
return match ($transformer = $this->getEntityTransformer($operation)) {
9696
null => $result,
97-
default=> $transformer($result)
97+
default => $transformer($result),
9898
};
9999
}
100100
}

src/Doctrine/Orm/State/Options.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
class Options extends CommonOptions implements OptionsInterface
2020
{
2121
/**
22-
* @param string|callable $handleLinks experimental callable, typed mixed as we may want a service name in the future
22+
* @param string|callable $handleLinks experimental callable, typed mixed as we may want a service name in the future
2323
* @param string|callable $transformEntity experimental callable, typed mixed as we may want a service name in the future
2424
*
2525
* @see LinksHandlerInterface
2626
*/
2727
public function __construct(
2828
protected ?string $entityClass = null,
2929
mixed $handleLinks = null,
30-
mixed $transformEntity = null
30+
mixed $transformEntity = null,
3131
) {
3232
parent::__construct(handleLinks: $handleLinks, transformModel: $transformEntity);
3333
}
@@ -54,6 +54,7 @@ public function withTransformDocument(mixed $transformEntity): self
5454
{
5555
$self = clone $this;
5656
$self->transformModel = $transformEntity;
57+
5758
return $self;
5859
}
5960
}

tests/Fixtures/TestBundle/ApiResource/TransformedDummyDocumentRessource.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
<?php
22

3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <dunglas@gmail.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
314
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource;
415

5-
use ApiPlatform\Doctrine\Orm\State\Options;
616
use ApiPlatform\Metadata\ApiResource;
717
use ApiPlatform\Metadata\Get;
818
use ApiPlatform\Metadata\GetCollection;
919
use ApiPlatform\Tests\Fixtures\TestBundle\Document\TransformedDummyDocument;
1020
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\TransformedDummyEntity;
1121

1222
#[ApiResource(
13-
operations :[
23+
operations : [
1424
new GetCollection(uriTemplate: '/transformed_dummy_document_ressources'),
1525
new Get(uriTemplate: '/transformed_dummy_document_ressources/{id}'),
1626
],
@@ -33,5 +43,4 @@ public static function transformModel(TransformedDummyEntity|TransformedDummyDoc
3343

3444
return $resource;
3545
}
36-
3746
}

tests/Fixtures/TestBundle/ApiResource/TransformedDummyEntityRessource.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
<?php
22

3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <dunglas@gmail.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
314
namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource;
415

516
use ApiPlatform\Doctrine\Orm\State\Options;
@@ -10,7 +21,7 @@
1021
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\TransformedDummyEntity;
1122

1223
#[ApiResource(
13-
operations :[
24+
operations : [
1425
new GetCollection(uriTemplate: '/transformed_dummy_entity_ressources'),
1526
new Get(uriTemplate: '/transformed_dummy_entity_ressources/{id}'),
1627
],
@@ -33,5 +44,4 @@ public static function transformModel(TransformedDummyEntity|TransformedDummyDoc
3344

3445
return $resource;
3546
}
36-
3747
}

0 commit comments

Comments
 (0)