phan v3.1.1 Release Notes
Release Date: 2020-07-31 // almost 4 years ago-
🆕 New features (CLI, Config):
Add
--baseline-summary-type={ordered_by_count,ordered_by_type,none}
to control the generation
of the summary comment generated by--save-baseline=path/to/baseline.php
(#4044)
(overrides the newbaseline_summary_type
config).
The default comment summary (ordered_by_count
) is prone to merge conflicts in large projects.
This does not affect analysis.Add
tool/phan_repl_helpers.php
, a prototype tool that adds some functionality tophp -a
.
It can be required by runningrequire_once 'path/to/phan/tool/phan_repl_helpers.php'
during an interactive session.- This replaces the readline code completion and adds autocomplete for
->
on global variables.
This is currently buggy and very limited, and is missing some of the code completion functionality that is available inphp -a
.
(And it's missing a lot of the code completion functionality from the language server) - This adds a global function
help($element_name_or_object)
. Runhelp('help')
for usage and examples. - Future releases may advantage of Phan's parsing/analysis capabilities in more ways.
- Several alternatives to the php shell already exist, such as psysh.
tool/phan_repl_helpers.php
is an experiment in augmenting the interactive php shell, not an alternative shell.
⚡️ Update progress bar during class analysis phase. (#4099)
🆕 New features (Analysis):
- 👌 Support casting
iterable<SubClass>
toiterable<BaseClass>
(#4089) - 🔄 Change phrasing for
analyze
phase in--long-progress-bar
with--analyze-twice
- ➕ Add
PhanParamNameIndicatingUnused
andPhanParamNameIndicatingUnusedInClosure
to indicate that using parameter names($unused*
,$_
) to indicate to Phan that a parameter is unused is no longer recommended.
Suppressions or the@param [Type] $param_name @unused-param
syntax can be used instead.
👍 PHP 8.0 will introduce named argument support. - ➕ Add a message to
PhanParamSignatureMismatch
indicating the cause of the issue being emitted. (#4103)
Note thatPhanParamSignaturePHPDocMismatch*
andPhanParamSignatureReal*
have fewer false positives. - Warn about invalid types in class constants. (#4104)
👀 EmitPhanUndeclaredTypeClassConstant
if undeclared types are seen in phpdoc for class constants.
👀 EmitPhanCommentObjectInClassConstantType
if object types are seen in phpdoc for class constants. - Warn about
iterable<UndeclaredClass>
containing undeclared classes. (#4104)
Language Server/Daemon mode:
- Include PHP keywords such as
__FILE__
,switch
,function
, etc. in suggestions for code completions.
🔌 Plugins:
- 🔌 Make
DuplicateExpressionPlugin
warn if adjacent statements are identical. (#4074)
🆕 New issue types:PhanPluginDuplicateAdjacentStatement
. - 🚑 Consistently make
PhanPluginPrintfNonexistentArgument
have critical severity. (#4080)
🖨 Passing too few format string arguments (e.g.printf("%s %s", "Hello,")
) will be anArgumentCountError
in PHP 8.
🐛 Bug fixes:
- This replaces the readline code completion and adds autocomplete for