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
//! PHP-language backend: scope model, AbcSize, used-once/never-used.
//!
//! Metric spec (mirrors the Rust backend's semantics where a direct
//! analogue exists):
//! - Units: every named `function_definition` and `method_declaration`.
//! Anonymous and arrow functions roll into the enclosing unit -- they
//! are NOT boundaries here.
//! - A: assignments (+1 per written identifier target, destructuring
//! lists expand per name), augmented assignments, foreach heads.
//! - B: calls (plain, method, scoped, nullsafe), `new`, includes,
//! arithmetic/bitwise/concat binary operators, unary operators.
//! - C: if / elseif / while / do / for / foreach, each switch case and
//! default, each match arm, catch clauses, ternaries, comparisons,
//! `&&`/`||`/`and`/`or`/`??`.
//! - UsedOnce: single plain write, pure RHS, straight-line write, single
//! read after the write. Parameters, foreach heads, `$this`, catch
//! bindings and underscore-free-only naming rules apply as elsewhere
//! (PHP names lose their leading `$` internally).
//! - NeverUsed: written but never read, reported at the first write;
//! same exclusions.
use crateScope;
pub
use Tree;
pub use ;