From 04b9b0618f5fdb3d02fec0281eab27ac8472b91c Mon Sep 17 00:00:00 2001 From: Jan Nedbal Date: Mon, 11 Nov 2024 10:59:48 +0100 Subject: [PATCH] Failing test: diving to traits does not work --- .../data/QueryResult/queryBuilderGetQuery.php | 8 ++++++++ .../data/QueryResult/traitWithQueryBuilder.php | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/Type/Doctrine/data/QueryResult/traitWithQueryBuilder.php diff --git a/tests/Type/Doctrine/data/QueryResult/queryBuilderGetQuery.php b/tests/Type/Doctrine/data/QueryResult/queryBuilderGetQuery.php index c0cf3068..f7072422 100644 --- a/tests/Type/Doctrine/data/QueryResult/queryBuilderGetQuery.php +++ b/tests/Type/Doctrine/data/QueryResult/queryBuilderGetQuery.php @@ -15,6 +15,9 @@ class QueryBuilderGetQuery { + + use TraitWithQueryBuilder; + private function getQueryBuilderMany(EntityManagerInterface $em): QueryBuilder { return $em->createQueryBuilder() @@ -33,6 +36,11 @@ public function getQueryDirectly(EntityManagerInterface $em): void assertType('list', $this->getQueryBuilderMany($em)->getQuery()->getResult()); } + public function getQueryFromTrait(EntityManagerInterface $em): void + { + assertType('list', $this->getQueryBuilderFromTrait($em)->getQuery()->getResult()); + } + public function testQueryTypeParametersAreInfered(EntityManagerInterface $em): void { $query = $em->createQueryBuilder() diff --git a/tests/Type/Doctrine/data/QueryResult/traitWithQueryBuilder.php b/tests/Type/Doctrine/data/QueryResult/traitWithQueryBuilder.php new file mode 100644 index 00000000..8612911b --- /dev/null +++ b/tests/Type/Doctrine/data/QueryResult/traitWithQueryBuilder.php @@ -0,0 +1,18 @@ +createQueryBuilder() + ->select('m') + ->from(Many::class, 'm'); + } + +}