Skip to content

Commit

Permalink
requested changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuruuh committed Dec 13, 2023
1 parent 510d4b0 commit 06fc20f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
4 changes: 0 additions & 4 deletions lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
use Doctrine\ORM\PersistentCollection;
use Doctrine\ORM\Query;
use Doctrine\ORM\UnitOfWork;
use ReflectionClass;
use ReflectionException;

use function array_fill_keys;
use function array_key_exists;
use function array_keys;
use function array_map;
use function assert;
use function count;
use function is_array;
use function key;
Expand Down Expand Up @@ -570,7 +567,6 @@ protected function hydrateRowData(array $row, array &$result)

foreach ($rowData['newObjects'] as $objIndex => $newObject) {
$class = $newObject['class'];
assert($class instanceof ReflectionClass);
$args = $newObject['args'];

if (PHP_VERSION_ID >= 80000) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Query/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,7 @@ public function NewObjectExpression()
while ($this->lexer->isNextToken(Lexer::T_COMMA)) {
$this->match(Lexer::T_COMMA);
if ($this->lexer->isNextToken(Lexer::T_CLOSE_PARENTHESIS)) {
// Comma above is a trailling comma, ignore it
// Comma above is a trailing comma, ignore it
break;
}

Expand Down
16 changes: 6 additions & 10 deletions tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1076,13 +1076,12 @@ public function testClassCantBeInstantiatedException(): void
$this->_em->createQuery($dql)->getResult();
}

/** @return array<string, string> */
/** @return array<string, array{string}> */
public static function provideQueriesWithNamedArguments(): array
{
return [
'Only named arguments in order' => [
'query' => '
SELECT
'SELECT
new Doctrine\Tests\Models\CMS\CmsUserDTO(
name: u.name,
email: e.email,
Expand All @@ -1098,8 +1097,7 @@ public static function provideQueriesWithNamedArguments(): array
u.name',
],
'Only named arguments not in order' => [
'query' => '
SELECT
'SELECT
new Doctrine\Tests\Models\CMS\CmsUserDTO(
email: e.email,
name: u.name,
Expand All @@ -1115,8 +1113,7 @@ public static function provideQueriesWithNamedArguments(): array
u.name',
],
'Both named and unnamed arguments' => [
'query' => '
SELECT
'SELECT
new Doctrine\Tests\Models\CMS\CmsUserDTO(
u.name,
address: a.city,
Expand All @@ -1131,9 +1128,8 @@ public static function provideQueriesWithNamedArguments(): array
ORDER BY
u.name',
],
'Both named and unnamed arguments without trailling comma' => [
'query' => '
SELECT
'Both named and unnamed arguments without trailing comma' => [
'SELECT
new Doctrine\Tests\Models\CMS\CmsUserDTO(
u.name,
address: a.city,
Expand Down

0 comments on commit 06fc20f

Please sign in to comment.