Skip to content

Commit

Permalink
Address PHPStan complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude committed Oct 10, 2024
1 parent 8beab61 commit b8ec657
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Query/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 2 additions & 0 deletions src/Query/SqlWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
11 changes: 7 additions & 4 deletions tests/Tests/ORM/Functional/ParserResultSerializationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Check failure on line 11 in tests/Tests/ORM/Functional/ParserResultSerializationTest.php

View workflow job for this annotation

GitHub Actions / coding-standards / Coding Standards (8.3)

Type Doctrine\ORM\Query\Exec\SqlFinalizer is not used in this file.
use Doctrine\ORM\Query\ParserResult;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\Tests\OrmFunctionalTestCase;
Expand Down Expand Up @@ -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);

Expand All @@ -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
Expand Down

0 comments on commit b8ec657

Please sign in to comment.