From cf7c0cab2c618825eced1edfe2a649988be1cd05 Mon Sep 17 00:00:00 2001 From: silverbackdan Date: Fri, 27 Jan 2023 20:07:52 +0000 Subject: [PATCH] Remove deprecated annotation loader in tests, not required --- src/Filter/OrSearchFilter.php | 41 +++++++++++++----------------- tests/Functional/app/bootstrap.php | 4 --- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/src/Filter/OrSearchFilter.php b/src/Filter/OrSearchFilter.php index 32ba08f5..3ceb93c1 100644 --- a/src/Filter/OrSearchFilter.php +++ b/src/Filter/OrSearchFilter.php @@ -39,7 +39,14 @@ final class OrSearchFilter extends AbstractFilter implements SearchFilterInterfa public const DOCTRINE_INTEGER_TYPE = Types::INTEGER; - public function __construct(ManagerRegistry $managerRegistry, IriConverterInterface $iriConverter, PropertyAccessorInterface $propertyAccessor = null, LoggerInterface $logger = null, array $properties = null, NameConverterInterface $nameConverter = null) + public function __construct( + ManagerRegistry $managerRegistry, + IriConverterInterface $iriConverter, + PropertyAccessorInterface $propertyAccessor = null, + LoggerInterface $logger = null, + array $properties = null, + NameConverterInterface $nameConverter = null + ) { parent::__construct($managerRegistry, $logger, $properties, $nameConverter); @@ -52,29 +59,15 @@ public function __construct(ManagerRegistry $managerRegistry, IriConverterInterf */ protected function getType(string $doctrineType): string { - switch ($doctrineType) { - case Types::ARRAY: - return 'array'; - case Types::BIGINT: - case Types::INTEGER: - case Types::SMALLINT: - return 'int'; - case Types::BOOLEAN: - return 'bool'; - case Types::DATE_MUTABLE: - case Types::TIME_MUTABLE: - case Types::DATETIME_MUTABLE: - case Types::DATETIMETZ_MUTABLE: - case Types::DATE_IMMUTABLE: - case Types::TIME_IMMUTABLE: - case Types::DATETIME_IMMUTABLE: - case Types::DATETIMETZ_IMMUTABLE: - return \DateTimeInterface::class; - case Types::FLOAT: - return 'float'; - } - - return 'string'; + return match ($doctrineType) { + Types::ARRAY => 'array', + Types::JSON => 'json', + Types::BIGINT, Types::INTEGER, Types::SMALLINT => 'int', + Types::BOOLEAN => 'bool', + Types::DATE_MUTABLE, Types::TIME_MUTABLE, Types::DATETIME_MUTABLE, Types::DATETIMETZ_MUTABLE, Types::DATE_IMMUTABLE, Types::TIME_IMMUTABLE, Types::DATETIME_IMMUTABLE, Types::DATETIMETZ_IMMUTABLE => \DateTimeInterface::class, + Types::FLOAT => 'float', + default => 'string', + }; } protected function getIriConverter(): IriConverterInterface diff --git a/tests/Functional/app/bootstrap.php b/tests/Functional/app/bootstrap.php index d2dc2d89..829814af 100644 --- a/tests/Functional/app/bootstrap.php +++ b/tests/Functional/app/bootstrap.php @@ -11,13 +11,9 @@ declare(strict_types=1); -use Doctrine\Common\Annotations\AnnotationRegistry; - date_default_timezone_set('UTC'); $loader = require __DIR__ . '/../../../vendor/autoload.php'; require __DIR__ . '/AppKernel.php'; -AnnotationRegistry::registerLoader('class_exists'); - return $loader;