From b8ec657f61e492c94fca68cd60ac9c81184c8417 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Thu, 10 Oct 2024 10:36:06 +0200 Subject: [PATCH] Address PHPStan complaints --- src/Query/Parser.php | 2 ++ src/Query/SqlWalker.php | 2 ++ .../ORM/Functional/ParserResultSerializationTest.php | 11 +++++++---- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Query/Parser.php b/src/Query/Parser.php index 6020c5aa86..6e0e214899 100644 --- a/src/Query/Parser.php +++ b/src/Query/Parser.php @@ -407,7 +407,9 @@ public function parse() OutputWalker::class, SqlFinalizer::class ); + // @phpstan-ignore method.deprecated $executor = $outputWalker->getExecutor($AST); + // @phpstan-ignore method.deprecated $this->parserResult->setSqlExecutor($executor); } diff --git a/src/Query/SqlWalker.php b/src/Query/SqlWalker.php index 30854ad415..5fe5396518 100644 --- a/src/Query/SqlWalker.php +++ b/src/Query/SqlWalker.php @@ -278,6 +278,8 @@ public function setQueryComponent($dqlAlias, array $queryComponent) * @param AST\DeleteStatement|AST\UpdateStatement|AST\SelectStatement $AST * * @return Exec\AbstractSqlExecutor + * + * @not-deprecated */ public function getExecutor($AST) { diff --git a/tests/Tests/ORM/Functional/ParserResultSerializationTest.php b/tests/Tests/ORM/Functional/ParserResultSerializationTest.php index 8cb109cf21..9ce011605b 100644 --- a/tests/Tests/ORM/Functional/ParserResultSerializationTest.php +++ b/tests/Tests/ORM/Functional/ParserResultSerializationTest.php @@ -6,7 +6,9 @@ use Closure; use Doctrine\ORM\Query; -use Doctrine\ORM\Query\Exec\SingleSelectExecutor; +use Doctrine\ORM\Query\Exec\FinalizedSelectExecutor; +use Doctrine\ORM\Query\Exec\PreparedExecutorFinalizer; +use Doctrine\ORM\Query\Exec\SqlFinalizer; use Doctrine\ORM\Query\ParserResult; use Doctrine\ORM\Query\ResultSetMapping; use Doctrine\Tests\OrmFunctionalTestCase; @@ -143,11 +145,12 @@ public static function provideSerializedSingleSelectResults(): Generator public function testSymfony44ProvidedData(): void { - $sqlExecutor = $this->createMock(SingleSelectExecutor::class); + $sqlExecutor = new FinalizedSelectExecutor('test'); + $sqlFinalizeer = new PreparedExecutorFinalizer($sqlExecutor); $resultSetMapping = $this->createMock(ResultSetMapping::class); $parserResult = new ParserResult(); - $parserResult->setSqlExecutor($sqlExecutor); + $parserResult->setSqlFinalizer($sqlFinalizeer); $parserResult->setResultSetMapping($resultSetMapping); $parserResult->addParameterMapping('name', 0); @@ -157,7 +160,7 @@ public function testSymfony44ProvidedData(): void $this->assertInstanceOf(ParserResult::class, $unserialized); $this->assertInstanceOf(ResultSetMapping::class, $unserialized->getResultSetMapping()); $this->assertEquals(['name' => [0]], $unserialized->getParameterMappings()); - $this->assertInstanceOf(SingleSelectExecutor::class, $unserialized->getSqlExecutor()); + $this->assertEquals($sqlExecutor, $unserialized->prepareSqlExecutor($this->createMock(Query::class))); } private static function parseQuery(Query $query): ParserResult