The Phan 2.x releases support analysis of php 7.0-7.3, and can be executed with php 7.1+.
New features(CLI, Configs):
-
Add more options to configure colorized output. (#2799)
The environment variable
PHAN_ENABLE_COLOR_OUTPUT=1
and the config settingcolor_issue_messages_if_supported
can be used to enable colorized output by default
for the default output mode (text
) when the terminal supports it.This can be disabled by setting
PHAN_DISABLE_COLOR_OUTPUT=1
or by passing the flag--no-color
. -
Colorize output of
--help
and--extended-help
when--color
is used or the terminal supports it.
This can be disabled by settingPHAN_DISABLE_COLOR_OUTPUT=1
or by passing the flag--no-color
.
New features(Analysis):
- Support unary and binary expressions on literals/constants in conditions. (#2812)
(e.g.assert($x === -(1))
andassert($x === 2+2)
now infer that $x is -1 and 4, respectively) - Infer that static variables with no default are
null
. - Improve control flow analysis of unconditionally true/false branches.
- Improve analysis of some ways to initialize groups of static variables.
e.g.static $a = null; static $b = null; if ($a === null) { $a = $b = rand(0,10); } use($a, $b)
will now also infer that $b is non-null. - Infer from
return new static();
andreturn $this;
that the return type of a method is@return static
, not@return self
(#2797)
(and propagate that to inherited methods) - Fix some false positives when casting array types containing
static
to types containing the class or its ancestors. (#2797) - Add
PhanTypeInstantiateAbstractStatic
andPhanTypeInstantiateTraitStaticOrSelf
as lower-severity warnings aboutreturn new self()
andreturn new static()
(#2797)
(emitted in static methods of abstract classes) - Fix false positives passing
static
to other classes. (#2797) - Fix false positive seen when
static
implementsArrayAccess
(#2797)
Language Server/Daemon mode:
- Add
--language-server-min-diagnostics-delay-ms <ms>
, to work around race conditions in some language clients.