Repository navigation
Expand file tree
/
Copy pathphpstan.neon.dist
More file actions
82 lines (80 loc) · 3.71 KB
/
Copy pathphpstan.neon.dist
File metadata and controls
82 lines (80 loc) · 3.71 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
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
services:
# Core documents globals with `@global Type $name` on the function docblock, and
# core's own PHPStan setup reads those tags through this visitor. It is core's
# tests/phpstan/GlobalDocBlockVisitor.php, copied unchanged, so that src/ is
# analyzed here the way it will be in wordpress-develop.
-
class: WordPress\PHPStan\GlobalDocBlockVisitor
tags:
- phpstan.parser.richParserNodeVisitor
parameters:
level: 10
phpVersion: 70400
paths:
- src
- plugin
- cli
- secrets-api.php
scanDirectories:
- src
scanFiles:
- vendor/php-stubs/wp-cli-stubs/wp-cli-stubs.php
- vendor/php-stubs/wp-cli-stubs/wp-cli-commands-stubs.php
- tests/phpstan/compat-stubs.php
- tests/phpstan/beta-site-health-stubs.php
stubFiles:
- tests/phpstan/site-health-7-2-stubs.php
bootstrapFiles:
- tests/phpstan-bootstrap.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
# Interpolating a `$wpdb` table name into the query handed to prepare() is the
# core idiom, and core's own signature for prepare() takes a plain string. The
# `literal-string` here comes from the WordPress stubs, which are stricter than
# the method they describe; core's PHPStan run does not report these lines.
-
message: '#^Parameter \#1 \$query of method wpdb::prepare\(\) expects literal-string, non-falsy-string given\.$#'
paths:
- src/wp-includes/secrets/class-wp-secrets-option-store.php
- src/wp-includes/secrets/class-wp-secrets-key-manager.php
- plugin/class-secrets-api-legacy-reader.php
# r64674's no-op check reads $existing['current'] behind $is_unchanged, which is
# only true when $has_current is. PHPStan narrows $existing through $has_current
# but not through $is_unchanged. src/ stays as core committed it, so the one
# line is ignored here rather than rewritten.
-
message: '#^Cannot access offset ''needs_rotation'' on mixed\.$#'
identifier: offsetAccess.nonOffsetAccessible
path: src/wp-includes/secrets/class-wp-secrets-libsodium-provider.php
count: 1
# r65373 writes the root key row with $wpdb directly. The stubs type
# $wpdb->sitemeta as string|null, because it is set only on multisite, and the
# two calls that use it run only on multisite. wpdb::prepare() returns null only
# for a malformed query, and core passes its result straight to query(), as
# this does. src/ stays as core committed it.
-
message: '#^Parameter \#1 \$(table|query) of method wpdb::(delete|insert|query)\(\) expects string, string\|null given\.$#'
identifier: argument.type
path: src/wp-includes/secrets/class-wp-secrets-key-manager.php
count: 3
# r65385's get_auth_constant_values() checks is_string( constant( $name ) ) and
# then calls constant() again, so PHPStan can't narrow the value it appends.
# The value is a string at runtime. src/ stays as core committed it; core's
# own PHPStan level doesn't report this.
-
message: '#^Method WP_Secrets_Config_Key_Provider::get_auth_constant_values\(\) should return array<string> but returns list\.$#'
identifier: return.type
path: src/wp-includes/secrets/class-wp-secrets-config-key-provider.php
count: 1
# r65394's WP_Debug_Data::get_wp_secrets_api() documents its return as
# array<string, string|array>, as the other sections of WP_Debug_Data do, and
# level 10 wants the inner array typed too. The method is a copy of core's,
# kept identical so it can be compared with core on trunk; core's own PHPStan
# level doesn't report this.
-
message: '#^Method Secrets_API_Site_Health::get_wp_secrets_api\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
path: plugin/class-secrets-api-site-health.php
count: 1