The Phan 1.x releases support analysis of php 7.0-7.3, and can be executed with php 7.0+.
New features(CLI, Configs):
- Make the progress bar guaranteed to display 100% at the end of the analysis phase (#2694)
Print a newline to stderr once Phan is done updating the progress bar. - Add
maximum_recursion_depth
- This setting specifies the maximum recursion depth that
can be reached during re-analysis.
Default is 2. - Add
--constant-variable-detection
- This checks for variables that can be replaced with literals or constants. (#2704)
This is almost entirely false positives in most coding styles, but may catch some dead code. - Add
--language-server-disable-go-to-definition
,--language-server-disable-hover
, and--language-server-disable-completion
(These are already disabled by default, but will be enabled by default in Phan 2.0)
New features(Analysis):
- Emit
PhanDeprecatedClassConstant
for code using a constant marked with@deprecated
. - When recursively inferring the return type of
BaseClass::method()
from its return statements,
make that also affect the inherited copies of that method (SubClass::method()
). (#2718)
This change is limited to methods with no return type in the phpdoc or real signature. - Improve unused variable detection: Detect more unused variables for expressions such as
$x++
and$x -= 2
(#2715) - Fix false positive
PhanUnusedVariable
after assignment by reference (#2730) - Warn about references, static variables, and uses of global variables that are probably unnecessary (never used/assigned to afterwards) (#2733)
New issue types:PhanUnusedVariableReference
,PhanUnusedVariableGlobal
,PhanUnusedVariableGlobal
- Warn about invalid AST nodes for defaults of properties and static variables. (#2732)
- Warn about union types on properties that might have an incomplete suffix. (e.g.
/** @var array<int, */
) (#2708)
Plugins:
- Add more forms of checks such as
$x !== null ? $x : null
toPhanPluginDuplicateConditionalNullCoalescing
(#2691)