Skip to content

Commit 6f066d0

Browse files
sejasclaude
andcommitted
Upgrade wp-cli-tests to v5 to fix PHPCS dependency conflict
phpcompatibility/php-compatibility dev-develop moved to squizlabs/php_codesniffer ^4.0.1, which conflicts with wp-coding-standards/wpcs ^3 requiring ^3.x. Upgrading wp-cli-tests to ^5.0 resolves this by aligning all PHPCS-related dependencies. The explicit phpcompatibility/php-compatibility requirement is removed since wp-cli-tests v5 pulls it in transitively as ^10.0. Also adds phpstan/extension-installer to allow-plugins and configures PHPStan with a baseline for existing errors, as required by wp-cli-tests v5 which added PHPStan support (matching wp-cli/wp-cli upstream config). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fcc0898 commit 6f066d0

3 files changed

Lines changed: 264 additions & 3 deletions

File tree

‎composer.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@
2828
"wp-cli/wp-cli": "^2.5"
2929
},
3030
"require-dev": {
31-
"wp-cli/wp-cli-tests": "^4.3.2",
32-
"phpcompatibility/php-compatibility": "dev-develop"
31+
"wp-cli/wp-cli-tests": "^5.0"
3332
},
33+
"minimum-stability": "dev",
34+
"prefer-stable": true,
3435
"scripts": {
3536
"behat": "run-behat-tests",
3637
"behat-rerun": "rerun-behat-tests",
3738
"lint": "run-linter-tests",
3839
"phpcs": "run-phpcs-tests",
40+
"phpstan": "run-phpstan-tests",
3941
"phpcbf": "run-phpcbf-cleanup",
4042
"phpunit": "run-php-unit-tests",
4143
"prepare-tests": "install-package-tests",
@@ -48,7 +50,8 @@
4850
},
4951
"config": {
5052
"allow-plugins": {
51-
"dealerdirect/phpcodesniffer-composer-installer": true
53+
"dealerdirect/phpcodesniffer-composer-installer": true,
54+
"phpstan/extension-installer": true
5255
}
5356
}
5457
}

‎phpstan-baseline.neon‎

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Binary operation "\." between mixed and "\\n"\|"\\r\\n" results in an error\.$#'
5+
identifier: binaryOp.invalid
6+
count: 2
7+
path: src/Export.php
8+
9+
-
10+
message: '#^Call to method get_connection\(\) on an unknown class WP_SQLite_Driver\.$#'
11+
identifier: class.notFound
12+
count: 2
13+
path: src/Export.php
14+
15+
-
16+
message: '#^Call to method get_pdo\(\) on an unknown class WP_SQLite_Translator\.$#'
17+
identifier: class.notFound
18+
count: 1
19+
path: src/Export.php
20+
21+
-
22+
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Driver\.$#'
23+
identifier: class.notFound
24+
count: 2
25+
path: src/Export.php
26+
27+
-
28+
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Translator\.$#'
29+
identifier: class.notFound
30+
count: 2
31+
path: src/Export.php
32+
33+
-
34+
message: '#^Class WP_SQLite_Driver not found\.$#'
35+
identifier: class.notFound
36+
count: 1
37+
path: src/Export.php
38+
39+
-
40+
message: '#^Class WP_SQLite_Translator not found\.$#'
41+
identifier: class.notFound
42+
count: 1
43+
path: src/Export.php
44+
45+
-
46+
message: '#^Parameter \#1 \$handle of method Automattic\\WP_CLI\\SQLite\\Export\:\:write_sql_statements\(\) expects resource, resource\|false given\.$#'
47+
identifier: argument.type
48+
count: 1
49+
path: src/Export.php
50+
51+
-
52+
message: '#^Parameter \#2 \$haystack of function in_array expects array, array\<string\>\|false given\.$#'
53+
identifier: argument.type
54+
count: 1
55+
path: src/Export.php
56+
57+
-
58+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$args has no type specified\.$#'
59+
identifier: missingType.property
60+
count: 1
61+
path: src/Export.php
62+
63+
-
64+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$driver has unknown class WP_SQLite_Driver as its type\.$#'
65+
identifier: class.notFound
66+
count: 1
67+
path: src/Export.php
68+
69+
-
70+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$driver has unknown class WP_SQLite_Translator as its type\.$#'
71+
identifier: class.notFound
72+
count: 1
73+
path: src/Export.php
74+
75+
-
76+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Export\:\:\$is_stdout has no type specified\.$#'
77+
identifier: missingType.property
78+
count: 1
79+
path: src/Export.php
80+
81+
-
82+
message: '#^Binary operation "\." between ''Converted ecoding…'' and array\|string\|false results in an error\.$#'
83+
identifier: binaryOp.invalid
84+
count: 1
85+
path: src/Import.php
86+
87+
-
88+
message: '#^Binary operation "\." between ''Could not execute…'' and mixed results in an error\.$#'
89+
identifier: binaryOp.invalid
90+
count: 1
91+
path: src/Import.php
92+
93+
-
94+
message: '#^Call to method query\(\) on an unknown class Automattic\\WP_CLI\\SQLite\\WP_SQLite_Driver\.$#'
95+
identifier: class.notFound
96+
count: 8
97+
path: src/Import.php
98+
99+
-
100+
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Translator\.$#'
101+
identifier: class.notFound
102+
count: 8
103+
path: src/Import.php
104+
105+
-
106+
message: '#^Parameter \#1 \$stream of function fclose expects resource, resource\|false given\.$#'
107+
identifier: argument.type
108+
count: 1
109+
path: src/Import.php
110+
111+
-
112+
message: '#^Parameter \#1 \$stream of function fgets expects resource, resource\|false given\.$#'
113+
identifier: argument.type
114+
count: 1
115+
path: src/Import.php
116+
117+
-
118+
message: '#^Parameter \#1 \$string of function mb_convert_encoding expects array\|string, mixed given\.$#'
119+
identifier: argument.type
120+
count: 1
121+
path: src/Import.php
122+
123+
-
124+
message: '#^Parameter \#1 \$string of function mb_detect_encoding expects string, mixed given\.$#'
125+
identifier: argument.type
126+
count: 1
127+
path: src/Import.php
128+
129+
-
130+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$args has no type specified\.$#'
131+
identifier: missingType.property
132+
count: 1
133+
path: src/Import.php
134+
135+
-
136+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$driver \(Automattic\\WP_CLI\\SQLite\\WP_SQLite_Driver\|WP_SQLite_Translator\) does not accept WP_SQLite_Driver\|WP_SQLite_Translator\.$#'
137+
identifier: assign.propertyType
138+
count: 1
139+
path: src/Import.php
140+
141+
-
142+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$driver has unknown class Automattic\\WP_CLI\\SQLite\\WP_SQLite_Driver as its type\.$#'
143+
identifier: class.notFound
144+
count: 1
145+
path: src/Import.php
146+
147+
-
148+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Import\:\:\$driver has unknown class WP_SQLite_Translator as its type\.$#'
149+
identifier: class.notFound
150+
count: 1
151+
path: src/Import.php
152+
153+
-
154+
message: '#^Parameter \#1 \$version1 of function version_compare expects string, string\|false given\.$#'
155+
identifier: argument.type
156+
count: 1
157+
path: src/SQLiteDatabaseIntegrationLoader.php
158+
159+
-
160+
message: '#^Parameter \#2 \$subject of function preg_match expects string, string\|false given\.$#'
161+
identifier: argument.type
162+
count: 2
163+
path: src/SQLiteDatabaseIntegrationLoader.php
164+
165+
-
166+
message: '#^Constant FQDB not found\.$#'
167+
identifier: constant.notFound
168+
count: 1
169+
path: src/SQLiteDriverFactory.php
170+
171+
-
172+
message: '#^Instantiated class WP_SQLite_Connection not found\.$#'
173+
identifier: class.notFound
174+
count: 1
175+
path: src/SQLiteDriverFactory.php
176+
177+
-
178+
message: '#^Instantiated class WP_SQLite_Driver not found\.$#'
179+
identifier: class.notFound
180+
count: 1
181+
path: src/SQLiteDriverFactory.php
182+
183+
-
184+
message: '#^Instantiated class WP_SQLite_Translator not found\.$#'
185+
identifier: class.notFound
186+
count: 1
187+
path: src/SQLiteDriverFactory.php
188+
189+
-
190+
message: '#^Method Automattic\\WP_CLI\\SQLite\\SQLiteDriverFactory\:\:create_driver\(\) has invalid return type WP_SQLite_Driver\.$#'
191+
identifier: class.notFound
192+
count: 1
193+
path: src/SQLiteDriverFactory.php
194+
195+
-
196+
message: '#^Method Automattic\\WP_CLI\\SQLite\\SQLiteDriverFactory\:\:create_driver\(\) has invalid return type WP_SQLite_Translator\.$#'
197+
identifier: class.notFound
198+
count: 1
199+
path: src/SQLiteDriverFactory.php
200+
201+
-
202+
message: '#^Parameter \#1 \$string of function md5 expects string, int\<0, max\> given\.$#'
203+
identifier: argument.type
204+
count: 1
205+
path: src/SQLite_Command.php
206+
207+
-
208+
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Driver\.$#'
209+
identifier: class.notFound
210+
count: 1
211+
path: src/Tables.php
212+
213+
-
214+
message: '#^Call to method query\(\) on an unknown class WP_SQLite_Translator\.$#'
215+
identifier: class.notFound
216+
count: 1
217+
path: src/Tables.php
218+
219+
-
220+
message: '#^Class WP_SQLite_Translator not found\.$#'
221+
identifier: class.notFound
222+
count: 1
223+
path: src/Tables.php
224+
225+
-
226+
message: '#^Parameter \#1 \$message of static method WP_CLI\:\:line\(\) expects string, string\|false given\.$#'
227+
identifier: argument.type
228+
count: 1
229+
path: src/Tables.php
230+
231+
-
232+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Tables\:\:\$driver has unknown class WP_SQLite_Driver as its type\.$#'
233+
identifier: class.notFound
234+
count: 1
235+
path: src/Tables.php
236+
237+
-
238+
message: '#^Property Automattic\\WP_CLI\\SQLite\\Tables\:\:\$driver has unknown class WP_SQLite_Translator as its type\.$#'
239+
identifier: class.notFound
240+
count: 1
241+
path: src/Tables.php

‎phpstan.neon.dist‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 9
6+
paths:
7+
- src
8+
- command.php
9+
scanDirectories:
10+
- vendor/wp-cli/wp-cli/php
11+
scanFiles:
12+
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
13+
treatPhpDocTypesAsCertain: false
14+
ignoreErrors:
15+
- identifier: missingType.iterableValue
16+
- identifier: missingType.parameter
17+
- identifier: missingType.return

0 commit comments

Comments
 (0)