Skip to content

Commit 5821f83

Browse files
authored
Upgrade wp-cli-tests to v5 (#21)
1 parent fcc0898 commit 5821f83

3 files changed

Lines changed: 54 additions & 3 deletions

File tree

‎composer.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@
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",
32+
"phpcompatibility/php-compatibility": "^10.0@alpha",
33+
"wp-coding-standards/wpcs": "@dev"
3334
},
3435
"scripts": {
3536
"behat": "run-behat-tests",
3637
"behat-rerun": "rerun-behat-tests",
3738
"lint": "run-linter-tests",
3839
"phpcs": "run-phpcs-tests",
3940
"phpcbf": "run-phpcbf-cleanup",
41+
"phpstan": "run-phpstan-tests",
4042
"phpunit": "run-php-unit-tests",
4143
"prepare-tests": "install-package-tests",
4244
"test": [
@@ -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.neon.dist‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
parameters:
2+
level: 0
3+
paths:
4+
- src
5+
- command.php
6+
scanDirectories:
7+
- vendor/wp-cli/wp-cli/php
8+
scanFiles:
9+
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
10+
- phpstan/stubs.php
11+
treatPhpDocTypesAsCertain: false
12+
dynamicConstantNames:
13+
- WP_DEBUG
14+
- WP_DEBUG_LOG
15+
- WP_DEBUG_DISPLAY

‎phpstan/stubs.php‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Stubs for the WordPress SQLite integration plugin classes.
4+
*
5+
* These classes are loaded at runtime by WordPress, not via Composer.
6+
* The stubs allow PHPStan to analyze code that references them.
7+
*/
8+
9+
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound
10+
// phpcs:disable Generic.Files.OneObjectStructurePerFile.MultipleFound
11+
// phpcs:disable PHPCompatibility.FunctionDeclarations.NewReturnTypeDeclarations
12+
// phpcs:disable PHPCompatibility.FunctionDeclarations.NewParamTypeDeclarations
13+
14+
class WP_SQLite_Connection {
15+
/**
16+
* @param array{path: string} $config
17+
*/
18+
public function __construct( array $config ) {}
19+
public function quote_identifier( string $identifier ): string {}
20+
public function get_pdo(): PDO {}
21+
}
22+
23+
class WP_SQLite_Driver {
24+
public function __construct( WP_SQLite_Connection $connection, string $db_name ) {}
25+
public function query( string $sql ) {}
26+
public function get_connection(): WP_SQLite_Connection {}
27+
}
28+
29+
class WP_SQLite_Translator {
30+
public function __construct() {}
31+
public function query( string $sql ) {}
32+
public function get_pdo(): PDO {}
33+
}

0 commit comments

Comments
 (0)