Skip to content

Commit 620480e

Browse files
committed
Upgrade examples
1 parent 66c4eea commit 620480e

File tree

4 files changed

+48
-31
lines changed

4 files changed

+48
-31
lines changed

example/.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
install:
22
- |
3-
if [ "$(phpenv version-name)" == 7.3 ]; then sed -e 's#^function is_countable(#// &#' -i vendor/giacocorsiglia/wordpress-stubs/wordpress-stubs.php; fi
3+
if [ "$(phpenv version-name)" == 7.3 ]; then sed -i -e 's#^function is_countable(#// &#' vendor/giacocorsiglia/wordpress-stubs/wordpress-stubs.php; fi
4+
script:
5+
- |
6+
vendor/bin/phpstan analyze --ansi --memory-limit=1G --no-progress

example/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "company/wordpress-project",
33
"description": "WordPress project.",
44
"require": {
5-
"php": ">=7.1"
5+
"php": "^7.1"
66
},
77
"require-dev": {
88
"szepeviktor/phpstan-wordpress": "^0.6.0"

example/phpstan-full.neon

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#$ composer update --optimize-autoloader
2+
#$ vendor/bin/phpstan analyze
3+
4+
includes:
5+
# @see https://github.com/phpstan/phpstan-src/blob/master/conf/bleedingEdge.neon
6+
- phar://phpstan.phar/conf/bleedingEdge.neon
7+
# Include this extension
8+
- vendor/szepeviktor/phpstan-wordpress/extension.neon
9+
parameters:
10+
level: max
11+
inferPrivatePropertyTypeFromConstructor: true
12+
# bootstrapFiles:
13+
# # Missing constants, function and class stubs
14+
# - %currentWorkingDirectory%/tests/phpstan/bootstrap.php
15+
# scanFiles:
16+
# # Plugin stubs
17+
# - %currentWorkingDirectory%/tests/phpstan/PLUGIN-stubs.php
18+
# # Procedural code
19+
# - %currentWorkingDirectory%/myplugin-functions.php
20+
# autoload_directories:
21+
# - %currentWorkingDirectory%/inc/
22+
paths:
23+
- %currentWorkingDirectory%/inc/
24+
# excludes_analyse:
25+
# - %currentWorkingDirectory%/inc/views/
26+
ignoreErrors:
27+
# Uses func_get_args()
28+
- '#^Function apply_filters(_ref_array)? invoked with [34567] parameters, 2 required\.$#'
29+
# Fixed in WordPress 5.3
30+
#- '#^Function do_action(_ref_array)? invoked with [3456] parameters, 1-2 required\.$#'
31+
#- '#^Function current_user_can invoked with 2 parameters, 1 required\.$#'
32+
#- '#^Function add_query_arg invoked with [123] parameters?, 0 required\.$#'
33+
#- '#^Function wp_sprintf invoked with [23456] parameters, 1 required\.$#'
34+
#- '#^Function add_post_type_support invoked with [345] parameters, 2 required\.$#'
35+
#- '#^Function ((get|add)_theme_support|current_theme_supports) invoked with [2345] parameters, 1 required\.$#'
36+
# https://core.trac.wordpress.org/ticket/43304
37+
- '/^Parameter #2 \$deprecated of function load_plugin_textdomain expects string, false given\.$/'
38+
# WP-CLI accepts a class as callable
39+
- '/^Parameter #2 \$callable of static method WP_CLI::add_command\(\) expects callable\(\): mixed, \S+ given\.$/'
40+
# Please consider commenting ignores: issue URL or reason for ignoring

example/phpstan.neon.dist

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
1-
#$ composer update --optimize-autoloader
21
#$ vendor/bin/phpstan analyze
32

43
includes:
5-
# @see https://github.com/phpstan/phpstan-src/blob/master/conf/bleedingEdge.neon
6-
- phar://phpstan.phar/conf/bleedingEdge.neon
7-
# Include this extension
84
- vendor/szepeviktor/phpstan-wordpress/extension.neon
95
parameters:
106
level: max
117
inferPrivatePropertyTypeFromConstructor: true
12-
# bootstrapFiles:
13-
# # Missing constants, function and class stubs
14-
# - %currentWorkingDirectory%/tests/phpstan/bootstrap.php
15-
# scanFiles:
16-
# # Plugin stubs
17-
# - %currentWorkingDirectory%/tests/phpstan/PLUGIN-stubs.php
18-
# # Procedural code
19-
# - %currentWorkingDirectory%/myplugin-functions.php
20-
# autoload_directories:
21-
# - %currentWorkingDirectory%/inc/
228
paths:
23-
- %currentWorkingDirectory%/inc/
24-
# excludes_analyse:
25-
# - %currentWorkingDirectory%/inc/views/
9+
- inc/
2610
ignoreErrors:
2711
# Uses func_get_args()
2812
- '#^Function apply_filters(_ref_array)? invoked with [34567] parameters, 2 required\.$#'
29-
# Fixed in WordPress 5.3
30-
#- '#^Function do_action(_ref_array)? invoked with [3456] parameters, 1-2 required\.$#'
31-
#- '#^Function current_user_can invoked with 2 parameters, 1 required\.$#'
32-
#- '#^Function add_query_arg invoked with [123] parameters?, 0 required\.$#'
33-
#- '#^Function wp_sprintf invoked with [23456] parameters, 1 required\.$#'
34-
#- '#^Function add_post_type_support invoked with [345] parameters, 2 required\.$#'
35-
#- '#^Function ((get|add)_theme_support|current_theme_supports) invoked with [2345] parameters, 1 required\.$#'
36-
# https://core.trac.wordpress.org/ticket/43304
37-
- '/^Parameter #2 \$deprecated of function load_plugin_textdomain expects string, false given\.$/'
38-
# WP-CLI accepts a class as callable
39-
- '/^Parameter #2 \$callable of static method WP_CLI::add_command\(\) expects callable\(\): mixed, \S+ given\.$/'
40-
# Please consider commenting ignores: issue URL or reason for ignoring
13+
14+
# See full example in phpstan-full.neon

0 commit comments

Comments
 (0)