Repository navigation
Expand file tree
/
Copy pathphpstan.neon
More file actions
69 lines (61 loc) · 3.22 KB
/
Copy pathphpstan.neon
File metadata and controls
69 lines (61 loc) · 3.22 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
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
level: 6
# The whole range the plugin claims to support, not the one that happens
# to be installed.
#
# `composer.json` requires >=8.1 and CI runs the test matrix on 8.1 through
# 8.4, but PHPStan analyses against the running interpreter unless told
# otherwise — so three `true|WP_Error` return types, which are PHP 8.2
# syntax, passed every local check and then fatalled the 8.1 leg at parse
# time, before a single test ran. With a range, PHPStan reports anything
# that is not valid across all of it.
phpVersion:
min: 80100
max: 80400
# In WordPress a PHPDoc type is a claim, not a guarantee, and the code
# that trusts one is the code that fatals on a site with a plugin that
# returns something else. `apply_filters()` is typed from the `@param` of
# its own docblock — ours included — so PHPStan reads the guards in
# Catalog::all() (a third-party filter handing back a string instead of a
# list of Source objects) and in UploadRouter::route() (a filter returning
# '' or false rather than null) as dead code. They are not dead; they are
# the only thing standing between a badly written filter and a white
# screen. Likewise `$wpdb->get_col()` is documented as returning a list
# and `$folders->find()` as returning a row with every column set.
#
# This is also what phpstan-wordpress itself recommends, and for this
# reason. Real type errors — the ones from actual PHP types — are still
# reported; only the ones derived purely from a docblock are not.
treatPhpDocTypesAsCertain: false
paths:
- folderfolio.php
- includes
bootstrapFiles:
- phpstan-bootstrap.php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
# includes/Cli/* is only ever loaded under WP-CLI, so WP_CLI is
# undefined to the analyser without this. Hand-written rather than
# php-stubs/wp-cli-stubs, which caps wordpress-stubs at ^6.0 while
# this plugin pins ^7.1 — Composer cannot satisfy both.
- phpstan/wp-cli-stubs.php
# includes/Blocks/ElementorGalleryWidget.php is only ever loaded by
# Elementor, so Elementor's classes are undefined to the analyser
# without this. Hand-written for the same reason and to the same rule.
- phpstan/elementor-stubs.php
tmpDir: var/phpstan
ignoreErrors:
# `assets/build/` is generated by esbuild and gitignored, so the three
# `.asset.php` dependency manifests do not exist in a checkout that has
# not run `yarn build` — which the `php-tests` CI job never does, since
# it installs no Node. Every one of these `require`s is already guarded
# by `file_exists()` and returns early without it.
#
# This hides nothing that matters: a genuine typo in one of these paths
# would show up as the rail app not mounting, which fails about fifteen
# end-to-end tests in the job that does build assets.
-
identifier: require.fileNotFound
message: '#assets/build/apps/(gallery|import|modal|post-folders|rail)\.asset\.php#'