Skip to content

Commit 257d3b0

Browse files
committed
Merge branch '3.9.x' into 3.10.x
* 3.9.x: PHPStan 2.1.1 (doctrine#6690) PHPUnit 9.6.22 (doctrine#6691) Bump doctrine/.github from 6.0.0 to 7.1.0 (doctrine#6649) Bump doctrine/.github from 5.3.0 to 6.0.0 (doctrine#6642)
2 parents 54c7706 + 36aa8b4 commit 257d3b0

11 files changed

+213
-25
lines changed

.github/workflows/coding-standards.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ on:
2525
jobs:
2626
coding-standards:
2727
name: "Coding Standards"
28-
uses: "doctrine/.github/.github/workflows/coding-standards.yml@5.3.0"
28+
uses: "doctrine/.github/.github/workflows/coding-standards.yml@7.1.0"

.github/workflows/documentation.yml

+1-1
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@5.3.0"
20+
uses: "doctrine/.github/.github/workflows/documentation.yml@7.1.0"

.github/workflows/static-analysis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
strategy:
3535
matrix:
3636
php-version:
37-
- "8.3"
37+
- "8.4"
3838

3939
steps:
4040
- name: "Checkout code"
@@ -49,6 +49,8 @@ jobs:
4949

5050
- name: "Install dependencies with Composer"
5151
uses: "ramsey/composer-install@v3"
52+
with:
53+
composer-options: "--ignore-platform-req=php+"
5254

5355
- name: "Run a static analysis with phpstan/phpstan"
5456
run: "vendor/bin/phpstan --error-format=checkstyle | cs2pr"

composer.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
"doctrine/coding-standard": "12.0.0",
4444
"fig/log-test": "^1",
4545
"jetbrains/phpstorm-stubs": "2023.1",
46-
"phpstan/phpstan": "1.12.6",
47-
"phpstan/phpstan-strict-rules": "^1.6",
48-
"phpunit/phpunit": "9.6.20",
46+
"phpstan/phpstan": "2.1.1",
47+
"phpstan/phpstan-strict-rules": "^2",
48+
"phpunit/phpunit": "9.6.22",
4949
"psalm/plugin-phpunit": "0.18.4",
5050
"slevomat/coding-standard": "8.13.1",
5151
"squizlabs/php_codesniffer": "3.10.2",

phpstan-baseline.neon

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^@readonly property cannot have a default value\.$#'
5+
identifier: property.readOnlyByPhpDocDefaultValue
6+
count: 1
7+
path: src/Driver/AbstractException.php
8+
9+
-
10+
message: '#^Method Doctrine\\DBAL\\Driver\\OCI8\\Result\:\:fetchAllAssociative\(\) should return list\<array\<string, mixed\>\> but returns array\<mixed\>\.$#'
11+
identifier: return.type
12+
count: 1
13+
path: src/Driver/OCI8/Result.php
14+
15+
-
16+
message: '#^Method Doctrine\\DBAL\\Driver\\OCI8\\Result\:\:fetchAllNumeric\(\) should return list\<list\<mixed\>\> but returns array\<mixed\>\.$#'
17+
identifier: return.type
18+
count: 1
19+
path: src/Driver/OCI8/Result.php
20+
21+
-
22+
message: '#^@readonly property Doctrine\\DBAL\\Driver\\PDO\\PDOException\:\:\$sqlState is assigned outside of the constructor\.$#'
23+
identifier: property.readOnlyByPhpDocAssignNotInConstructor
24+
count: 1
25+
path: src/Driver/PDO/PDOException.php
26+
27+
-
28+
message: '#^@readonly property cannot have a default value\.$#'
29+
identifier: property.readOnlyByPhpDocDefaultValue
30+
count: 1
31+
path: src/Driver/PDO/PDOException.php
32+
33+
-
34+
message: '#^Method Doctrine\\DBAL\\Driver\\PDO\\Result\:\:fetchAll\(\) should return list\<mixed\> but returns array\.$#'
35+
identifier: return.type
36+
count: 1
37+
path: src/Driver/PDO/Result.php
38+
39+
-
40+
message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchAllAssociative\(\) should return list\<array\<string, mixed\>\> but returns array\<int, array\<string, mixed\>\>\.$#'
41+
identifier: return.type
42+
count: 1
43+
path: src/Driver/PgSQL/Result.php
44+
45+
-
46+
message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchAllNumeric\(\) should return list\<list\<mixed\>\> but returns array\<int, list\<mixed\>\>\.$#'
47+
identifier: return.type
48+
count: 1
49+
path: src/Driver/PgSQL/Result.php
50+
51+
-
52+
message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchFirstColumn\(\) should return list\<mixed\> but returns array\<int, bool\|float\|int\|string\|null\>\.$#'
53+
identifier: return.type
54+
count: 1
55+
path: src/Driver/PgSQL/Result.php
56+
57+
-
58+
message: '#^Method Doctrine\\DBAL\\Driver\\SQLite3\\Result\:\:fetchNumeric\(\) should return list\<mixed\>\|false but returns array\|false\.$#'
59+
identifier: return.type
60+
count: 1
61+
path: src/Driver/SQLite3/Result.php
62+
63+
-
64+
message: '#^Method Doctrine\\DBAL\\Platforms\\AbstractMySQLPlatform\:\:getAlterTableSQL\(\) should return list\<string\> but returns array\<mixed\>\.$#'
65+
identifier: return.type
66+
count: 1
67+
path: src/Platforms/AbstractMySQLPlatform.php
68+
69+
-
70+
message: '#^Parameter \#1 \$assets of method Doctrine\\DBAL\\Platforms\\AbstractMySQLPlatform\:\:indexAssetsByLowerCaseName\(\) expects list\<Doctrine\\DBAL\\Schema\\Index\>, array\<Doctrine\\DBAL\\Schema\\Index\> given\.$#'
71+
identifier: argument.type
72+
count: 1
73+
path: src/Platforms/AbstractMySQLPlatform.php
74+
75+
-
76+
message: '#^Method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:buildCreateTableSQL\(\) should return list\<string\> but returns array\<string\>\.$#'
77+
identifier: return.type
78+
count: 2
79+
path: src/Platforms/AbstractPlatform.php
80+
81+
-
82+
message: '#^Method Doctrine\\DBAL\\Platforms\\DB2Platform\:\:getAlterTableSQL\(\) should return list\<string\> but returns array\<mixed\>\.$#'
83+
identifier: return.type
84+
count: 1
85+
path: src/Platforms/DB2Platform.php
86+
87+
-
88+
message: '#^Method Doctrine\\DBAL\\Platforms\\OraclePlatform\:\:getAlterTableSQL\(\) should return list\<string\> but returns array\<mixed\>\.$#'
89+
identifier: return.type
90+
count: 1
91+
path: src/Platforms/OraclePlatform.php
92+
93+
-
94+
message: '#^Method Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform\:\:getAlterTableSQL\(\) should return list\<string\> but returns array\<mixed\>\.$#'
95+
identifier: return.type
96+
count: 1
97+
path: src/Platforms/PostgreSQLPlatform.php
98+
99+
-
100+
message: '#^Method Doctrine\\DBAL\\Platforms\\SQLServerPlatform\:\:getAlterTableSQL\(\) should return list\<string\> but returns array\<mixed\>\.$#'
101+
identifier: return.type
102+
count: 2
103+
path: src/Platforms/SQLServerPlatform.php
104+
105+
-
106+
message: '#^Method Doctrine\\DBAL\\Platforms\\SqlitePlatform\:\:getAlterTableSQL\(\) should return list\<string\> but returns array\<mixed\>\.$#'
107+
identifier: return.type
108+
count: 1
109+
path: src/Platforms/SqlitePlatform.php
110+
111+
-
112+
message: '#^Method Doctrine\\DBAL\\Platforms\\SqlitePlatform\:\:getAlterTableSQL\(\) should return list\<string\> but returns array\<string\>\.$#'
113+
identifier: return.type
114+
count: 1
115+
path: src/Platforms/SqlitePlatform.php
116+
117+
-
118+
message: '#^Parameter &\$knownAliases by\-ref type of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:getSQLForJoins\(\) expects array\<string, true\>, non\-empty\-array\<true\> given\.$#'
119+
identifier: parameterByRef.type
120+
count: 1
121+
path: src/Query/QueryBuilder.php
122+
123+
-
124+
message: '#^Property Doctrine\\DBAL\\Query\\QueryBuilder\:\:\$params \(array\<int\<0, max\>\|string, mixed\>\) does not accept non\-empty\-array\<int\|string, mixed\>\.$#'
125+
identifier: assign.propertyType
126+
count: 1
127+
path: src/Query/QueryBuilder.php
128+
129+
-
130+
message: '#^Parameter \#1 \$sequences of method Doctrine\\DBAL\\SQL\\Builder\\DropSchemaObjectsSQLBuilder\:\:buildSequenceStatements\(\) expects list\<Doctrine\\DBAL\\Schema\\Sequence\>, array\<Doctrine\\DBAL\\Schema\\Sequence\> given\.$#'
131+
identifier: argument.type
132+
count: 1
133+
path: src/SQL/Builder/DropSchemaObjectsSQLBuilder.php
134+
135+
-
136+
message: '#^Parameter \#1 \$tables of method Doctrine\\DBAL\\SQL\\Builder\\DropSchemaObjectsSQLBuilder\:\:buildTableStatements\(\) expects list\<Doctrine\\DBAL\\Schema\\Table\>, array\<Doctrine\\DBAL\\Schema\\Table\> given\.$#'
137+
identifier: argument.type
138+
count: 1
139+
path: src/SQL/Builder/DropSchemaObjectsSQLBuilder.php
140+
141+
-
142+
message: '#^Method Doctrine\\DBAL\\Schema\\AbstractSchemaManager\:\:doListTableNames\(\) should return list\<string\> but returns array\<mixed\>\.$#'
143+
identifier: return.type
144+
count: 1
145+
path: src/Schema/AbstractSchemaManager.php
146+
147+
-
148+
message: '#^Template type T is declared as covariant, but occurs in invariant position in property Doctrine\\DBAL\\Schema\\AbstractSchemaManager\:\:\$_platform\.$#'
149+
identifier: generics.variance
150+
count: 1
151+
path: src/Schema/AbstractSchemaManager.php
152+
153+
-
154+
message: '#^Parameter \#1 \$tables of method Doctrine\\DBAL\\Platforms\\AbstractPlatform\:\:getDropTablesSQL\(\) expects list\<Doctrine\\DBAL\\Schema\\Table\>, array\<Doctrine\\DBAL\\Schema\\Table\> given\.$#'
155+
identifier: argument.type
156+
count: 1
157+
path: src/Schema/SchemaDiff.php
158+
159+
-
160+
message: '#^Method Doctrine\\DBAL\\Schema\\SqliteSchemaManager\:\:addDetailsToTableForeignKeyColumns\(\) should return list\<array\<string, mixed\>\> but returns array\<int\<0, max\>, array\<string, mixed\>\>\.$#'
161+
identifier: return.type
162+
count: 1
163+
path: src/Schema/SqliteSchemaManager.php
164+
165+
-
166+
message: '#^Method Doctrine\\DBAL\\Schema\\TableDiff\:\:getAddedForeignKeys\(\) should return list\<Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\> but returns array\<Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\>\.$#'
167+
identifier: return.type
168+
count: 1
169+
path: src/Schema/TableDiff.php
170+
171+
-
172+
message: '#^Method Doctrine\\DBAL\\Schema\\TableDiff\:\:getDroppedForeignKeys\(\) should return list\<Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|string\> but returns array\<Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\|string\>\.$#'
173+
identifier: return.type
174+
count: 1
175+
path: src/Schema/TableDiff.php
176+
177+
-
178+
message: '#^Method Doctrine\\DBAL\\Schema\\TableDiff\:\:getModifiedForeignKeys\(\) should return list\<Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\> but returns array\<Doctrine\\DBAL\\Schema\\ForeignKeyConstraint\>\.$#'
179+
identifier: return.type
180+
count: 1
181+
path: src/Schema/TableDiff.php

phpstan.neon.dist

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
parameters:
22
level: 8
3-
phpVersion: 80300
3+
phpVersion: 80402
44
paths:
55
- src
66
- static-analysis
@@ -9,10 +9,6 @@ parameters:
99
ignoreErrors:
1010
- identifier: missingType.generics
1111

12-
# https://github.com/doctrine/dbal/pull/3836
13-
# TODO: remove in 4.0.0
14-
- '~^Parameter #2 \$registeredAliases of static method Doctrine\\DBAL\\Query\\QueryException::nonUniqueAlias\(\) expects array<string>, array<int, int\|string> given\.\z~'
15-
1612
# some drivers actually do accept 2nd parameter...
1713
- '~^Method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getListTableForeignKeysSQL\(\) invoked with \d+ parameters, 1 required\.\z~'
1814

@@ -131,7 +127,7 @@ parameters:
131127

132128
# PHPStan does not understand the array shapes returned by pg_fetch_*() methods.
133129
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapAssociativeRow\(\) expects array<string, string\|null>, array<int\|string, string\|null> given\.$~'
134-
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapNumericRow\(\) expects array<int, string\|null>, array<int\|string, string\|null> given\.$~'
130+
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapNumericRow\(\) expects list<string\|null>, .* given\.$~'
135131

136132
# Ignore isset() checks in destructors.
137133
- '~^Property Doctrine\\DBAL\\Driver\\PgSQL\\Connection\:\:\$connection \(PgSql\\Connection\|resource\) in isset\(\) is not nullable\.$~'
@@ -152,5 +148,19 @@ parameters:
152148
message: '#^Parameter \#2 \$callback of function array_reduce expects callable\(\(callable&TIn\)\|Closure\(mixed \$value\)\: mixed\|null, callable\(T\)\: T\)\: \(\(callable&TIn\)\|Closure\(mixed \$value\)\: mixed\|null\), Closure\(callable\|null, callable\)\: \(callable\(T\)\: T\) given\.$#'
153149
path: src/Portability/Converter.php
154150

151+
# The @throws annotations are part of a contract. Even if the default implementation doen't throw those
152+
# exceptions, the child implementations might do so.
153+
-
154+
identifier: throws.unusedType
155+
path: src/Types/Type.php
156+
157+
# We don't narrow the return type of lastInsertId() yet.
158+
- '/^Method Doctrine\\DBAL\\Driver\\.+\\Connection\:\:lastInsertId\(\) never returns (int|false) so it can be removed from the return type\.$/'
159+
160+
# Unnecessarily strict type narrowing
161+
- '~^Method Doctrine\\DBAL\\Driver\\PDO\\ParameterTypeMap\:\:convertParamType\(\) never returns \d+ so it can be removed from the return type\.$~'
162+
155163
includes:
164+
- phpstan-baseline.neon
165+
- phar://phpstan.phar/conf/bleedingEdge.neon
156166
- vendor/phpstan/phpstan-strict-rules/rules.neon

src/Driver/API/OCI/ExceptionConverter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ final class ExceptionConverter implements ExceptionConverterInterface
3232
/** @link http://www.dba-oracle.com/t_error_code_list.htm */
3333
public function convert(Exception $exception, ?Query $query): DriverException
3434
{
35-
/** @psalm-var int|'HY000' $code */
35+
/** @psalm-var int|'HY000' $code */ // @phpstan-ignore varTag.type
3636
$code = $exception->getCode();
37-
/** @psalm-suppress NoInterfaceProperties */
37+
/** @psalm-suppress NoInterfaceProperties */ // @phpstan-ignore property.notFound, property.notFound
3838
if ($code === 'HY000' && isset($exception->errorInfo[1], $exception->errorInfo[2])) {
3939
$errorInfo = $exception->errorInfo;
4040
$exception = new PDOException($errorInfo[2], $errorInfo[1]);

src/Event/SchemaDropTableEventArgs.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Doctrine\DBAL\Platforms\AbstractPlatform;
66
use Doctrine\DBAL\Schema\Table;
7-
use InvalidArgumentException;
87

98
/**
109
* Event Arguments used when the SQL query for dropping tables are generated inside {@see AbstractPlatform}.
@@ -21,11 +20,7 @@ class SchemaDropTableEventArgs extends SchemaEventArgs
2120
/** @var string|null */
2221
private $sql;
2322

24-
/**
25-
* @param string|Table $table
26-
*
27-
* @throws InvalidArgumentException
28-
*/
23+
/** @param string|Table $table */
2924
public function __construct($table, AbstractPlatform $platform)
3025
{
3126
$this->table = $table;

src/Platforms/AbstractPlatform.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,7 @@ private function buildCreateTableSQL(Table $table, bool $createIndexes, bool $cr
22262226
}
22272227

22282228
/**
2229-
* @param list<Table> $tables
2229+
* @param Table[] $tables
22302230
*
22312231
* @return list<string>
22322232
*

src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function buildSQL(Schema $schema): array
3434
}
3535

3636
/**
37-
* @param list<string> $namespaces
37+
* @param string[] $namespaces
3838
*
3939
* @return list<string>
4040
*
@@ -54,7 +54,7 @@ private function buildNamespaceStatements(array $namespaces): array
5454
}
5555

5656
/**
57-
* @param list<Table> $tables
57+
* @param Table[] $tables
5858
*
5959
* @return list<string>
6060
*
@@ -66,7 +66,7 @@ private function buildTableStatements(array $tables): array
6666
}
6767

6868
/**
69-
* @param list<Sequence> $sequences
69+
* @param Sequence[] $sequences
7070
*
7171
* @return list<string>
7272
*

src/Schema/Comparator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ public function diffColumn(Column $column1, Column $column2)
636636
// null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation.
637637
if (
638638
($properties1['default'] === null) !== ($properties2['default'] === null)
639-
|| $properties1['default'] != $properties2['default']
639+
|| $properties1['default'] != $properties2['default'] // @phpstan-ignore notEqual.notAllowed
640640
) {
641641
$changedProperties[] = 'default';
642642
}

0 commit comments

Comments
 (0)