New features(CLI, Configs):
-
Support saving and loading baselines with
--save-baseline=.phan/baseline.php
and--load-baseline=.phan/baseline.php
. (#2000)
--save-baseline
will save all pre-existing issues for the provided analysis settings to a file.
When Phan is invoked later with--load-baseline
, it will ignore any
issue kinds in the files fromfile_suppressions
in the baseline.This is useful for setting up analysis with Phan on a new project,
or when enabling stricter analysis settings.Different baseline files can be used for different Phan configurations.
(e.g..phan/baseline_deadcode.php
for runs with--dead-code-detection
)
New features(Analysis):
- Fix edge cases in checking if some nullable types were possibly falsey
(?true
and literal floats (e.g.?1.1
)) - Emit
PhanCoalescingNeverNull
instead ofPhanCoalescingNeverNullIn*
if it's impossible for the node kind to be null. (#3386) - Warn about array destructuring syntax errors (
[] = $arr
,[$withoutKey, 1 => $withKey] = $arr
) - Return a clone of an existing variable if one already exists in Variable::fromNodeInContext. (#3406)
This helps analyzePassByReferenceVariable
s. - Don't emit PhanParamSpecial2 for min/max/implode/join with a single vararg. (#3396)
- Properly emit PhanPossiblyInfiniteRecursionSameParams for functions with varargs.
- Emit
PhanNoopNew
orPhanNoopNewNoSideEffects
when an object is created withnew expr(...)
but the result is not used (#3410) - Emit
PhanPluginUseReturnValueInternalKnown
for about unused results of function calls on the right hand side of control flow operators (??
/?:
/&&
/||
) (#3408)