Skip to content

Commit 42a693c

Browse files
committed
Merge remote-tracking branch 'origin/3.6.x' into 4.0.x
2 parents 03cc07e + fc1bf3b commit 42a693c

File tree

9 files changed

+54
-67
lines changed

9 files changed

+54
-67
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ build.properties.dev export-ignore
1111
build.xml export-ignore
1212
CONTRIBUTING.md export-ignore
1313
phpunit.xml.dist export-ignore
14-
run-all.sh export-ignore
1514
phpcs.xml.dist export-ignore
1615
phpbench.json export-ignore
1716
phpstan.neon export-ignore

.github/workflows/continuous-integration.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868

6969
steps:
7070
- name: "Checkout"
71-
uses: "actions/checkout@v4"
71+
uses: "actions/checkout@v5"
7272
with:
7373
fetch-depth: 2
7474

@@ -155,7 +155,7 @@ jobs:
155155

156156
steps:
157157
- name: "Checkout"
158-
uses: "actions/checkout@v4"
158+
uses: "actions/checkout@v5"
159159
with:
160160
fetch-depth: 2
161161

@@ -219,7 +219,7 @@ jobs:
219219

220220
steps:
221221
- name: "Checkout"
222-
uses: "actions/checkout@v4"
222+
uses: "actions/checkout@v5"
223223
with:
224224
fetch-depth: 2
225225

@@ -291,7 +291,7 @@ jobs:
291291

292292
steps:
293293
- name: "Checkout"
294-
uses: "actions/checkout@v4"
294+
uses: "actions/checkout@v5"
295295
with:
296296
fetch-depth: 2
297297

@@ -341,12 +341,12 @@ jobs:
341341

342342
steps:
343343
- name: "Checkout"
344-
uses: "actions/checkout@v4"
344+
uses: "actions/checkout@v5"
345345
with:
346346
fetch-depth: 2
347347

348348
- name: "Download coverage files"
349-
uses: "actions/download-artifact@v4"
349+
uses: "actions/download-artifact@v5"
350350
with:
351351
path: "reports"
352352

.github/workflows/phpbench.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
steps:
3838
- name: "Checkout"
39-
uses: "actions/checkout@v4"
39+
uses: "actions/checkout@v5"
4040
with:
4141
fetch-depth: 2
4242

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
steps:
2929
- name: "Checkout code"
30-
uses: "actions/checkout@v4"
30+
uses: "actions/checkout@v5"
3131

3232
- name: Install PHP
3333
uses: shivammathur/setup-php@v2

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
"phpbench/phpbench": "^1.0",
4141
"phpdocumentor/guides-cli": "^1.4",
4242
"phpstan/extension-installer": "^1.4",
43-
"phpstan/phpstan": "2.0.3",
43+
"phpstan/phpstan": "2.1.22",
4444
"phpstan/phpstan-deprecation-rules": "^2",
4545
"phpunit/phpunit": "^10.4.0",
4646
"psr/log": "^1 || ^2 || ^3",
47-
"squizlabs/php_codesniffer": "3.12.0",
47+
"squizlabs/php_codesniffer": "3.13.2",
4848
"symfony/cache": "^5.4 || ^6.2 || ^7.0 || ^8.0",
4949
"symfony/var-exporter": "^6.3.9 || ^7.0 || ^8.0"
5050
},

phpstan-baseline.neon

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: '#^Expression "\$setCacheEntry\(\$data\)" on a separate line does not do anything\.$#'
5-
identifier: expr.resultUnused
6-
count: 1
7-
path: src/AbstractQuery.php
8-
9-
-
10-
message: '#^Expression "\$setCacheEntry\(\$stmt\)" on a separate line does not do anything\.$#'
11-
identifier: expr.resultUnused
12-
count: 1
13-
path: src/AbstractQuery.php
14-
153
-
164
message: '#^Method Doctrine\\ORM\\AbstractQuery\:\:getParameter\(\) should return Doctrine\\ORM\\Query\\Parameter\|null but returns Doctrine\\ORM\\Query\\Parameter\|false\|null\.$#'
175
identifier: return.type
@@ -234,12 +222,6 @@ parameters:
234222
count: 1
235223
path: src/Cache/DefaultQueryCache.php
236224

237-
-
238-
message: '#^Parameter \#1 \$result of class Doctrine\\ORM\\Cache\\QueryCacheEntry constructor expects array\<string, mixed\>, array\<int\|string, array\<string, array\<mixed\>\>\> given\.$#'
239-
identifier: argument.type
240-
count: 1
241-
path: src/Cache/DefaultQueryCache.php
242-
243225
-
244226
message: '#^Parameter \#2 \$key of method Doctrine\\ORM\\Cache\\Logging\\CacheLogger\:\:entityCacheHit\(\) expects Doctrine\\ORM\\Cache\\EntityCacheKey, Doctrine\\ORM\\Cache\\CacheKey given\.$#'
245227
identifier: argument.type
@@ -516,6 +498,12 @@ parameters:
516498
count: 1
517499
path: src/Cache/TimestampQueryCacheValidator.php
518500

501+
-
502+
message: '#^Call to function is_a\(\) with arguments class\-string\<Doctrine\\ORM\\EntityRepository\>, ''Doctrine\\\\ORM\\\\EntityRepository'' and true will always evaluate to true\.$#'
503+
identifier: function.alreadyNarrowedType
504+
count: 1
505+
path: src/Configuration.php
506+
519507
-
520508
message: '#^Method Doctrine\\ORM\\Configuration\:\:getDefaultRepositoryClassName\(\) return type with generic class Doctrine\\ORM\\EntityRepository does not specify its types\: T$#'
521509
identifier: missingType.generics
@@ -558,12 +546,6 @@ parameters:
558546
count: 1
559547
path: src/Decorator/EntityManagerDecorator.php
560548

561-
-
562-
message: '#^Call to an undefined method object\:\:setEntityManager\(\)\.$#'
563-
identifier: method.notFound
564-
count: 1
565-
path: src/EntityManager.php
566-
567549
-
568550
message: '#^Method Doctrine\\ORM\\EntityManager\:\:checkLockRequirements\(\) has parameter \$class with generic class Doctrine\\ORM\\Mapping\\ClassMetadata but does not specify its types\: T$#'
569551
identifier: missingType.generics
@@ -714,6 +696,12 @@ parameters:
714696
count: 1
715697
path: src/Internal/Hydration/AbstractHydrator.php
716698

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+
717705
-
718706
message: '#^Method Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator\:\:getClassMetadata\(\) return type with generic class Doctrine\\ORM\\Mapping\\ClassMetadata does not specify its types\: T$#'
719707
identifier: missingType.generics
@@ -733,13 +721,13 @@ parameters:
733721
path: src/Internal/Hydration/AbstractHydrator.php
734722

735723
-
736-
message: '#^Parameter &\$id by\-ref type of method Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator\:\:gatherRowData\(\) expects array\<string, string\>, array\<int\|string, string\> given\.$#'
724+
message: '#^Parameter &\$id by\-ref type of method Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator\:\:gatherRowData\(\) expects array\<string, string\>, array\<string\> given\.$#'
737725
identifier: parameterByRef.type
738726
count: 1
739727
path: src/Internal/Hydration/AbstractHydrator.php
740728

741729
-
742-
message: '#^Parameter &\$nonemptyComponents by\-ref type of method Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator\:\:gatherRowData\(\) expects array\<string, bool\>, array\<int\|string, bool\> given\.$#'
730+
message: '#^Parameter &\$nonemptyComponents by\-ref type of method Doctrine\\ORM\\Internal\\Hydration\\AbstractHydrator\:\:gatherRowData\(\) expects array\<string, bool\>, array\<bool\> given\.$#'
743731
identifier: parameterByRef.type
744732
count: 1
745733
path: src/Internal/Hydration/AbstractHydrator.php
@@ -1074,6 +1062,12 @@ parameters:
10741062
count: 1
10751063
path: src/Mapping/ClassMetadata.php
10761064

1065+
-
1066+
message: '#^Template type T is declared as covariant, but occurs in invariant position in return type of method Doctrine\\ORM\\Mapping\\ClassMetadata\:\:getReflectionClass\(\)\.$#'
1067+
identifier: generics.variance
1068+
count: 1
1069+
path: src/Mapping/ClassMetadata.php
1070+
10771071
-
10781072
message: '#^Unable to resolve the template type C in call to method Doctrine\\ORM\\Mapping\\ClassMetadata\<T of object\>\:\:fullyQualifiedClassName\(\)$#'
10791073
identifier: argument.templateType
@@ -2919,6 +2913,12 @@ parameters:
29192913
count: 1
29202914
path: src/Tools/SchemaTool.php
29212915

2916+
-
2917+
message: '#^Method Doctrine\\ORM\\Tools\\SchemaTool\:\:getAssetName\(\) has parameter \$asset with generic class Doctrine\\DBAL\\Schema\\AbstractAsset but does not specify its types\: N$#'
2918+
identifier: missingType.generics
2919+
count: 1
2920+
path: src/Tools/SchemaTool.php
2921+
29222922
-
29232923
message: '#^Method Doctrine\\ORM\\Tools\\SchemaTool\:\:getCreateSchemaSql\(\) has parameter \$classes with generic class Doctrine\\ORM\\Mapping\\ClassMetadata but does not specify its types\: T$#'
29242924
identifier: missingType.generics

run-all.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/Mapping/Driver/XmlDriver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
135135
];
136136

137137
if (isset($discrColumn['options'])) {
138-
assert($discrColumn['options'] instanceof SimpleXMLElement);
139138
$columnDef['options'] = $this->parseOptions($discrColumn['options']->children());
140139
}
141140

src/Tools/SchemaTool.php

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Doctrine\DBAL\Schema\Index\IndexedColumn;
1515
use Doctrine\DBAL\Schema\Name\Identifier;
1616
use Doctrine\DBAL\Schema\Name\UnqualifiedName;
17+
use Doctrine\DBAL\Schema\NamedObject;
1718
use Doctrine\DBAL\Schema\PrimaryKeyConstraint;
1819
use Doctrine\DBAL\Schema\Schema;
1920
use Doctrine\DBAL\Schema\Table;
@@ -735,7 +736,7 @@ private function gatherRelationJoinColumns(
735736
$theJoinTable->addUniqueIndex($unique['columns'], is_numeric($indexName) ? null : $indexName);
736737
}
737738

738-
$compositeName = $theJoinTable->getName() . '.' . implode('', $localColumns);
739+
$compositeName = $this->getAssetName($theJoinTable) . '.' . implode('', $localColumns);
739740
if (
740741
isset($addedFks[$compositeName])
741742
&& ($foreignTableName !== $addedFks[$compositeName]['foreignTableName']
@@ -859,15 +860,15 @@ public function getDropSchemaSQL(array $classes): array
859860
$deployedSchema = $this->schemaManager->introspectSchema();
860861

861862
foreach ($schema->getTables() as $table) {
862-
if (! $deployedSchema->hasTable($table->getName())) {
863-
$schema->dropTable($table->getName());
863+
if (! $deployedSchema->hasTable($this->getAssetName($table))) {
864+
$schema->dropTable($this->getAssetName($table));
864865
}
865866
}
866867

867868
if ($this->platform->supportsSequences()) {
868869
foreach ($schema->getSequences() as $sequence) {
869-
if (! $deployedSchema->hasSequence($sequence->getName())) {
870-
$schema->dropSequence($sequence->getName());
870+
if (! $deployedSchema->hasSequence($this->getAssetName($sequence))) {
871+
$schema->dropSequence($this->getAssetName($sequence));
871872
}
872873
}
873874

@@ -889,7 +890,7 @@ public function getDropSchemaSQL(array $classes): array
889890
}
890891

891892
if (count($columns) === 1) {
892-
$checkSequence = $table->getName() . '_' . $columns[0] . '_seq';
893+
$checkSequence = $this->getAssetName($table) . '_' . $columns[0] . '_seq';
893894
if ($deployedSchema->hasSequence($checkSequence) && ! $schema->hasSequence($checkSequence)) {
894895
$schema->createSequence($checkSequence);
895896
}
@@ -951,8 +952,9 @@ private function createSchemaForComparison(Schema $toSchema): Schema
951952
$previousFilter = $config->getSchemaAssetsFilter();
952953

953954
// whitelist assets we already know about in $toSchema, use the existing filter otherwise
954-
$config->setSchemaAssetsFilter(static function ($asset) use ($previousFilter, $toSchema): bool {
955-
$assetName = $asset instanceof AbstractAsset ? $asset->getName() : $asset;
955+
$getAssetName = $this->getAssetName(...);
956+
$config->setSchemaAssetsFilter(static function ($asset) use ($previousFilter, $toSchema, $getAssetName): bool {
957+
$assetName = $asset instanceof AbstractAsset ? $getAssetName($asset) : $asset;
956958

957959
return $toSchema->hasTable($assetName) || $toSchema->hasSequence($assetName) || $previousFilter($asset);
958960
});
@@ -990,4 +992,12 @@ private static function getIndexedColumns(Index $index): array
990992

991993
return $index->getColumns();
992994
}
995+
996+
private function getAssetName(AbstractAsset $asset): string
997+
{
998+
return $asset instanceof NamedObject
999+
? $asset->getObjectName()->toString()
1000+
// DBAL < 4.4
1001+
: $asset->getName();
1002+
}
9931003
}

0 commit comments

Comments
 (0)