Skip to content

Commit fd2e442

Browse files
committed
PHPStan level 9
1 parent 921ec99 commit fd2e442

File tree

5 files changed

+128
-106
lines changed

5 files changed

+128
-106
lines changed

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
"wp-cli/db-command": "^1.3 || ^2",
2121
"wp-cli/entity-command": "^1.3 || ^2",
2222
"wp-cli/extension-command": "^1.2 || ^2",
23-
"wp-cli/wp-cli-tests": "^4"
23+
"wp-cli/wp-cli-tests": "dev-main"
2424
},
2525
"config": {
2626
"process-timeout": 7200,
2727
"sort-packages": true,
2828
"allow-plugins": {
2929
"dealerdirect/phpcodesniffer-composer-installer": true,
30-
"johnpbloch/wordpress-core-installer": true
30+
"johnpbloch/wordpress-core-installer": true,
31+
"phpstan/extension-installer": true
3132
},
3233
"lock": false
3334
},
@@ -64,12 +65,14 @@
6465
"behat-rerun": "rerun-behat-tests",
6566
"lint": "run-linter-tests",
6667
"phpcs": "run-phpcs-tests",
68+
"phpstan": "run-phpstan-tests",
6769
"phpcbf": "run-phpcbf-cleanup",
6870
"phpunit": "run-php-unit-tests",
6971
"prepare-tests": "install-package-tests",
7072
"test": [
7173
"@lint",
7274
"@phpcs",
75+
"@phstan",
7376
"@phpunit",
7477
"@behat"
7578
]

features/core-update.feature

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ Feature: Update WordPress core
66
Given a WP install
77
And I try `wp theme install twentytwenty --activate`
88

9-
When I run `wp core download --version=3.9 --force`
9+
When I run `wp core download --version=4.9 --force`
1010
Then STDOUT should not be empty
1111

1212
When I run `wp eval 'echo $GLOBALS["wp_version"];'`
1313
Then STDOUT should be:
1414
"""
15-
3.9
15+
4.9
1616
"""
1717

18-
When I run `wget http://wordpress.org/wordpress-4.0.zip --quiet`
19-
And I run `wp core update wordpress-4.0.zip`
18+
When I run `wget http://wordpress.org/wordpress-4.9.zip --quiet`
19+
And I run `wp core update wordpress-4.9.zip`
2020
Then STDOUT should be:
2121
"""
2222
Starting update...
@@ -29,49 +29,16 @@ Feature: Update WordPress core
2929
When I run `wp eval 'echo $GLOBALS["wp_version"];'`
3030
Then STDOUT should be:
3131
"""
32-
4.0
33-
"""
34-
35-
# PHP 7.1 needs WP 3.9 (due to wp_check_php_mysql_versions(), see trac changeset [27257]),
36-
# and travis doesn't install mysql extension by default for PHP 7.0.
37-
@less-than-php-7
38-
Scenario: Update to the latest minor release
39-
Given a WP install
40-
And I try `wp theme install twentytwenty --activate`
41-
42-
When I run `wp core download --version=4.1 --force`
43-
Then STDOUT should not be empty
44-
45-
# WP core throws notice for PHP 8+.
46-
When I try `wp core update --minor`
47-
Then STDOUT should contain:
48-
"""
49-
Updating to version {WP_VERSION-4.1-latest}
50-
"""
51-
And STDOUT should contain:
52-
"""
53-
Success: WordPress updated successfully.
54-
"""
55-
56-
When I run `wp core update --minor`
57-
Then STDOUT should be:
58-
"""
59-
Success: WordPress is at the latest minor release.
60-
"""
61-
62-
When I run `wp core version`
63-
Then STDOUT should be:
64-
"""
65-
{WP_VERSION-4.1-latest}
32+
4.9
6633
"""
6734

6835
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.0+
6936
@require-mysql
70-
Scenario: Update to the latest minor release (PHP 7.1 compatible with WP >= 3.9)
37+
Scenario: Update to the latest minor release (PHP 7.2 compatible with WP >= 4.9)
7138
Given a WP install
7239
And I try `wp theme install twentytwenty --activate`
7340

74-
When I run `wp core download --version=4.1.30 --force`
41+
When I run `wp core download --version=4.9.25 --force`
7542
Then STDOUT should contain:
7643
"""
7744
Success: WordPress downloaded.
@@ -81,7 +48,7 @@ Feature: Update WordPress core
8148
When I try `wp core update --minor`
8249
Then STDOUT should contain:
8350
"""
84-
Updating to version {WP_VERSION-4.1-latest}
51+
Updating to version {WP_VERSION-4.9-latest}
8552
"""
8653
And STDOUT should contain:
8754
"""
@@ -108,7 +75,7 @@ Feature: Update WordPress core
10875
And I try `wp theme install twentytwenty --activate`
10976
And an empty cache
11077

111-
When I run `wp core update --version=3.9.1 --force`
78+
When I run `wp core update --version=4.9.25 --force`
11279
Then STDOUT should not contain:
11380
"""
11481
Using cached file
@@ -118,13 +85,13 @@ Feature: Update WordPress core
11885
Downloading
11986
"""
12087

121-
When I run `wp core update --version=4.0 --force`
88+
When I run `wp core update --version=5.0 --force`
12289
Then STDOUT should not be empty
12390

124-
When I run `wp core update --version=3.9.1 --force`
91+
When I run `wp core update --version=4.9.25 --force`
12592
Then STDOUT should contain:
12693
"""
127-
Using cached file '{SUITE_CACHE_DIR}/core/wordpress-3.9.1-en_US.zip'...
94+
Using cached file '{SUITE_CACHE_DIR}/core/wordpress-4.9.25-en_US.zip'...
12895
"""
12996
And STDOUT should not contain:
13097
"""

phpstan.neon.dist

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

0 commit comments

Comments
 (0)