Skip to content

Commit d90b32b

Browse files
authored
Merge pull request #12263 from doctrine/2.20.x-merge-up-into-2.21.x_7FMImxhr
Merge release 2.20.8 into 2.21.x
2 parents 99c96b4 + 5bff091 commit d90b32b

File tree

10 files changed

+152
-57
lines changed

10 files changed

+152
-57
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"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: "Composer Lint"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "*.x"
7+
paths:
8+
- ".github/workflows/composer-lint.yml"
9+
- "composer.json"
10+
push:
11+
branches:
12+
- "*.x"
13+
paths:
14+
- ".github/workflows/composer-lint.yml"
15+
- "composer.json"
16+
17+
jobs:
18+
composer-lint:
19+
name: "Composer Lint"
20+
uses: "doctrine/.github/.github/workflows/[email protected]"

.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: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
{
22
"name": "doctrine/orm",
3-
"type": "library",
43
"description": "Object-Relational-Mapper for PHP",
5-
"keywords": ["orm", "database"],
6-
"homepage": "https://www.doctrine-project.org/projects/orm.html",
74
"license": "MIT",
8-
"authors": [
9-
{"name": "Guilherme Blanco", "email": "[email protected]"},
10-
{"name": "Roman Borschel", "email": "[email protected]"},
11-
{"name": "Benjamin Eberlei", "email": "[email protected]"},
12-
{"name": "Jonathan Wage", "email": "[email protected]"},
13-
{"name": "Marco Pivetta", "email": "[email protected]"}
5+
"type": "library",
6+
"keywords": [
7+
"orm",
8+
"database"
149
],
15-
"scripts": {
16-
"docs": "composer --working-dir docs update && ./docs/vendor/bin/build-docs.sh @additional_args"
17-
},
18-
"config": {
19-
"allow-plugins": {
20-
"composer/package-versions-deprecated": true,
21-
"dealerdirect/phpcodesniffer-composer-installer": true,
22-
"phpstan/extension-installer": true
10+
"authors": [
11+
{
12+
"name": "Guilherme Blanco",
13+
"email": "[email protected]"
2314
},
24-
"sort-packages": true
25-
},
15+
{
16+
"name": "Roman Borschel",
17+
"email": "[email protected]"
18+
},
19+
{
20+
"name": "Benjamin Eberlei",
21+
"email": "[email protected]"
22+
},
23+
{
24+
"name": "Jonathan Wage",
25+
"email": "[email protected]"
26+
},
27+
{
28+
"name": "Marco Pivetta",
29+
"email": "[email protected]"
30+
}
31+
],
32+
"homepage": "https://www.doctrine-project.org/projects/orm.html",
2633
"require": {
2734
"php": "^7.1 || ^8.0",
28-
"composer-runtime-api": "^2",
2935
"ext-ctype": "*",
36+
"composer-runtime-api": "^2",
3037
"doctrine/cache": "^1.12.1 || ^2.1.1",
3138
"doctrine/collections": "^1.5 || ^2.1",
3239
"doctrine/common": "^3.0.3",
@@ -47,7 +54,7 @@
4754
"doctrine/coding-standard": "^9.0.2 || ^14.0",
4855
"phpbench/phpbench": "^0.16.10 || ^1.0",
4956
"phpstan/extension-installer": "~1.1.0 || ^1.4",
50-
"phpstan/phpstan": "~1.4.10 || 2.1.22",
57+
"phpstan/phpstan": "~1.4.10 || 2.1.23",
5158
"phpstan/phpstan-deprecation-rules": "^1 || ^2",
5259
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6",
5360
"psr/log": "^1 || ^2 || ^3",
@@ -64,17 +71,29 @@
6471
"symfony/yaml": "If you want to use YAML Metadata Mapping Driver"
6572
},
6673
"autoload": {
67-
"psr-4": { "Doctrine\\ORM\\": "src" }
74+
"psr-4": {
75+
"Doctrine\\ORM\\": "src"
76+
}
6877
},
6978
"autoload-dev": {
7079
"psr-4": {
71-
"Doctrine\\Tests\\": "tests/Tests",
80+
"Doctrine\\Performance\\": "tests/Performance",
7281
"Doctrine\\StaticAnalysis\\": "tests/StaticAnalysis",
73-
"Doctrine\\Performance\\": "tests/Performance"
82+
"Doctrine\\Tests\\": "tests/Tests"
7483
}
7584
},
76-
"bin": ["bin/doctrine"],
77-
"archive": {
78-
"exclude": ["!vendor", "tests", "*phpunit.xml", "build.xml", "build.properties", "composer.phar", "vendor/satooshi", "lib/vendor", "*.swp"]
85+
"bin": [
86+
"bin/doctrine"
87+
],
88+
"config": {
89+
"allow-plugins": {
90+
"composer/package-versions-deprecated": true,
91+
"dealerdirect/phpcodesniffer-composer-installer": true,
92+
"phpstan/extension-installer": true
93+
},
94+
"sort-packages": true
95+
},
96+
"scripts": {
97+
"docs": "composer --working-dir docs update && ./docs/vendor/bin/build-docs.sh @additional_args"
7998
}
8099
}

docs/en/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ If this documentation is not helping to answer questions you have about
1313
Doctrine ORM don't panic. You can get help from different sources:
1414

1515
- There is a :doc:`FAQ <reference/faq>` with answers to frequent questions.
16-
- The `Doctrine Mailing List <https://groups.google.com/group/doctrine-user>`_
1716
- Slack chat room `#orm <https://www.doctrine-project.org/slack>`_
1817
- Report a bug on `GitHub <https://github.com/doctrine/orm/issues>`_.
1918
- On `StackOverflow <https://stackoverflow.com/questions/tagged/doctrine-orm>`_

phpstan-baseline.neon

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,12 @@ parameters:
10561056
count: 1
10571057
path: src/Internal/HydrationCompleteHandler.php
10581058

1059+
-
1060+
message: '#^Offset int\|null might not exist on array\<int, object\>\.$#'
1061+
identifier: offsetAccess.notFound
1062+
count: 1
1063+
path: src/Internal/StronglyConnectedComponents.php
1064+
10591065
-
10601066
message: '#^Property Doctrine\\ORM\\Internal\\StronglyConnectedComponents\:\:\$representingNodes \(array\<int, object\>\) does not accept array\<int\|string, object\>\.$#'
10611067
identifier: assign.propertyType
@@ -3594,7 +3600,7 @@ parameters:
35943600
-
35953601
message: '#^Property Doctrine\\ORM\\Query\\Filter\\SQLFilter\:\:\$parameters \(array\<string, array\{type\: string, value\: mixed, is_list\: bool\}\>\) does not accept non\-empty\-array\<string, array\{value\: mixed, type\: int\|string, is_list\: bool\}\>\.$#'
35963602
identifier: assign.propertyType
3597-
count: 1
3603+
count: 2
35983604
path: src/Query/Filter/SQLFilter.php
35993605

36003606
-
@@ -4173,12 +4179,6 @@ parameters:
41734179
count: 1
41744180
path: src/Tools/Console/Command/ConvertMappingCommand.php
41754181

4176-
-
4177-
message: '#^Parameter \#2 \$destPath of method Doctrine\\ORM\\Tools\\Console\\Command\\ConvertMappingCommand\:\:getExporter\(\) expects string, string\|false given\.$#'
4178-
identifier: argument.type
4179-
count: 1
4180-
path: src/Tools/Console/Command/ConvertMappingCommand.php
4181-
41824182
-
41834183
message: '#^Access to an undefined property Doctrine\\Persistence\\Mapping\\ClassMetadata\:\:\$name\.$#'
41844184
identifier: property.notFound
@@ -4203,12 +4203,6 @@ parameters:
42034203
count: 1
42044204
path: src/Tools/Console/Command/GenerateEntitiesCommand.php
42054205

4206-
-
4207-
message: '#^Parameter \#2 \$outputDirectory of method Doctrine\\ORM\\Tools\\EntityGenerator\:\:generate\(\) expects string, string\|false given\.$#'
4208-
identifier: argument.type
4209-
count: 1
4210-
path: src/Tools/Console/Command/GenerateEntitiesCommand.php
4211-
42124206
-
42134207
message: '#^Access to an undefined property Doctrine\\Persistence\\Mapping\\ClassMetadata\:\:\$name\.$#'
42144208
identifier: property.notFound
@@ -4227,12 +4221,6 @@ parameters:
42274221
count: 1
42284222
path: src/Tools/Console/Command/GenerateProxiesCommand.php
42294223

4230-
-
4231-
message: '#^Parameter \#2 \$proxyDir of method Doctrine\\ORM\\Proxy\\ProxyFactory\:\:generateProxyClasses\(\) expects string\|null, string\|false given\.$#'
4232-
identifier: argument.type
4233-
count: 1
4234-
path: src/Tools/Console/Command/GenerateProxiesCommand.php
4235-
42364224
-
42374225
message: '#^Access to an undefined property Doctrine\\Persistence\\Mapping\\ClassMetadata\:\:\$customRepositoryClassName\.$#'
42384226
identifier: property.notFound
@@ -4251,12 +4239,6 @@ parameters:
42514239
count: 1
42524240
path: src/Tools/Console/Command/GenerateRepositoriesCommand.php
42534241

4254-
-
4255-
message: '#^Parameter \#2 \$outputDirectory of method Doctrine\\ORM\\Tools\\EntityRepositoryGenerator\:\:writeEntityRepositoryClass\(\) expects string, string\|false given\.$#'
4256-
identifier: argument.type
4257-
count: 1
4258-
path: src/Tools/Console/Command/GenerateRepositoriesCommand.php
4259-
42604242
-
42614243
message: '#^Method Doctrine\\ORM\\Tools\\Console\\Command\\MappingDescribeCommand\:\:formatMappings\(\) has parameter \$propertyMappings with no value type specified in iterable type array\.$#'
42624244
identifier: missingType.iterableValue

src/Persisters/Entity/BasicEntityPersister.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,6 +1753,11 @@ public function getSelectConditionStatementSQL($field, $value, $assoc = null, $c
17531753
$value = [$value];
17541754
}
17551755

1756+
if ($value === []) {
1757+
$selectedColumns[] = '1=0';
1758+
continue;
1759+
}
1760+
17561761
$nullKeys = array_keys($value, null, true);
17571762
$nonNullValues = array_diff_key($value, array_flip($nullKeys));
17581763

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
/**
45+
* @Entity()
46+
*/
47+
class GH12254EntityA
48+
{
49+
/**
50+
* @Column(type="integer")
51+
* @Id()
52+
* @GeneratedValue(strategy="AUTO")
53+
* @var int
54+
*/
55+
public $id;
56+
57+
/**
58+
* @Column(type="string", nullable=true)
59+
* @var string|null
60+
*/
61+
public $name = null;
62+
}

tests/Tests/ORM/Persisters/BasicEntityPersisterTypeValueSqlTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ public function testSelectConditionStatementNeqNull(): void
129129
self::assertEquals('test IS NOT NULL', $statement);
130130
}
131131

132-
/** @group DDC-3056 */
132+
/**
133+
* @group DDC-3056
134+
* @group GH12254
135+
*/
133136
public function testSelectConditionStatementWithMultipleValuesContainingNull(): void
134137
{
135138
self::assertEquals(
@@ -151,6 +154,11 @@ public function testSelectConditionStatementWithMultipleValuesContainingNull():
151154
'(t0.id IN (?, ?) OR t0.id IS NULL)',
152155
$this->persister->getSelectConditionStatementSQL('id', [123, null, 234])
153156
);
157+
158+
self::assertEquals(
159+
'1=0',
160+
$this->persister->getSelectConditionStatementSQL('id', [])
161+
);
154162
}
155163

156164
public function testCountCondition(): void

0 commit comments

Comments
 (0)