New features(CLI, Configs):
- Instead of printing the full help when Phan CLI args or configuration is invalid,
print just the errors/warnings and instructions andType ./phan --help (or --extended-help) for usage.
- Add an option
--debug-signal-handler
that can be used to diagnose
why Phan or a plugin is slow or hanging. (Requires thepcntl
module)
This installs a signal handler that response to SIGINT (aka Ctrl-C), SIGUSR1, and SIGUSR2. - Print a single backtrace in the crash reporter with the file, line, and arguments instead of multiple backtraces.
- Emit a warning suggesting using
--long-option
instead when-long-option[=value]
is passed in. - Change colorization of some error messages. Print some warnings to stderr instead of using
error_log()
.
New features(Analysis):
-
Emit
PhanTypeMismatchPropertyRealByRef
orPhanTypeMismatchPropertyByRef
when potentially assigning an incompatible type to a php 7.4 typed property
(or a property with a phpdoc type). -
Warn about suspicious uses of
+
or+=
on array shapes or lists. (#3364)
These operator will prefer the fields from the left hand side,
and will merge lists instead of concatenate them.
New issue types:PhanSuspiciousBinaryAddLists
,PhanUselessBinaryAddRight
-
Improvements to inferred types of
sort
,array_merge
, etc. (#3354) -
Fix bug allowing any array shape type to cast to a list.
-
Warn about unnecessary branches leading to identical return statements in pure functions, methods, and closures (#3383)
This check is only run on pure methods.This requires that
UseReturnValuePlugin
be enabled and works best when'plugin_config' => ['infer_pure_methods' => true]
is set. -
Allow
list<X>
to cast toarray{0:X, 1?:X}
(#3390) -
Speed up computing line numbers of diagnostics in the polyfill/fallback parser when there are multiple diagnostics.
Language Server/Daemon mode:
- Reduce the CPU usage of the language server's main process when the
pcntl
module is used to fork analysis processes (Unix/Linux). - Speed up serializing large responses in language server mode (e.g. when a string has an unmatched quote).