Skip to content

Commit 8f0c37f

Browse files
committedJan 6, 2025·
Merge branch '3.9.x' into 4.2.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 e6588cc + 36aa8b4 commit 8f0c37f

7 files changed

+120
-11
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"

‎.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
@@ -40,9 +40,9 @@
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.2",
45-
"phpstan/phpstan-strict-rules": "^1.6",
43+
"phpstan/phpstan": "2.1.1",
44+
"phpstan/phpstan-phpunit": "2.0.3",
45+
"phpstan/phpstan-strict-rules": "^2",
4646
"phpunit/phpunit": "10.5.39",
4747
"psalm/plugin-phpunit": "0.19.0",
4848
"slevomat/coding-standard": "8.13.1",

‎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

+16-2
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
@@ -85,7 +85,7 @@ parameters:
8585

8686
# PHPStan does not understand the array shapes returned by pg_fetch_*() methods.
8787
- '~^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\.$~'
88+
- '~^Parameter #1 \$row of method Doctrine\\DBAL\\Driver\\PgSQL\\Result\:\:mapNumericRow\(\) expects list<string\|null>, .* given\.$~'
8989

9090
# https://github.com/phpstan/phpstan-src/pull/2224
9191
-
@@ -112,14 +112,28 @@ parameters:
112112
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\.$#'
113113
path: src/Portability/Converter.php
114114

115+
# The @throws annotations are part of a contract. Even if the default implementation doen't throw those
116+
# exceptions, the child implementations might do so.
117+
-
118+
identifier: throws.unusedType
119+
path: src/Types/Type.php
120+
121+
# We don't narrow the return type of lastInsertId() yet.
122+
- '/^Method Doctrine\\DBAL\\Driver\\.+\\Connection\:\:lastInsertId\(\) never returns (int|false) so it can be removed from the return type\.$/'
123+
115124
# Type check for legacy implementations of the Result interface
116125
# TODO: remove in 5.0.0
117126
- '~^Call to function method_exists\(\) with Doctrine\\DBAL\\Driver\\Result and ''getColumnName'' will always evaluate to true\.$~'
118127

119128
# PHPStan does not know the new PDO classes yet.
120129
- '~^Class Pdo\\\w+ not found\.$~'
121130
- '~^Call to an undefined static method PDO\:\:connect\(\)\.$~'
131+
132+
# TODO: Review these errors and fix them.
133+
- identifier: phpunit.assertEquals
122134
includes:
135+
- phpstan-baseline.neon
136+
- phar://phpstan.phar/conf/bleedingEdge.neon
123137
- vendor/phpstan/phpstan-phpunit/extension.neon
124138
- vendor/phpstan/phpstan-phpunit/rules.neon
125139
- 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)
Please sign in to comment.