Repository navigation
Expand file tree
/
Copy pathphpstan-deadcode.neon
More file actions
40 lines (40 loc) · 2.12 KB
/
Copy pathphpstan-deadcode.neon
File metadata and controls
40 lines (40 loc) · 2.12 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
# PHPStan gate with dead-code detection enabled.
#
# shipmonk/dead-code-detector is excluded from the auto-loaded extension set
# (see composer.json extra.phpstan/extension-installer.ignore), so use this
# explicit config whenever running the project PHPStan gate:
#
# npm run lint:phpstan
#
# Caveat: this is an APPLICATION on the newspack-nodes substrate. tests/ are
# excluded (inherited from the main config) so test-only methods surface, and
# the substrate classes this builds on live in a separate repo the analysis
# cannot see — so most findings are WP/CLI entrypoints, hook callbacks, JS↔PHP
# wire constants, or deliberate test seams, NOT genuinely dead. Verify each
# against ALL call paths (dynamic dispatch, hooks, reflection, the sibling
# substrate, and JS) before deleting anything.
includes:
- phpstan.neon.dist
- vendor/shipmonk/dead-code-detector/rules.neon
parameters:
# Keep ShipMonk's collected-data cache project-local. The default global
# PHPStan tmp dir can race when multiple plugin gates run concurrently.
tmpDir: .phpstan/cache/deadcode
# Real-load the substrate's Newspack_Nodes\* base classes during analysis —
# the dead-code-detector's reflection providers invoke the actual autoloader
# (scanDirectories alone isn't enough). Merged with phpstan.neon.dist's
# bootstrapFiles. See the bootstrap for the full rationale.
bootstrapFiles:
- .phpstan/load-substrate.php
ignoreErrors:
# The Node contract, dispatched by the SUBSTRATE, which this analysis
# reads for symbols but never as a caller: make_node() constructs and
# calls arguments(), Router calls fill(), the console reads
# node_schema()/dump_config(), and Worker_Base drives
# save_state()/restore_state(). Every one reads as dead here and none
# is. Anything OUTSIDE this list is a real finding — that is the point
# of naming them rather than muting the rule.
-
identifier: shipmonk.deadMethod
message: '#::(__construct|fill|arguments|node_schema|dump_config|save_state|restore_state)$#'
path: includes/*.php