Skip to content

Commit 0ed8fbc

Browse files
committed
chore: php-cs-fixer update
1 parent bbeaf70 commit 0ed8fbc

File tree

14 files changed

+52
-69
lines changed

14 files changed

+52
-69
lines changed

src/Metadata/Operations.php

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

1414
namespace ApiPlatform\Metadata;
1515

16-
use RuntimeException;
17-
1816
/**
1917
* @internal
2018
*/
@@ -73,7 +71,7 @@ public function remove(string $key): self
7371
}
7472
}
7573

76-
throw new RuntimeException(sprintf('Could not remove operation "%s".', $key));
74+
throw new \RuntimeException(sprintf('Could not remove operation "%s".', $key));
7775
}
7876

7977
public function has(string $key): bool

src/Symfony/Routing/SkolemIriConverter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use ApiPlatform\Api\UrlGeneratorInterface;
1818
use ApiPlatform\Exception\ItemNotFoundException;
1919
use ApiPlatform\Metadata\Operation;
20-
use SplObjectStorage;
2120
use Symfony\Component\Routing\RouterInterface;
2221

2322
/**
@@ -36,7 +35,7 @@ final class SkolemIriConverter implements IriConverterInterface
3635
public function __construct(RouterInterface $router)
3736
{
3837
$this->router = $router;
39-
$this->objectHashMap = new SplObjectStorage();
38+
$this->objectHashMap = new \SplObjectStorage();
4039
}
4140

4241
/**

src/Test/DoctrineMongoDbOdmTestCase.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
use PHPUnit\Framework\TestCase;
2121
use Symfony\Component\Cache\Adapter\ArrayAdapter;
2222

23-
use function sys_get_temp_dir;
24-
2523
/**
2624
* Source: https://github.com/doctrine/DoctrineMongoDBBundle/blob/0174003844bc566bb4cb3b7d10c5528d1924d719/Tests/TestCase.php
2725
* Test got excluded from vendor in 4.x.
@@ -32,8 +30,8 @@ public static function createTestDocumentManager($paths = []): DocumentManager
3230
{
3331
$config = new Configuration();
3432
$config->setAutoGenerateProxyClasses(Configuration::AUTOGENERATE_FILE_NOT_EXISTS);
35-
$config->setProxyDir(sys_get_temp_dir());
36-
$config->setHydratorDir(sys_get_temp_dir());
33+
$config->setProxyDir(\sys_get_temp_dir());
34+
$config->setHydratorDir(\sys_get_temp_dir());
3735
$config->setProxyNamespace('SymfonyTests\Doctrine');
3836
$config->setHydratorNamespace('SymfonyTests\Doctrine');
3937
$config->setMetadataDriverImpl(new AttributeDriver($paths, new AttributeReader())); // @phpstan-ignore-line

tests/Action/ExceptionActionTest.php

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use ApiPlatform\Metadata\Operations;
2222
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
2323
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
24-
use DomainException;
2524
use PHPUnit\Framework\TestCase;
2625
use Prophecy\PhpUnit\ProphecyTrait;
2726
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
@@ -74,7 +73,7 @@ public function testActionWithOperationExceptionToStatus(
7473
?array $operationExceptionToStatus,
7574
int $expectedStatusCode
7675
): void {
77-
$exception = new DomainException();
76+
$exception = new \DomainException();
7877
$flattenException = FlattenException::create($exception);
7978

8079
$serializer = $this->prophesize(SerializerInterface::class);
@@ -135,86 +134,86 @@ public function provideOperationExceptionToStatusCases(): \Generator
135134
];
136135

137136
yield 'on global attributes' => [
138-
[DomainException::class => 100],
137+
[\DomainException::class => 100],
139138
null,
140139
null,
141140
100,
142141
];
143142

144143
yield 'on global attributes with empty resource and operation attributes' => [
145-
[DomainException::class => 100],
144+
[\DomainException::class => 100],
146145
[],
147146
[],
148147
100,
149148
];
150149

151150
yield 'on global attributes and resource attributes' => [
152-
[DomainException::class => 100],
153-
[DomainException::class => 200],
151+
[\DomainException::class => 100],
152+
[\DomainException::class => 200],
154153
null,
155154
200,
156155
];
157156

158157
yield 'on global attributes and resource attributes with empty operation attributes' => [
159-
[DomainException::class => 100],
160-
[DomainException::class => 200],
158+
[\DomainException::class => 100],
159+
[\DomainException::class => 200],
161160
[],
162161
200,
163162
];
164163

165164
yield 'on global attributes and operation attributes' => [
166-
[DomainException::class => 100],
165+
[\DomainException::class => 100],
167166
null,
168-
[DomainException::class => 300],
167+
[\DomainException::class => 300],
169168
300,
170169
];
171170

172171
yield 'on global attributes and operation attributes with empty resource attributes' => [
173-
[DomainException::class => 100],
172+
[\DomainException::class => 100],
174173
[],
175-
[DomainException::class => 300],
174+
[\DomainException::class => 300],
176175
300,
177176
];
178177

179178
yield 'on global, resource and operation attributes' => [
180-
[DomainException::class => 100],
181-
[DomainException::class => 200],
182-
[DomainException::class => 300],
179+
[\DomainException::class => 100],
180+
[\DomainException::class => 200],
181+
[\DomainException::class => 300],
183182
300,
184183
];
185184

186185
yield 'on resource attributes' => [
187186
[],
188-
[DomainException::class => 200],
187+
[\DomainException::class => 200],
189188
null,
190189
200,
191190
];
192191

193192
yield 'on resource attributes with empty operation attributes' => [
194193
[],
195-
[DomainException::class => 200],
194+
[\DomainException::class => 200],
196195
[],
197196
200,
198197
];
199198

200199
yield 'on resource and operation attributes' => [
201200
[],
202-
[DomainException::class => 200],
203-
[DomainException::class => 300],
201+
[\DomainException::class => 200],
202+
[\DomainException::class => 300],
204203
300,
205204
];
206205

207206
yield 'on operation attributes' => [
208207
[],
209208
null,
210-
[DomainException::class => 300],
209+
[\DomainException::class => 300],
211210
300,
212211
];
213212

214213
yield 'on operation attributes with empty resource attributes' => [
215214
[],
216215
[],
217-
[DomainException::class => 300],
216+
[\DomainException::class => 300],
218217
300,
219218
];
220219
}

tests/Doctrine/Odm/Extension/OrderExtensionTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Doctrine\ODM\MongoDB\DocumentManager;
2323
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata;
2424
use Doctrine\Persistence\ManagerRegistry;
25-
use OutOfRangeException;
2625
use PHPUnit\Framework\TestCase;
2726
use Prophecy\PhpUnit\ProphecyTrait;
2827

@@ -39,7 +38,7 @@ public function testApplyToCollectionWithValidOrder(): void
3938
{
4039
$aggregationBuilderProphecy = $this->prophesize(Builder::class);
4140

42-
$aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message'));
41+
$aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message'));
4342
$aggregationBuilderProphecy->sort(['name' => 'asc'])->shouldBeCalled();
4443

4544
$classMetadataProphecy = $this->prophesize(ClassMetadata::class);
@@ -60,7 +59,7 @@ public function testApplyToCollectionWithWrongOrder(): void
6059
{
6160
$aggregationBuilderProphecy = $this->prophesize(Builder::class);
6261

63-
$aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message'));
62+
$aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message'));
6463
$aggregationBuilderProphecy->sort(['name' => 'asc'])->shouldNotBeCalled();
6564

6665
$classMetadataProphecy = $this->prophesize(ClassMetadata::class);
@@ -81,7 +80,7 @@ public function testApplyToCollectionWithOrderOverridden(): void
8180
{
8281
$aggregationBuilderProphecy = $this->prophesize(Builder::class);
8382

84-
$aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message'));
83+
$aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message'));
8584
$aggregationBuilderProphecy->sort(['foo' => 'DESC'])->shouldBeCalled();
8685

8786
$classMetadataProphecy = $this->prophesize(ClassMetadata::class);
@@ -102,7 +101,7 @@ public function testApplyToCollectionWithOrderOverriddenWithNoDirection(): void
102101
{
103102
$aggregationBuilderProphecy = $this->prophesize(Builder::class);
104103

105-
$aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message'));
104+
$aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message'));
106105
$aggregationBuilderProphecy->sort(['foo' => 'ASC'])->shouldBeCalled();
107106
$aggregationBuilderProphecy->sort(['foo' => 'ASC', 'bar' => 'DESC'])->shouldBeCalled();
108107

@@ -130,7 +129,7 @@ public function testApplyToCollectionWithOrderOverriddenWithAssociation(): void
130129
$lookupProphecy->alias('author_lkup')->shouldBeCalled();
131130
$aggregationBuilderProphecy->lookup(Dummy::class)->shouldBeCalled()->willReturn($lookupProphecy->reveal());
132131
$aggregationBuilderProphecy->unwind('$author_lkup')->shouldBeCalled();
133-
$aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message'));
132+
$aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message'));
134133
$aggregationBuilderProphecy->sort(['author_lkup.name' => 'ASC'])->shouldBeCalled();
135134

136135
$classMetadataProphecy = $this->prophesize(ClassMetadata::class);

tests/Fixtures/TestBundle/Document/VoDummyInspection.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace ApiPlatform\Tests\Fixtures\TestBundle\Document;
1515

1616
use ApiPlatform\Metadata\ApiResource;
17-
use DateTime;
1817
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
1918
use Symfony\Component\Serializer\Annotation\Groups;
2019

@@ -27,9 +26,9 @@ class VoDummyInspection
2726
#[ODM\Field(type: 'date')]
2827
private \DateTime $performed;
2928

30-
public function __construct(#[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] #[ODM\Field(type: 'bool')] private bool $accepted, #[Groups(['inspection_read', 'inspection_write'])] #[ODM\ReferenceOne(targetDocument: VoDummyCar::class, inversedBy: 'inspections')] private VoDummyCar $car, DateTime $performed = null, private string $attributeWithoutConstructorEquivalent = '')
29+
public function __construct(#[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] #[ODM\Field(type: 'bool')] private bool $accepted, #[Groups(['inspection_read', 'inspection_write'])] #[ODM\ReferenceOne(targetDocument: VoDummyCar::class, inversedBy: 'inspections')] private VoDummyCar $car, \DateTime $performed = null, private string $attributeWithoutConstructorEquivalent = '')
3130
{
32-
$this->performed = $performed ?: new DateTime();
31+
$this->performed = $performed ?: new \DateTime();
3332
}
3433

3534
public function isAccepted(): bool
@@ -42,12 +41,12 @@ public function getCar(): VoDummyCar
4241
return $this->car;
4342
}
4443

45-
public function getPerformed(): DateTime
44+
public function getPerformed(): \DateTime
4645
{
4746
return $this->performed;
4847
}
4948

50-
public function setPerformed(DateTime $performed)
49+
public function setPerformed(\DateTime $performed)
5150
{
5251
$this->performed = $performed;
5352

tests/Fixtures/TestBundle/Entity/AttributeResources.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
use ApiPlatform\Metadata\GetCollection;
1818
use ApiPlatform\Metadata\Post;
1919
use ApiPlatform\Tests\Fixtures\TestBundle\State\AttributeResourceProvider;
20-
use ArrayIterator;
21-
use IteratorAggregate;
22-
use Traversable;
2320

2421
#[ApiResource(
2522
'/attribute_resources{._format}',
@@ -28,7 +25,7 @@
2825
)]
2926
#[GetCollection]
3027
#[Post]
31-
final class AttributeResources implements IteratorAggregate
28+
final class AttributeResources implements \IteratorAggregate
3229
{
3330
/**
3431
* @var AttributeResource[]
@@ -40,8 +37,8 @@ public function __construct(AttributeResource ...$collection)
4037
$this->collection = $collection;
4138
}
4239

43-
public function getIterator(): Traversable
40+
public function getIterator(): \Traversable
4441
{
45-
return new ArrayIterator($this->collection);
42+
return new \ArrayIterator($this->collection);
4643
}
4744
}

tests/Fixtures/TestBundle/Entity/VoDummyInspection.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity;
1515

1616
use ApiPlatform\Metadata\ApiResource;
17-
use DateTime;
1817
use Doctrine\ORM\Mapping as ORM;
1918
use Symfony\Component\Serializer\Annotation\Groups;
2019

@@ -28,9 +27,9 @@ class VoDummyInspection
2827
#[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])]
2928
private \DateTime $performed;
3029

31-
public function __construct(#[ORM\Column(type: 'boolean')] #[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] private bool $accepted, #[ORM\ManyToOne(targetEntity: VoDummyCar::class, inversedBy: 'inspections')] #[Groups(['inspection_read', 'inspection_write'])] private ?VoDummyCar $car, DateTime $performed = null, private string $attributeWithoutConstructorEquivalent = '')
30+
public function __construct(#[ORM\Column(type: 'boolean')] #[Groups(['car_read', 'car_write', 'inspection_read', 'inspection_write'])] private bool $accepted, #[ORM\ManyToOne(targetEntity: VoDummyCar::class, inversedBy: 'inspections')] #[Groups(['inspection_read', 'inspection_write'])] private ?VoDummyCar $car, \DateTime $performed = null, private string $attributeWithoutConstructorEquivalent = '')
3231
{
33-
$this->performed = $performed ?: new DateTime();
32+
$this->performed = $performed ?: new \DateTime();
3433
}
3534

3635
public function isAccepted(): bool
@@ -43,12 +42,12 @@ public function getCar(): ?VoDummyCar
4342
return $this->car;
4443
}
4544

46-
public function getPerformed(): DateTime
45+
public function getPerformed(): \DateTime
4746
{
4847
return $this->performed;
4948
}
5049

51-
public function setPerformed(DateTime $performed)
50+
public function setPerformed(\DateTime $performed)
5251
{
5352
$this->performed = $performed;
5453

tests/HttpCache/VarnishPurgerTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use GuzzleHttp\ClientInterface;
1818
use GuzzleHttp\Promise\PromiseInterface;
1919
use GuzzleHttp\Psr7\Response;
20-
use LogicException;
2120
use PHPUnit\Framework\TestCase;
2221
use Prophecy\PhpUnit\ProphecyTrait;
2322
use Psr\Http\Message\RequestInterface;
@@ -79,12 +78,12 @@ public function testItChunksHeaderToAvoidHittingVarnishLimit(int $maxHeaderLengt
7978

8079
public function send(RequestInterface $request, array $options = []): ResponseInterface
8180
{
82-
throw new LogicException('Not implemented');
81+
throw new \LogicException('Not implemented');
8382
}
8483

8584
public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface
8685
{
87-
throw new LogicException('Not implemented');
86+
throw new \LogicException('Not implemented');
8887
}
8988

9089
public function request($method, $uri, array $options = []): ResponseInterface
@@ -96,12 +95,12 @@ public function request($method, $uri, array $options = []): ResponseInterface
9695

9796
public function requestAsync($method, $uri, array $options = []): PromiseInterface
9897
{
99-
throw new LogicException('Not implemented');
98+
throw new \LogicException('Not implemented');
10099
}
101100

102101
public function getConfig($option = null): void
103102
{
104-
throw new LogicException('Not implemented');
103+
throw new \LogicException('Not implemented');
105104
}
106105
};
107106

0 commit comments

Comments
 (0)