-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathphpstan.neon.dist
More file actions
147 lines (132 loc) · 7.17 KB
/
Copy pathphpstan.neon.dist
File metadata and controls
147 lines (132 loc) · 7.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
parameters:
level: 9
paths:
- src
- entity-command.php
excludePaths:
# Polyfill files are copies of WordPress core code with GOTO control flow
# that PHPStan cannot analyze correctly
- src/Compat/WP_Block_Processor.php
- src/Compat/WP_HTML_Span.php
- src/Compat/polyfills.php
scanDirectories:
- vendor/wp-cli/wp-cli/php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: missingType.iterableValue
- identifier: missingType.property
- identifier: missingType.parameter
- identifier: missingType.return
# johnbillion/wp-compat checks every WordPress symbol against the WordPress 4.9
# baseline that wp-cli-tests configures. It only recognizes function_exists() and
# method_exists() guards, so it cannot see the `before_invoke` version checks in
# entity-command.php or the polyfills in src/Compat/, and reports those as errors.
#
# Every entry below matches on the message as well as the identifier, so that a call
# to something introduced later than the version a command is gated on still gets
# reported rather than swallowed by a file-wide ignore.
# `WP_Block_Processor` and its dependencies are polyfilled in src/Compat/ and loaded
# on demand through `BlockProcessorLoader::load()`, so they are available on every
# supported WordPress version, not just 6.9+.
-
identifier: WPCompat.methodNotAvailable
message: '#^WP_Block_Processor::(allocate_and_return_parsed_attributes|extract_full_block_and_advance|get_block_type|get_delimiter_type|get_depth|get_span|next_block)\(\) is only available since WordPress version 6\.9\.0\.$#'
path: src/Block_Processor_Helper.php
# `wp font collection|face|family` aborts on WordPress < 6.5 via `before_invoke`.
-
identifier: WPCompat.methodNotAvailable
message: '#^(WP_Font_Collection::get_data|WP_Font_Library::(get_font_collection|get_font_collections|get_instance))\(\) is only available since WordPress version 6\.5\.0\.$#'
paths:
- src/Font_Collection_Command.php
- src/Font_Family_Command.php
# `wp icon` and `wp icon collection` abort on WordPress < 7.1 via `before_invoke`.
-
identifier: WPCompat.methodNotAvailable
message: '#^WP_Icon_Collections_Registry::get_instance\(\) is only available since WordPress version 7\.1\.0\.$#'
paths:
- src/Icon_Collection_Command.php
- src/Icon_Command.php
-
identifier: WPCompat.methodNotAvailable
message: '#^WP_Icons_Registry::get_instance\(\) is only available since WordPress version 7\.0\.0\.$#'
paths:
- src/Icon_Collection_Command.php
- src/Icon_Command.php
-
identifier: WPCompat.functionNotAvailable
message: '#^wp_get_icon\(\) is only available since WordPress version 7\.1\.0\.$#'
path: src/Icon_Command.php
# `wp user application-password` aborts on WordPress < 5.6 via `before_invoke`.
-
identifier: WPCompat.methodNotAvailable
message: '#^WP_Application_Passwords::(create_new_application_password|delete_all_application_passwords|delete_application_password|get_user_application_password|get_user_application_passwords|record_application_password_usage|update_application_password)\(\) is only available since WordPress version 5\.6\.0\.$#'
path: src/User_Application_Password_Command.php
# The single WordPress 5.7 method is additionally behind a `wp_version_compare()`
# check in `application_name_exists_for_user()`, which reimplements it for 5.6.
-
identifier: WPCompat.methodNotAvailable
message: '#^WP_Application_Passwords::application_name_exists_for_user\(\) is only available since WordPress version 5\.7\.0\.$#'
path: src/User_Application_Password_Command.php
# `wp user privacy-request` aborts on WordPress < 4.9.6 via `before_invoke`.
-
identifier: WPCompat.functionNotAvailable
message: '#^(_wp_privacy_completed_request|wp_create_user_request|wp_get_user_request_data|wp_privacy_exports_dir|wp_privacy_generate_personal_data_export_file|wp_send_user_request)\(\) is only available since WordPress version 4\.9\.6\.$#'
path: src/User_Privacy_Request_Command.php
# `wp site meta` aborts via `before_invoke` unless `is_site_meta_supported()`
# exists, which is the WordPress 5.1 function that introduced site meta support
# along with the `*_site_meta()` functions used here.
-
identifier: WPCompat.functionNotAvailable
message: '#^(add_site_meta|delete_site_meta|get_site_meta|update_site_meta)\(\) is only available since WordPress version 5\.1\.0\.$#'
path: src/Site_Meta_Command.php
# `wp post block` aborts on WordPress < 5.0 via `before_invoke`. `serialize_blocks()`
# is WordPress 5.3.1+ and is guarded separately in the mutating subcommands, so it
# must keep being reported if that guard ever goes away.
-
identifier: WPCompat.functionNotAvailable
message: '#^(has_blocks|parse_blocks|render_block)\(\) is only available since WordPress version 5\.0\.0\.$#'
path: src/Post_Block_Command.php
# Only the uppercase `'ID'` alias for the `$field` parameter of `get_term_by()`
# is WordPress 5.5+. These call sites pass `'id'`, `'term_id'` or `'slug'`, all
# supported since WordPress 2.3.
-
identifier: WPCompat.parameterNotAvailable.gettermby.field
paths:
- src/Menu_Item_Command.php
- src/Term_Command.php
- src/WP_CLI/CommandWithTerms.php
# WordPress 6.0 only formalized the already documented `...$args` parameter of
# `apply_filters()` by adding it to the function signature. Additional arguments
# were collected through `func_get_args()` before that.
-
identifier: WPCompat.parameterNotAvailable.applyfilters.args
path: src/Post_Block_Command.php
# Same for `wpdb::prepare()`, where WordPress 5.3 formalized the already
# documented `...$args` parameter. Passing a single array of values is even
# handled explicitly by `wpdb::prepare()` itself.
-
identifier: WPCompat.parameterNotAvailable.wpdbprepare.args
path: src/Site_Command.php
# The `$force_cache` parameter of `wp_load_alloptions()` is WordPress 5.3.1+, but
# older versions simply ignore the extra argument. The cache refresh in
# `wp option set-autoload` degrades to a no-op there instead of failing.
-
identifier: WPCompat.parameterNotAvailable.wploadalloptions.forcecache
path: src/Option_Command.php
# The Icons API introduced in WordPress 7.0 and 7.1 is not covered by the WordPress
# stubs yet, so PHPStan does not know these symbols at all. `reportUnmatched` keeps
# the entries from turning into errors themselves once the stubs catch up.
-
identifier: class.notFound
message: '#^Call to static method get_instance\(\) on an unknown class WP_(Icons_Registry|Icon_Collections_Registry)\.$#'
reportUnmatched: false
paths:
- src/Icon_Collection_Command.php
- src/Icon_Command.php
-
identifier: function.notFound
message: '#^Function wp_get_icon not found\.$#'
reportUnmatched: false
path: src/Icon_Command.php