Skip to content

Commit

Permalink
Merge branch '2.18.x' into 3.0.x
Browse files Browse the repository at this point in the history
* 2.18.x:
  Add compatibility with the Symfony 4.4 VarExporter (#10948)
  PHPStan 5.16.0, Symfony 7.0 (#11095)
  • Loading branch information
derrabus committed Dec 1, 2023
2 parents f8ced51 + 23d36c0 commit 28d03e4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"phpunit/phpunit": "^10.4.0",
"psr/log": "^1 || ^2 || ^3",
"squizlabs/php_codesniffer": "3.7.2",
"symfony/cache": "^5.4 || ^6.2",
"vimeo/psalm": "5.15.0"
"symfony/cache": "^5.4 || ^6.2 || ^7.0",
"vimeo/psalm": "5.16.0"
},
"minimum-stability": "RC",
"suggest": {
Expand Down
20 changes: 10 additions & 10 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.15.0@5c774aca4746caf3d239d9c8cadb9f882ca29352">
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591">
<file src="lib/Doctrine/ORM/AbstractQuery.php">
<FalsableReturnStatement>
<code><![CDATA[! $filteredParameters->isEmpty() ? $filteredParameters->first() : null]]></code>
Expand Down Expand Up @@ -723,15 +723,6 @@
<code><![CDATA[$this->currentPersisterContext->sqlTableAliases]]></code>
</PropertyTypeCoercion>
</file>
<file src="lib/Doctrine/ORM/Proxy/DefaultProxyClassNameResolver.php">
<LessSpecificReturnStatement>
<code>$className</code>
<code>substr($className, $pos + Proxy::MARKER_LENGTH + 2)</code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType>
<code>string</code>
</MoreSpecificReturnType>
</file>
<file src="lib/Doctrine/ORM/Proxy/Autoloader.php">
<ArgumentTypeCoercion>
<code>$autoloader</code>
Expand All @@ -746,6 +737,15 @@
<code>require $file</code>
</UnresolvableInclude>
</file>
<file src="lib/Doctrine/ORM/Proxy/DefaultProxyClassNameResolver.php">
<LessSpecificReturnStatement>
<code>$className</code>
<code>substr($className, $pos + Proxy::MARKER_LENGTH + 2)</code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType>
<code>string</code>
</MoreSpecificReturnType>
</file>
<file src="lib/Doctrine/ORM/Proxy/ProxyFactory.php">
<ArgumentTypeCoercion>
<code>$classMetadata</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,25 @@ public static function provideSerializedSingleSelectResults(): Generator
yield '2.17.0' => [rtrim(file_get_contents(__DIR__ . '/ParserResults/single_select_2_17_0.txt'), "\n")];
}

public function testSymfony44ProvidedData(): void
{
$sqlExecutor = $this->createMock(SingleSelectExecutor::class);
$resultSetMapping = $this->createMock(ResultSetMapping::class);

$parserResult = new ParserResult();
$parserResult->setSqlExecutor($sqlExecutor);
$parserResult->setResultSetMapping($resultSetMapping);
$parserResult->addParameterMapping('name', 0);

$exported = VarExporter::export($parserResult);
$unserialized = eval('return ' . $exported . ';');

$this->assertInstanceOf(ParserResult::class, $unserialized);
$this->assertInstanceOf(ResultSetMapping::class, $unserialized->getResultSetMapping());
$this->assertEquals(['name' => [0]], $unserialized->getParameterMappings());
$this->assertInstanceOf(SingleSelectExecutor::class, $unserialized->getSqlExecutor());
}

private static function parseQuery(Query $query): ParserResult
{
$r = new ReflectionMethod($query, 'parse');
Expand Down

0 comments on commit 28d03e4

Please sign in to comment.