Skip to content

Commit a6c1e63

Browse files
authored
Merge pull request #12266 from doctrine/3.5.x-merge-up-into-3.6.x_hSSiOXm0
Merge release 3.5.6 into 3.6.x
2 parents 6881cdf + b622922 commit a6c1e63

File tree

9 files changed

+82
-17
lines changed

9 files changed

+82
-17
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ on:
2424

2525
jobs:
2626
coding-standards:
27-
uses: "doctrine/.github/.github/workflows/coding-standards.yml@12.1.0"
27+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@v12.2.0"

.github/workflows/composer-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ on:
1717
jobs:
1818
composer-lint:
1919
name: "Composer Lint"
20-
uses: "doctrine/.github/.github/workflows/composer-lint.yml@12.1.0"
20+
uses: "doctrine/.github/.github/workflows/composer-lint.yml@v12.2.0"

.github/workflows/documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ on:
1717
jobs:
1818
documentation:
1919
name: "Documentation"
20-
uses: "doctrine/.github/.github/workflows/documentation.yml@12.1.0"
20+
uses: "doctrine/.github/.github/workflows/documentation.yml@v12.2.0"

.github/workflows/release-on-milestone-closed.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
release:
10-
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@12.1.0"
10+
uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@v12.2.0"
1111
secrets:
1212
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
1313
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"phpbench/phpbench": "^1.0",
5252
"phpdocumentor/guides-cli": "^1.4",
5353
"phpstan/extension-installer": "^1.4",
54-
"phpstan/phpstan": "2.1.22",
54+
"phpstan/phpstan": "2.1.23",
5555
"phpstan/phpstan-deprecation-rules": "^2",
5656
"phpunit/phpunit": "^10.5.0 || ^11.5",
5757
"psr/log": "^1 || ^2 || ^3",

phpstan-baseline.neon

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -696,12 +696,6 @@ parameters:
696696
count: 1
697697
path: src/Internal/Hydration/AbstractHydrator.php
698698

699-
-
700-
message: '#^Method Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator\:\:gatherRowData\(\) should return array\{data\: array\<array\>, newObjects\?\: array\<array\{class\: ReflectionClass, args\: array, obj\: object\}\>, scalars\?\: array\} but returns array\{data\: array, newObjects\: array\<array\{class\: ReflectionClass\<object\>, args\: array, obj\?\: object\}\>, scalars\?\: non\-empty\-array\}\.$#'
701-
identifier: return.type
702-
count: 1
703-
path: src/Internal/Hydration/AbstractHydrator.php
704-
705699
-
706700
message: '#^Method Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator\:\:getClassMetadata\(\) return type with generic class Doctrine\\ORM\\Mapping\\ClassMetadata does not specify its types\: T$#'
707701
identifier: missingType.generics
@@ -822,6 +816,12 @@ parameters:
822816
count: 1
823817
path: src/Internal/HydrationCompleteHandler.php
824818

819+
-
820+
message: '#^Offset int\|null might not exist on array\<int, object\>\.$#'
821+
identifier: offsetAccess.notFound
822+
count: 1
823+
path: src/Internal/StronglyConnectedComponents.php
824+
825825
-
826826
message: '#^Property Doctrine\\ORM\\Internal\\StronglyConnectedComponents\:\:\$representingNodes \(array\<int, object\>\) does not accept array\<int\|string, object\>\.$#'
827827
identifier: assign.propertyType
@@ -1536,6 +1536,12 @@ parameters:
15361536
count: 1
15371537
path: src/Mapping/LegacyReflectionFields.php
15381538

1539+
-
1540+
message: '#^Strict comparison using \!\=\= between array\<string, string\> and null will always evaluate to true\.$#'
1541+
identifier: notIdentical.alwaysTrue
1542+
count: 1
1543+
path: src/Mapping/ManyToManyOwningSideMapping.php
1544+
15391545
-
15401546
message: '#^Method Doctrine\\ORM\\Mapping\\MappedSuperclass\:\:__construct\(\) has parameter \$repositoryClass with generic class Doctrine\\ORM\\EntityRepository but does not specify its types\: T$#'
15411547
identifier: missingType.generics
@@ -2874,12 +2880,6 @@ parameters:
28742880
count: 1
28752881
path: src/Tools/Console/Command/GenerateProxiesCommand.php
28762882

2877-
-
2878-
message: '#^Parameter \#2 \$proxyDir of method Doctrine\\ORM\\Proxy\\ProxyFactory\:\:generateProxyClasses\(\) expects string\|null, string\|false given\.$#'
2879-
identifier: argument.type
2880-
count: 1
2881-
path: src/Tools/Console/Command/GenerateProxiesCommand.php
2882-
28832883
-
28842884
message: '#^Method Doctrine\\ORM\\Tools\\Console\\Command\\MappingDescribeCommand\:\:getClassMetadata\(\) return type with generic class Doctrine\\ORM\\Mapping\\ClassMetadata does not specify its types\: T$#'
28852885
identifier: missingType.generics

src/Persisters/Entity/BasicEntityPersister.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,11 @@ public function getSelectConditionStatementSQL(
16681668
$value = [$value];
16691669
}
16701670

1671+
if ($value === []) {
1672+
$selectedColumns[] = '1=0';
1673+
continue;
1674+
}
1675+
16711676
$nullKeys = array_keys($value, null, true);
16721677
$nonNullValues = array_diff_key($value, array_flip($nullKeys));
16731678

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Doctrine\Tests\ORM\Functional\Ticket;
6+
7+
use Doctrine\ORM\Mapping\Column;
8+
use Doctrine\ORM\Mapping\Entity;
9+
use Doctrine\ORM\Mapping\GeneratedValue;
10+
use Doctrine\ORM\Mapping\Id;
11+
use Doctrine\Tests\OrmFunctionalTestCase;
12+
13+
class GH12254Test extends OrmFunctionalTestCase
14+
{
15+
protected function setUp(): void
16+
{
17+
parent::setUp();
18+
19+
$this->setUpEntitySchema([
20+
GH12254EntityA::class,
21+
]);
22+
23+
$this->_em->persist(new GH12254EntityA());
24+
$this->_em->flush();
25+
$this->_em->clear();
26+
}
27+
28+
public function testFindByEmptyArrayShouldReturnEmptyArray(): void
29+
{
30+
// pretend we are starting afresh
31+
$this->_em = $this->getEntityManager();
32+
$result = $this->_em->getRepository(GH12254EntityA::class)->findBy(['id' => []]);
33+
$this->assertEmpty($result);
34+
}
35+
36+
public function testFindByInNullableField(): void
37+
{
38+
$this->_em = $this->getEntityManager();
39+
$result = $this->_em->getRepository(GH12254EntityA::class)->findBy(['name' => []]);
40+
$this->assertEmpty($result);
41+
}
42+
}
43+
44+
#[Entity]
45+
class GH12254EntityA
46+
{
47+
#[Column(type: 'integer')]
48+
#[Id]
49+
#[GeneratedValue(strategy: 'AUTO')]
50+
public int $id;
51+
52+
#[Column(type: 'string', nullable: true)]
53+
public string|null $name = null;
54+
}

tests/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public function testSelectConditionStatementNeqNull(): void
147147
}
148148

149149
#[Group('DDC-3056')]
150+
#[Group('GH12254')]
150151
public function testSelectConditionStatementWithMultipleValuesContainingNull(): void
151152
{
152153
self::assertEquals(
@@ -168,6 +169,11 @@ public function testSelectConditionStatementWithMultipleValuesContainingNull():
168169
'(t0.id IN (?, ?) OR t0.id IS NULL)',
169170
$this->persister->getSelectConditionStatementSQL('id', [123, null, 234]),
170171
);
172+
173+
self::assertEquals(
174+
'1=0',
175+
$this->persister->getSelectConditionStatementSQL('id', []),
176+
);
171177
}
172178

173179
public function testCountCondition(): void

0 commit comments

Comments
 (0)