New features(CLI, Configs):
- Enable the progress bar by default, if
STDERR
is being rendered directly to a terminal.
Add a new option--no-progress-bar
. - Emit warnings about missing files in
file_list
, CLI args, etc. toSTDERR
. (#3434) - Clear the progress bar when emitting many types of warnings to
STDERR
.
New features(Analysis):
-
Suggest similarly named static methods and static properties for
PhanUndeclaredConstant
issues on class constants. (#3393) -
Support
@mixin
(and an alias@phan-mixin
) as a way to load public methods and public instance properties
as magic methods and magic properties from another classlike. (#3237)Attempts to parse or analyze mixins can be disabled by setting
read_mixin_annotations
tofalse
in your Phan config. -
Support
@readonly
as an alias of the@phan-read-only
annotation. -
Also emit
PhanImpossibleTypeComparison
forint === float
checks. (#3106) -
Emit
PhanSuspiciousMagicConstant
when using__METHOD__
in a function instead of a method. -
Check return types and parameter types of global functions which Phan has signatures for,
whenignore_undeclared_functions_with_known_signatures
isfalse
andPhanUndeclaredFunction
is emitted. (#3441)Previously, Phan would emit
PhanUndeclaredFunction
without checking param or return types. -
Emit
PhanImpossibleTypeComparison*
andPhanSuspiciousWeakTypeComparison*
whenin_array
orarray_search
is used in a way that will always return false. -
Emit
PhanImpossibleTypeComparison*
whenarray_key_exists
is used in a way that will always return false.
(e.g. checking for a string literal or negative key in a list, an integer in an array with known string keys, or anything in an empty array) -
Add some missing function analyzers: Infer that
shuffle
,rsort
,natsort
, etc. convert arrays to lists.
Same forarsort
,krsort
, etc. -
Convert to
list
orassociative-array
insort
/asort
in more edge cases. -
Infer that
sort
/asort
on an array (and other internal functions using references) returns a reallist
orassociative-array
.
Infer thatsort
/asort
on a non-empty array (and other internal functions using references) returns a realnon-empty-list
ornon-empty-associative-array
. -
Infer that some array operations (
array_reduce
,array_filter
, etc.) result inarray
instead ofnon-empty-array
(etc.)
Bug fixes:
- Fix a bug where global functions, closures, and arrow functions may have inferred values from previous analysis unintentionally left over in the original scope when analyzing that function again. (methods were unaffected)
Maintenance:
- Clarify a warning message about "None of the files to analyze in /path/to/project exist"
Plugins:
- Add a new plugin
RedundantAssignmentPlugin
to warn about assigning the same value a variable already has to that variable. (#3424)
New issue types:PhanPluginRedundantAssignment
,PhanPluginRedundantAssignmentInLoop
,PhanPluginRedundantAssignmentInGlobalScope
- Warn about alignment directives and more padding directives (
'x
) without width directive inPrintfCheckerPlugin
(#3317) - Also emit
PhanPluginPrintfNoArguments
in cases when the format string could not be determined. (#3198)