From 492725310ae9a1b5b20d6ae09fb5ae6404616e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Ostroluck=C3=BD?= Date: Sat, 10 Feb 2024 21:54:03 +0100 Subject: [PATCH] Fix psalm after release of new major versions of ORM and DBAL --- DependencyInjection/DoctrineExtension.php | 3 --- Repository/RepositoryFactoryCompatibility.php | 2 -- Repository/ServiceEntityRepositoryProxy.php | 6 ------ Tests/Mapping/ContainerEntityListenerResolverTest.php | 1 - 4 files changed, 12 deletions(-) diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index f8db480b..21ad98b4 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -849,13 +849,10 @@ protected function loadOrmEntityManagerMappingInformation(array $entityManager, $mappingService = $this->getObjectManagerElementName($entityManager['name'] . '_' . $driverType . '_metadata_driver'); $mappingDriverDef = $container->getDefinition($mappingService); $args = $mappingDriverDef->getArguments(); - /** @psalm-suppress TypeDoesNotContainType Psalm doesn't know that $this->drivers is set by $this->loadMappingInformation() call */ if ($driverType === 'annotation') { $args[2] = $entityManager['report_fields_where_declared']; - /** @psalm-suppress TypeDoesNotContainType Psalm doesn't know that $this->drivers is set by $this->loadMappingInformation() call */ } elseif ($driverType === 'attribute') { $args[1] = $entityManager['report_fields_where_declared']; - /** @psalm-suppress TypeDoesNotContainType Psalm doesn't know that $this->drivers is set by $this->loadMappingInformation() call */ } elseif ($driverType === 'xml') { $args[1] ??= SimplifiedXmlDriver::DEFAULT_FILE_EXTENSION; $args[2] = $entityManager['validate_xml_mapping']; diff --git a/Repository/RepositoryFactoryCompatibility.php b/Repository/RepositoryFactoryCompatibility.php index 3e708e7e..f50ff764 100644 --- a/Repository/RepositoryFactoryCompatibility.php +++ b/Repository/RepositoryFactoryCompatibility.php @@ -21,8 +21,6 @@ trait RepositoryFactoryCompatibility * @return EntityRepository * * @template T of object - * - * @psalm-suppress MethodSignatureMismatch */ public function getRepository(EntityManagerInterface $entityManager, string $entityName): EntityRepository { diff --git a/Repository/ServiceEntityRepositoryProxy.php b/Repository/ServiceEntityRepositoryProxy.php index 6eca5dc8..07dd6c0a 100644 --- a/Repository/ServiceEntityRepositoryProxy.php +++ b/Repository/ServiceEntityRepositoryProxy.php @@ -41,21 +41,18 @@ public function __construct( $this->repository = $this->resolveRepository(); } - /** @psalm-suppress MethodSignatureMismatch This proxy is used only in combination with newer parent class */ public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder { return ($this->repository ??= $this->resolveRepository()) ->createQueryBuilder($alias, $indexBy); } - /** @psalm-suppress MethodSignatureMismatch This proxy is used only in combination with newer parent class */ public function createResultSetMappingBuilder(string $alias): ResultSetMappingBuilder { return ($this->repository ??= $this->resolveRepository()) ->createResultSetMappingBuilder($alias); } - /** @psalm-suppress MethodSignatureMismatch This proxy is used only in combination with newer parent class */ public function find(mixed $id, LockMode|int|null $lockMode = null, int|null $lockVersion = null): object|null { /** @psalm-suppress InvalidReturnStatement This proxy is used only in combination with newer parent class */ @@ -67,7 +64,6 @@ public function find(mixed $id, LockMode|int|null $lockMode = null, int|null $lo * {@inheritDoc} * * @psalm-suppress InvalidReturnStatement This proxy is used only in combination with newer parent class - * @psalm-suppress MethodSignatureMismatch This proxy is used only in combination with newer parent class * @psalm-suppress InvalidReturnType This proxy is used only in combination with newer parent class */ public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array @@ -92,8 +88,6 @@ public function count(array $criteria = []): int /** * {@inheritDoc} - * - * @psalm-suppress MethodSignatureMismatch This proxy is used only in combination with newer parent class */ public function __call(string $method, array $arguments): mixed { diff --git a/Tests/Mapping/ContainerEntityListenerResolverTest.php b/Tests/Mapping/ContainerEntityListenerResolverTest.php index a4bde56f..cdfd8651 100644 --- a/Tests/Mapping/ContainerEntityListenerResolverTest.php +++ b/Tests/Mapping/ContainerEntityListenerResolverTest.php @@ -128,7 +128,6 @@ public function testRegisterStringException(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('An object was expected, but got "string".'); - /** @psalm-suppress InvalidArgument */ $this->resolver->register('CompanyContractListener'); } }