Repository navigation
Expand file tree
/
Copy pathphpstan.neon
More file actions
61 lines (60 loc) · 3.84 KB
/
Copy pathphpstan.neon
File metadata and controls
61 lines (60 loc) · 3.84 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
# PHPStan configuration for codexpertio/plugin-tracker-sdk.
#
# Level 5 to start (composer.json only requires php-stubs/wordpress-stubs and phpstan/phpstan
# as dev dependencies; nothing here assumes a richer analysis baseline yet). Only `src/` is
# analysed -- tests/ exercise WP behaviour through Brain Monkey mocks, which is a PHPUnit
# concern, not a static-analysis one.
#
# phpVersion is pinned to 70200 -- the SDK's distribution floor, from composer.json's
# require.php. This is a distribution decision, not a preference: the SDK ships inside
# third-party WordPress plugins, so its floor becomes theirs. Do not raise this to match
# plugins/plugin-tracker (which targets 7.4) -- that package is not bundled elsewhere and has no
# reason to share this SDK's floor.
#
# Note this NO LONGER equals composer.json's config.platform.php, which is 7.4. That pin governs
# dependency resolution and applies to dev tooling as well, and PHPStan 2.x requires PHP >=7.4 to
# run -- so a 7.2.5 platform pin made the analyser un-upgradable while protecting nothing that
# ships. `phpVersion` here, testVersion 7.2- in phpcs.xml.dist, and bin/check-floor.php are what
# hold the real floor now. See the _platform_note in composer.json.
#
# No `includes:` for any extension.neon here. phpstan/extension-installer is only *allow-listed*
# in composer.json's config.allow-plugins, it is not actually required as a dependency, so
# nothing under vendor/phpstan/ registers itself automatically (confirmed: vendor/phpstan/
# contains only phpstan/phpstan itself). Manually including an extension.neon that
# extension-installer also auto-registers is a hard error ("sniff/extension already loaded"
# style conflict) -- since no such extension is installed, there is nothing to include and
# nothing to conflict.
#
# No baseline. There was one, carrying two findings where add_option()'s $autoload argument was
# passed the legacy string 'no' -- WordPress 6.7 deprecated the 'yes'/'no' form in favour of
# true/false/null, and php-stubs/wordpress-stubs now types the parameter bool|null. Both call
# sites were fixed to pass false, which emptied the baseline, so it was deleted rather than kept
# as an empty file. An empty baseline is worse than none: PHPStan reports unmatched ignoreErrors
# entries as errors, so a stale baseline fails the build for no reason.
parameters:
# A cache directory of this package's OWN, which is not a tidiness preference.
#
# PHPStan defaults tmpDir to sys_get_temp_dir()/phpstan, so every project on the machine shares one
# result cache. This repo has two analysed packages with DIFFERENT settings -- plugins/plugin-tracker
# at phpVersion 70400 with a baseline, packages/php/plugin-tracker-sdk at 70200 without one -- and
# they were clobbering each other's cached results. The symptom is the worst kind: running one after
# the other reports errors that vanish on a re-run, so the gate is nondeterministic and everyone
# learns to re-run until it passes instead of reading the output.
#
# It bit this repo before, too: a deleted git worktree left absolute phar paths in that shared cache,
# and `clear-result-cache` was not enough -- the whole directory had to be removed.
tmpDir: .phpstan-cache
level: 5
phpVersion: 70200
paths:
- src
# The views are plain PHP with no class of their own, but they are shipped code and they
# dereference the variables render() hands them -- so they are analysed like everything else.
- views
# php-stubs/wordpress-stubs ships pure declarations (functions/classes/constants, no bodies,
# no runtime define() calls -- verified: zero `define(` statements in the stub file), so
# `scanFiles` (parse for signatures only) is correct here. `bootstrapFiles` would actually
# execute the file, which is unnecessary for a declarations-only stub and is the wrong tool
# for this job.
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php