Skip to content

Commit fc9c98d

Browse files
committed
Merge branch '4.2.x' into 4.3.x
* 4.2.x: Cleanup obsolete PHPStan ignore rules (doctrine#6697) PHPStan 2.1.1 (doctrine#6690) PHPUnit 10.5.39 (doctrine#6692) 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 eea8aaf + 8725a81 commit fc9c98d

6 files changed

+115
-40
lines changed

.github/workflows/coding-standards.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ 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"
29+
with:
30+
composer-options: "--ignore-platform-req=php+"

.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"

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
"doctrine/coding-standard": "12.0.0",
4141
"fig/log-test": "^1",
4242
"jetbrains/phpstorm-stubs": "2023.2",
43-
"phpstan/phpstan": "1.12.6",
44-
"phpstan/phpstan-phpunit": "1.4.0",
45-
"phpstan/phpstan-strict-rules": "^1.6",
46-
"phpunit/phpunit": "10.5.30",
43+
"phpstan/phpstan": "2.1.1",
44+
"phpstan/phpstan-phpunit": "2.0.3",
45+
"phpstan/phpstan-strict-rules": "^2",
46+
"phpunit/phpunit": "10.5.39",
4747
"psalm/plugin-phpunit": "0.19.0",
4848
"slevomat/coding-standard": "8.13.1",
4949
"squizlabs/php_codesniffer": "3.10.2",

phpstan-baseline.neon

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Method Doctrine\\DBAL\\Driver\\IBMDB2\\Connection\:\:exec\(\) never returns numeric\-string so it can be removed from the return type\.$#'
5+
identifier: return.unusedType
6+
count: 1
7+
path: src/Driver/IBMDB2/Connection.php
8+
9+
-
10+
message: '#^Method Doctrine\\DBAL\\Driver\\OCI8\\Connection\:\:exec\(\) never returns numeric\-string so it can be removed from the return type\.$#'
11+
identifier: return.unusedType
12+
count: 1
13+
path: src/Driver/OCI8/Connection.php
14+
15+
-
16+
message: '#^Method Doctrine\\DBAL\\Driver\\OCI8\\Result\:\:fetchAllAssociative\(\) should return list\<array\<string, mixed\>\> but returns array\<mixed\>\.$#'
17+
identifier: return.type
18+
count: 1
19+
path: src/Driver/OCI8/Result.php
20+
21+
-
22+
message: '#^Method Doctrine\\DBAL\\Driver\\OCI8\\Result\:\:fetchAllNumeric\(\) should return list\<list\<mixed\>\> but returns array\<mixed\>\.$#'
23+
identifier: return.type
24+
count: 1
25+
path: src/Driver/OCI8/Result.php
26+
27+
-
28+
message: '#^Method Doctrine\\DBAL\\Driver\\PDO\\Result\:\:fetchAll\(\) should return list\<mixed\> but returns array\.$#'
29+
identifier: return.type
30+
count: 1
31+
path: src/Driver/PDO/Result.php
32+
33+
-
34+
message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchAllAssociative\(\) should return list\<array\<string, mixed\>\> but returns array\<int, array\<string, mixed\>\>\.$#'
35+
identifier: return.type
36+
count: 1
37+
path: src/Driver/PgSQL/Result.php
38+
39+
-
40+
message: '#^Method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:fetchAllNumeric\(\) should return list\<list\<mixed\>\> but returns array\<int, list\<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\:\:fetchFirstColumn\(\) should return list\<mixed\> but returns array\<int, bool\|float\|int\|string\|null\>\.$#'
47+
identifier: return.type
48+
count: 1
49+
path: src/Driver/PgSQL/Result.php
50+
51+
-
52+
message: '#^Method Doctrine\\DBAL\\Driver\\SQLite3\\Result\:\:fetchNumeric\(\) should return list\<mixed\>\|false but returns array\|false\.$#'
53+
identifier: return.type
54+
count: 1
55+
path: src/Driver/SQLite3/Result.php
56+
57+
-
58+
message: '#^Template type T is declared as covariant, but occurs in invariant position in property Doctrine\\DBAL\\Schema\\AbstractSchemaManager\:\:\$platform\.$#'
59+
identifier: generics.variance
60+
count: 1
61+
path: src/Schema/AbstractSchemaManager.php
62+
63+
-
64+
message: '#^Loose comparison via "\!\=" is not allowed\.$#'
65+
identifier: notEqual.notAllowed
66+
count: 1
67+
path: src/Schema/ColumnDiff.php
68+
69+
-
70+
message: '#^Method Doctrine\\DBAL\\Schema\\SQLiteSchemaManager\:\:addDetailsToTableForeignKeyColumns\(\) should return list\<array\<string, mixed\>\> but returns array\<int\<0, max\>, array\<string, mixed\>\>\.$#'
71+
identifier: return.type
72+
count: 1
73+
path: src/Schema/SQLiteSchemaManager.php
74+
75+
-
76+
message: '#^Offset string might not exist on array\{application_name\?\: string, charset\?\: string, dbname\?\: string, defaultTableOptions\?\: array\<string, mixed\>, driver\?\: ''ibm_db2''\|''mysqli''\|''oci8''\|''pdo_mysql''\|''pdo_oci''\|''pdo_pgsql''\|''pdo_sqlite''\|''pdo_sqlsrv''\|''pgsql''\|''sqlite3''\|''sqlsrv'', driverClass\?\: class\-string\<Doctrine\\DBAL\\Driver\>, driverOptions\?\: array\<mixed\>, host\?\: string, \.\.\.\}\.$#'
77+
identifier: offsetAccess.notFound
78+
count: 1
79+
path: tests/DriverManagerTest.php
80+
81+
-
82+
message: '#^Call to new Doctrine\\DBAL\\Driver\\PgSQL\\Result\(\) on a separate line has no effect\.$#'
83+
identifier: new.resultUnused
84+
count: 1
85+
path: tests/Functional/Driver/PgSQL/ResultTest.php
86+
87+
-
88+
message: '#^Call to function array_filter\(\) requires parameter \#2 to be passed to avoid loose comparison semantics\.$#'
89+
identifier: arrayFilter.strict
90+
count: 1
91+
path: tests/Functional/Schema/MySQL/JsonCollationTest.php

phpstan.neon.dist

+13-31
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
@@ -67,12 +67,6 @@ parameters:
6767
message: '~^Parameter #1 \$params of method Doctrine\\DBAL\\Driver\:\:connect\(\) expects array~'
6868
path: tests/Driver/PDO/*/DriverTest.php
6969

70-
# DriverManagerTest::testDatabaseUrl() should be refactored as it's too dynamic.
71-
-
72-
message: '~^Offset string does not exist on array{.+}\.$~'
73-
paths:
74-
- tests/DriverManagerTest.php
75-
7670
# There is no way to make this assertion in the code,
7771
# and the API doesn't support parametrization of returned column types.
7872
-
@@ -85,41 +79,29 @@ parameters:
8579

8680
# PHPStan does not understand the array shapes returned by pg_fetch_*() methods.
8781
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapAssociativeRow\(\) expects array<string, string\|null>, array<int\|string, string\|null> given\.$~'
88-
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapNumericRow\(\) expects array<int, string\|null>, array<int\|string, string\|null> given\.$~'
89-
90-
# https://github.com/phpstan/phpstan-src/pull/2224
91-
-
92-
message: '~^Method Doctrine\\DBAL\\Driver\\Mysqli\\Connection\:\:exec\(\) should return int\|numeric\-string but returns int\|string\.$~'
93-
count: 1
94-
path: src/Driver/Mysqli/Connection.php
95-
96-
# https://github.com/phpstan/phpstan/issues/9429
97-
-
98-
message: '~^Strict comparison using === between int<0, max> and false will always evaluate to false.$~'
99-
paths:
100-
- src/Driver/IBMDB2/Connection.php
101-
- src/Driver/IBMDB2/Result.php
102-
103-
# Ignore the possible false return value of db2_num_rows().
104-
- '~^Method Doctrine\\DBAL\\Driver\\IBMDB2\\Connection\:\:exec\(\) should return int but returns int<0, max>\|false\.$~'
105-
- '~^Method Doctrine\\DBAL\\Driver\\IBMDB2\\Result\:\:rowCount\(\) should return int but returns int<0, max>\|false\.$~'
82+
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapNumericRow\(\) expects list<string\|null>, .* given\.$~'
10683

10784
# Required for Psalm compatibility
10885
- '~^Property Doctrine\\DBAL\\Tests\\Types\\BaseDateTypeTestCase\:\:\$currentTimezone \(non-empty-string\) does not accept string\.$~'
10986

110-
# This is a rather complicated closure setup. We understand this, so PHPStan doesn't have to.
87+
# The @throws annotations are part of a contract. Even if the default implementation doen't throw those
88+
# exceptions, the child implementations might do so.
11189
-
112-
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\.$#'
113-
path: src/Portability/Converter.php
90+
identifier: throws.unusedType
91+
path: src/Types/Type.php
92+
93+
# We don't narrow the return type of lastInsertId() yet.
94+
- '/^Method Doctrine\\DBAL\\Driver\\.+\\Connection\:\:lastInsertId\(\) never returns (int|false) so it can be removed from the return type\.$/'
11495

11596
# Type check for legacy implementations of the Result interface
11697
# TODO: remove in 5.0.0
11798
- '~^Call to function method_exists\(\) with Doctrine\\DBAL\\Driver\\Result and ''getColumnName'' will always evaluate to true\.$~'
11899

119-
# PHPStan does not know the new PDO classes yet.
120-
- '~^Class Pdo\\\w+ not found\.$~'
121-
- '~^Call to an undefined static method PDO\:\:connect\(\)\.$~'
100+
# TODO: Review these errors and fix them.
101+
- identifier: phpunit.assertEquals
122102
includes:
103+
- phpstan-baseline.neon
104+
- phar://phpstan.phar/conf/bleedingEdge.neon
123105
- vendor/phpstan/phpstan-phpunit/extension.neon
124106
- vendor/phpstan/phpstan-phpunit/rules.neon
125107
- vendor/phpstan/phpstan-strict-rules/rules.neon

src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function buildSQL(Schema $schema): array
2828
}
2929

3030
/**
31-
* @param list<string> $namespaces
31+
* @param string[] $namespaces
3232
*
3333
* @return list<string>
3434
*/
@@ -46,7 +46,7 @@ private function buildNamespaceStatements(array $namespaces): array
4646
}
4747

4848
/**
49-
* @param list<Table> $tables
49+
* @param Table[] $tables
5050
*
5151
* @return list<string>
5252
*/
@@ -56,7 +56,7 @@ private function buildTableStatements(array $tables): array
5656
}
5757

5858
/**
59-
* @param list<Sequence> $sequences
59+
* @param Sequence[] $sequences
6060
*
6161
* @return list<string>
6262
*/

0 commit comments

Comments
 (0)