diff --git a/src/Core/Bridge/Doctrine/MongoDbOdm/Extension/OrderExtension.php b/src/Core/Bridge/Doctrine/MongoDbOdm/Extension/OrderExtension.php index 17f6a32ccbe..578368eeb03 100644 --- a/src/Core/Bridge/Doctrine/MongoDbOdm/Extension/OrderExtension.php +++ b/src/Core/Bridge/Doctrine/MongoDbOdm/Extension/OrderExtension.php @@ -19,7 +19,6 @@ use Doctrine\ODM\MongoDB\Aggregation\Builder; use Doctrine\ODM\MongoDB\Aggregation\Stage\Sort; use Doctrine\Persistence\ManagerRegistry; -use OutOfRangeException; /** * Applies selected ordering while querying resource collection. @@ -110,7 +109,7 @@ private function hasSortStage(Builder $aggregationBuilder): bool // If at least one stage is sort, then it has sorting return true; } - } catch (OutOfRangeException $outOfRangeException) { + } catch (\OutOfRangeException $outOfRangeException) { // There is no more stages on the aggregation builder $shouldStop = true; } diff --git a/src/Core/Upgrade/UpgradeApiSubresourceVisitor.php b/src/Core/Upgrade/UpgradeApiSubresourceVisitor.php index 14c94cc6f14..c818b9bd1cf 100644 --- a/src/Core/Upgrade/UpgradeApiSubresourceVisitor.php +++ b/src/Core/Upgrade/UpgradeApiSubresourceVisitor.php @@ -21,7 +21,6 @@ use ApiPlatform\Metadata\Link; use PhpParser\Node; use PhpParser\NodeVisitorAbstract; -use ReflectionClass; final class UpgradeApiSubresourceVisitor extends NodeVisitorAbstract { @@ -175,7 +174,7 @@ public function enterNode(Node $node) ]; if (null !== $this->referenceType) { - $urlGeneratorInterface = new ReflectionClass(UrlGeneratorInterface::class); + $urlGeneratorInterface = new \ReflectionClass(UrlGeneratorInterface::class); $urlGeneratorConstants = array_flip($urlGeneratorInterface->getConstants()); $currentUrlGeneratorConstant = $urlGeneratorConstants[$this->referenceType]; diff --git a/src/Doctrine/Odm/Extension/OrderExtension.php b/src/Doctrine/Odm/Extension/OrderExtension.php index 917d1d39bf9..f04e9cac236 100644 --- a/src/Doctrine/Odm/Extension/OrderExtension.php +++ b/src/Doctrine/Odm/Extension/OrderExtension.php @@ -19,7 +19,6 @@ use Doctrine\ODM\MongoDB\Aggregation\Builder; use Doctrine\ODM\MongoDB\Aggregation\Stage\Sort; use Doctrine\Persistence\ManagerRegistry; -use OutOfRangeException; /** * Applies selected ordering while querying resource collection. @@ -101,7 +100,7 @@ private function hasSortStage(Builder $aggregationBuilder): bool // If at least one stage is sort, then it has sorting return true; } - } catch (OutOfRangeException $outOfRangeException) { + } catch (\OutOfRangeException $outOfRangeException) { // There is no more stages on the aggregation builder $shouldStop = true; } diff --git a/src/Metadata/Extractor/ResourceExtractorTrait.php b/src/Metadata/Extractor/ResourceExtractorTrait.php index 71c8cbfa2d4..2269575d555 100644 --- a/src/Metadata/Extractor/ResourceExtractorTrait.php +++ b/src/Metadata/Extractor/ResourceExtractorTrait.php @@ -14,7 +14,6 @@ namespace ApiPlatform\Metadata\Extractor; use ApiPlatform\Exception\InvalidArgumentException; -use SimpleXMLElement; use Symfony\Component\Config\Util\XmlUtils; /** @@ -25,14 +24,14 @@ trait ResourceExtractorTrait { /** - * @param array|SimpleXMLElement|null $resource - * @param mixed|null $default + * @param array|\SimpleXMLElement|null $resource + * @param mixed|null $default * * @return array|null */ private function buildArrayValue($resource, string $key, $default = null) { - if (\is_object($resource) && $resource instanceof SimpleXMLElement) { + if (\is_object($resource) && $resource instanceof \SimpleXMLElement) { if (!isset($resource->{$key.'s'}->{$key})) { return $default; } @@ -54,8 +53,8 @@ private function buildArrayValue($resource, string $key, $default = null) /** * Transforms an attribute's value in a PHP value. * - * @param array|SimpleXMLElement|null $resource - * @param mixed|null $default + * @param array|\SimpleXMLElement|null $resource + * @param mixed|null $default * * @return string|int|bool|array|null */ @@ -73,7 +72,7 @@ private function phpize($resource, string $key, string $type, $default = null) case 'integer': return (int) $resource[$key]; case 'bool': - if (\is_object($resource) && $resource instanceof SimpleXMLElement) { + if (\is_object($resource) && $resource instanceof \SimpleXMLElement) { return (bool) XmlUtils::phpize($resource[$key]); } @@ -83,7 +82,7 @@ private function phpize($resource, string $key, string $type, $default = null) throw new InvalidArgumentException(sprintf('The property "%s" must be a "%s", "%s" given.', $key, $type, \gettype($resource[$key]))); } - private function buildArgs(SimpleXMLElement $resource): ?array + private function buildArgs(\SimpleXMLElement $resource): ?array { if (!isset($resource->args->arg)) { return null; @@ -97,7 +96,7 @@ private function buildArgs(SimpleXMLElement $resource): ?array return $data; } - private function buildValues(SimpleXMLElement $resource): array + private function buildValues(\SimpleXMLElement $resource): array { $data = []; foreach ($resource->value as $value) { diff --git a/src/Metadata/Operations.php b/src/Metadata/Operations.php index b11f81ba161..daf1904de79 100644 --- a/src/Metadata/Operations.php +++ b/src/Metadata/Operations.php @@ -13,8 +13,6 @@ namespace ApiPlatform\Metadata; -use RuntimeException; - final class Operations implements \IteratorAggregate, \Countable { private $operations; @@ -71,7 +69,7 @@ public function remove(string $key): self } } - throw new RuntimeException(sprintf('Could not remove operation "%s".', $key)); + throw new \RuntimeException(sprintf('Could not remove operation "%s".', $key)); } public function has(string $key): bool diff --git a/src/Symfony/Routing/SkolemIriConverter.php b/src/Symfony/Routing/SkolemIriConverter.php index 6cc5b7fcc27..7f9b0b86da8 100644 --- a/src/Symfony/Routing/SkolemIriConverter.php +++ b/src/Symfony/Routing/SkolemIriConverter.php @@ -17,7 +17,6 @@ use ApiPlatform\Api\UrlGeneratorInterface; use ApiPlatform\Exception\ItemNotFoundException; use ApiPlatform\Metadata\Operation; -use SplObjectStorage; use Symfony\Component\Routing\RouterInterface; /** @@ -36,7 +35,7 @@ final class SkolemIriConverter implements IriConverterInterface public function __construct(RouterInterface $router) { $this->router = $router; - $this->objectHashMap = new SplObjectStorage(); + $this->objectHashMap = new \SplObjectStorage(); } /** diff --git a/src/Test/DoctrineMongoDbOdmTestCase.php b/src/Test/DoctrineMongoDbOdmTestCase.php index b2bec59a0f2..45c3b8f78fb 100644 --- a/src/Test/DoctrineMongoDbOdmTestCase.php +++ b/src/Test/DoctrineMongoDbOdmTestCase.php @@ -21,8 +21,6 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Cache\Adapter\ArrayAdapter; -use function sys_get_temp_dir; - /** * Source: https://github.com/doctrine/DoctrineMongoDBBundle/blob/0174003844bc566bb4cb3b7d10c5528d1924d719/Tests/TestCase.php * Test got excluded from vendor in 4.x. diff --git a/tests/Action/ExceptionActionTest.php b/tests/Action/ExceptionActionTest.php index 37edd2d3d9d..bbaa5099b08 100644 --- a/tests/Action/ExceptionActionTest.php +++ b/tests/Action/ExceptionActionTest.php @@ -24,7 +24,6 @@ use ApiPlatform\Metadata\Operations; use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface; use ApiPlatform\Metadata\Resource\ResourceMetadataCollection; -use DomainException; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; use Symfony\Component\Debug\Exception\FlattenException as LegacyFlattenException; @@ -82,7 +81,7 @@ public function testLegacyActionWithOperationExceptionToStatus( ) { $this->expectDeprecation('Since api-platform/core 2.7: Use "ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface" instead of "ApiPlatform\Core\Metadata\Resource\Factory\ResourceMetadataFactoryInterface".'); - $exception = new DomainException(); + $exception = new \DomainException(); $flattenException = FlattenException::create($exception); $serializer = $this->prophesize(SerializerInterface::class); @@ -135,7 +134,7 @@ public function testActionWithOperationExceptionToStatus( ?array $operationExceptionToStatus, int $expectedStatusCode ) { - $exception = new DomainException(); + $exception = new \DomainException(); $flattenException = FlattenException::create($exception); $serializer = $this->prophesize(SerializerInterface::class); @@ -196,86 +195,86 @@ public function provideOperationExceptionToStatusCases() ]; yield 'on global attributes' => [ - [DomainException::class => 100], + [\DomainException::class => 100], null, null, 100, ]; yield 'on global attributes with empty resource and operation attributes' => [ - [DomainException::class => 100], + [\DomainException::class => 100], [], [], 100, ]; yield 'on global attributes and resource attributes' => [ - [DomainException::class => 100], - [DomainException::class => 200], + [\DomainException::class => 100], + [\DomainException::class => 200], null, 200, ]; yield 'on global attributes and resource attributes with empty operation attributes' => [ - [DomainException::class => 100], - [DomainException::class => 200], + [\DomainException::class => 100], + [\DomainException::class => 200], [], 200, ]; yield 'on global attributes and operation attributes' => [ - [DomainException::class => 100], + [\DomainException::class => 100], null, - [DomainException::class => 300], + [\DomainException::class => 300], 300, ]; yield 'on global attributes and operation attributes with empty resource attributes' => [ - [DomainException::class => 100], + [\DomainException::class => 100], [], - [DomainException::class => 300], + [\DomainException::class => 300], 300, ]; yield 'on global, resource and operation attributes' => [ - [DomainException::class => 100], - [DomainException::class => 200], - [DomainException::class => 300], + [\DomainException::class => 100], + [\DomainException::class => 200], + [\DomainException::class => 300], 300, ]; yield 'on resource attributes' => [ [], - [DomainException::class => 200], + [\DomainException::class => 200], null, 200, ]; yield 'on resource attributes with empty operation attributes' => [ [], - [DomainException::class => 200], + [\DomainException::class => 200], [], 200, ]; yield 'on resource and operation attributes' => [ [], - [DomainException::class => 200], - [DomainException::class => 300], + [\DomainException::class => 200], + [\DomainException::class => 300], 300, ]; yield 'on operation attributes' => [ [], null, - [DomainException::class => 300], + [\DomainException::class => 300], 300, ]; yield 'on operation attributes with empty resource attributes' => [ [], [], - [DomainException::class => 300], + [\DomainException::class => 300], 300, ]; } diff --git a/tests/Core/Metadata/Extractor/YamlExtractorTest.php b/tests/Core/Metadata/Extractor/YamlExtractorTest.php index a949062dbe6..6c0bb335c90 100644 --- a/tests/Core/Metadata/Extractor/YamlExtractorTest.php +++ b/tests/Core/Metadata/Extractor/YamlExtractorTest.php @@ -15,7 +15,6 @@ use ApiPlatform\Core\Metadata\Extractor\YamlExtractor; use ApiPlatform\Exception\InvalidArgumentException; -use Generator; /** * @author Kévin Dunglas @@ -56,7 +55,7 @@ public function testInvalidResources(string $path, string $exceptionRegex) } } - public function provideInvalidResources(): Generator + public function provideInvalidResources(): \Generator { yield [ __DIR__.'/../../../Fixtures/FileConfigurations/resourcesinvalid.yml', diff --git a/tests/Doctrine/Odm/Extension/OrderExtensionTest.php b/tests/Doctrine/Odm/Extension/OrderExtensionTest.php index 80041cad7e4..e35a61d23a0 100644 --- a/tests/Doctrine/Odm/Extension/OrderExtensionTest.php +++ b/tests/Doctrine/Odm/Extension/OrderExtensionTest.php @@ -23,7 +23,6 @@ use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\Mapping\ClassMetadata; use Doctrine\Persistence\ManagerRegistry; -use OutOfRangeException; use PHPUnit\Framework\TestCase; /** @@ -39,7 +38,7 @@ public function testApplyToCollectionWithValidOrder(): void { $aggregationBuilderProphecy = $this->prophesize(Builder::class); - $aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message')); + $aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message')); $aggregationBuilderProphecy->sort(['name' => 'asc'])->shouldBeCalled(); $classMetadataProphecy = $this->prophesize(ClassMetadata::class); @@ -60,7 +59,7 @@ public function testApplyToCollectionWithWrongOrder(): void { $aggregationBuilderProphecy = $this->prophesize(Builder::class); - $aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message')); + $aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message')); $aggregationBuilderProphecy->sort(['name' => 'asc'])->shouldNotBeCalled(); $classMetadataProphecy = $this->prophesize(ClassMetadata::class); @@ -81,7 +80,7 @@ public function testApplyToCollectionWithOrderOverridden(): void { $aggregationBuilderProphecy = $this->prophesize(Builder::class); - $aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message')); + $aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message')); $aggregationBuilderProphecy->sort(['foo' => 'DESC'])->shouldBeCalled(); $classMetadataProphecy = $this->prophesize(ClassMetadata::class); @@ -102,7 +101,7 @@ public function testApplyToCollectionWithOrderOverriddenWithNoDirection(): void { $aggregationBuilderProphecy = $this->prophesize(Builder::class); - $aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message')); + $aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message')); $aggregationBuilderProphecy->sort(['foo' => 'ASC'])->shouldBeCalled(); $aggregationBuilderProphecy->sort(['foo' => 'ASC', 'bar' => 'DESC'])->shouldBeCalled(); @@ -130,7 +129,7 @@ public function testApplyToCollectionWithOrderOverriddenWithAssociation(): void $lookupProphecy->alias('author_lkup')->shouldBeCalled(); $aggregationBuilderProphecy->lookup(Dummy::class)->shouldBeCalled()->willReturn($lookupProphecy->reveal()); $aggregationBuilderProphecy->unwind('$author_lkup')->shouldBeCalled(); - $aggregationBuilderProphecy->getStage(0)->willThrow(new OutOfRangeException('message')); + $aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message')); $aggregationBuilderProphecy->sort(['author_lkup.name' => 'ASC'])->shouldBeCalled(); $classMetadataProphecy = $this->prophesize(ClassMetadata::class); diff --git a/tests/Fixtures/TestBundle/Document/VoDummyInspection.php b/tests/Fixtures/TestBundle/Document/VoDummyInspection.php index ddc584d7a38..eff328408d3 100644 --- a/tests/Fixtures/TestBundle/Document/VoDummyInspection.php +++ b/tests/Fixtures/TestBundle/Document/VoDummyInspection.php @@ -14,7 +14,6 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Document; use ApiPlatform\Core\Annotation\ApiResource; -use DateTime; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; use Symfony\Component\Serializer\Annotation\Groups; @@ -49,7 +48,7 @@ class VoDummyInspection private $car; /** - * @var DateTime + * @var \DateTime * * @ODM\Field(type="date") * @Groups({"car_read", "car_write", "inspection_read", "inspection_write"}) @@ -58,11 +57,11 @@ class VoDummyInspection private $attributeWithoutConstructorEquivalent; - public function __construct(bool $accepted, VoDummyCar $car, DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') + public function __construct(bool $accepted, VoDummyCar $car, \DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') { $this->accepted = $accepted; $this->car = $car; - $this->performed = $performed ?: new DateTime(); + $this->performed = $performed ?: new \DateTime(); $this->attributeWithoutConstructorEquivalent = $parameterWhichIsNotClassAttribute; } @@ -81,7 +80,7 @@ public function getPerformed() return $this->performed; } - public function setPerformed(DateTime $performed) + public function setPerformed(\DateTime $performed) { $this->performed = $performed; diff --git a/tests/Fixtures/TestBundle/Entity/AttributeResources.php b/tests/Fixtures/TestBundle/Entity/AttributeResources.php index 235a99dc7bf..da0fcc9ab57 100644 --- a/tests/Fixtures/TestBundle/Entity/AttributeResources.php +++ b/tests/Fixtures/TestBundle/Entity/AttributeResources.php @@ -17,9 +17,6 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; use ApiPlatform\Tests\Fixtures\TestBundle\State\AttributeResourceProvider; -use ArrayIterator; -use IteratorAggregate; -use Traversable; #[ApiResource( '/attribute_resources.{_format}', @@ -28,7 +25,7 @@ )] #[GetCollection] #[Post] -final class AttributeResources implements IteratorAggregate +final class AttributeResources implements \IteratorAggregate { /** * @var AttributeResource[] @@ -40,8 +37,8 @@ public function __construct(AttributeResource ...$collection) $this->collection = $collection; } - public function getIterator(): Traversable + public function getIterator(): \Traversable { - return new ArrayIterator($this->collection); + return new \ArrayIterator($this->collection); } } diff --git a/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php b/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php index d4d8ee89385..fdc2d6c8114 100644 --- a/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php +++ b/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php @@ -49,7 +49,7 @@ class VoDummyInspection private $car; /** - * @var DateTime + * @var \DateTime * * @ORM\Column(type="datetime") * @Groups({"car_read", "car_write", "inspection_read", "inspection_write"}) @@ -58,11 +58,11 @@ class VoDummyInspection private $attributeWithoutConstructorEquivalent; - public function __construct(bool $accepted, VoDummyCar $car, DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') + public function __construct(bool $accepted, VoDummyCar $car, \DateTime $performed = null, string $parameterWhichIsNotClassAttribute = '') { $this->accepted = $accepted; $this->car = $car; - $this->performed = $performed ?: new DateTime(); + $this->performed = $performed ?: new \DateTime(); $this->attributeWithoutConstructorEquivalent = $parameterWhichIsNotClassAttribute; } @@ -81,7 +81,7 @@ public function getPerformed() return $this->performed; } - public function setPerformed(DateTime $performed) + public function setPerformed(\DateTime $performed) { $this->performed = $performed; diff --git a/tests/HttpCache/VarnishPurgerTest.php b/tests/HttpCache/VarnishPurgerTest.php index c6ebe1c234c..621c71beef2 100644 --- a/tests/HttpCache/VarnishPurgerTest.php +++ b/tests/HttpCache/VarnishPurgerTest.php @@ -18,7 +18,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Promise\PromiseInterface; use GuzzleHttp\Psr7\Response; -use LogicException; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -79,12 +78,12 @@ public function testItChunksHeaderToAvoidHittingVarnishLimit(int $maxHeaderLengt public function send(RequestInterface $request, array $options = []): ResponseInterface { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } public function request($method, $uri, array $options = []): ResponseInterface @@ -96,12 +95,12 @@ public function request($method, $uri, array $options = []): ResponseInterface public function requestAsync($method, $uri, array $options = []): PromiseInterface { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } public function getConfig($option = null) { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } }; diff --git a/tests/HttpCache/VarnishXKeyPurgerTest.php b/tests/HttpCache/VarnishXKeyPurgerTest.php index 4b720a7c30b..77049c7918b 100644 --- a/tests/HttpCache/VarnishXKeyPurgerTest.php +++ b/tests/HttpCache/VarnishXKeyPurgerTest.php @@ -18,7 +18,6 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Promise\PromiseInterface; use GuzzleHttp\Psr7\Response; -use LogicException; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -109,12 +108,12 @@ public function testItChunksHeaderToAvoidHittingVarnishLimit(int $maxHeaderLengt public function send(RequestInterface $request, array $options = []): ResponseInterface { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } public function request($method, $uri, array $options = []): ResponseInterface @@ -126,12 +125,12 @@ public function request($method, $uri, array $options = []): ResponseInterface public function requestAsync($method, $uri, array $options = []): PromiseInterface { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } public function getConfig($option = null) { - throw new LogicException('Not implemented'); + throw new \LogicException('Not implemented'); } }; diff --git a/tests/Metadata/Extractor/PropertyMetadataCompatibilityTest.php b/tests/Metadata/Extractor/PropertyMetadataCompatibilityTest.php index e310c802468..35a331e0998 100644 --- a/tests/Metadata/Extractor/PropertyMetadataCompatibilityTest.php +++ b/tests/Metadata/Extractor/PropertyMetadataCompatibilityTest.php @@ -22,7 +22,6 @@ use ApiPlatform\Tests\Metadata\Extractor\Adapter\PropertyAdapterInterface; use ApiPlatform\Tests\Metadata\Extractor\Adapter\XmlPropertyAdapter; use ApiPlatform\Tests\Metadata\Extractor\Adapter\YamlPropertyAdapter; -use Exception; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\TestCase; use Symfony\Component\PropertyInfo\Type; @@ -90,7 +89,7 @@ public function testValidMetadata(string $extractorClass, PropertyAdapterInterfa $extractor = new $extractorClass($adapter(self::RESOURCE_CLASS, self::PROPERTY, $parameters, self::FIXTURES)); $factory = new ExtractorPropertyMetadataFactory($extractor); $property = $factory->create(self::RESOURCE_CLASS, self::PROPERTY); - } catch (Exception $exception) { + } catch (\Exception $exception) { throw new AssertionFailedError('Failed asserting that the schema is valid according to '.ApiProperty::class, 0, $exception); } diff --git a/tests/Metadata/Extractor/ResourceMetadataCompatibilityTest.php b/tests/Metadata/Extractor/ResourceMetadataCompatibilityTest.php index f8fe305f995..b340b05543a 100644 --- a/tests/Metadata/Extractor/ResourceMetadataCompatibilityTest.php +++ b/tests/Metadata/Extractor/ResourceMetadataCompatibilityTest.php @@ -35,7 +35,6 @@ use ApiPlatform\Tests\Metadata\Extractor\Adapter\ResourceAdapterInterface; use ApiPlatform\Tests\Metadata\Extractor\Adapter\XmlResourceAdapter; use ApiPlatform\Tests\Metadata\Extractor\Adapter\YamlResourceAdapter; -use Exception; use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\TestCase; @@ -423,7 +422,7 @@ public function testValidMetadata(string $extractorClass, ResourceAdapterInterfa $extractor = new $extractorClass($adapter(self::RESOURCE_CLASS, $parameters, self::FIXTURES)); $factory = new ExtractorResourceMetadataCollectionFactory($extractor); $collection = $factory->create(self::RESOURCE_CLASS); - } catch (Exception $exception) { + } catch (\Exception $exception) { throw new AssertionFailedError('Failed asserting that the schema is valid according to '.ApiResource::class, 0, $exception); } diff --git a/tests/State/Pagination/TraversablePaginatorTest.php b/tests/State/Pagination/TraversablePaginatorTest.php index 5a1f635d960..f8c1ac36094 100644 --- a/tests/State/Pagination/TraversablePaginatorTest.php +++ b/tests/State/Pagination/TraversablePaginatorTest.php @@ -14,7 +14,6 @@ namespace ApiPlatform\Tests\State\Pagination; use ApiPlatform\State\Pagination\TraversablePaginator; -use ArrayIterator; use PHPUnit\Framework\TestCase; class TraversablePaginatorTest extends TestCase @@ -30,7 +29,7 @@ public function testInitialize( float $lastPage, float $currentItems ): void { - $traversable = new ArrayIterator($results); + $traversable = new \ArrayIterator($results); $paginator = new TraversablePaginator($traversable, $currentPage, $perPage, $totalItems);