The Phan 1.x releases support analysis of php 7.0-7.3, and can be executed with php 7.0+.
New features(CLI, Configs):
- Add
--debug
/-D
flag to generate verbose debug output.
This is useful when looking into poor performance or unexpected behavior (e.g. infinite loops or crashes). - Suggest similarly named plugins if
--plugin SomePluginName
refers to a built-in plugin that doesn't exist. - Add
assume_no_external_class_overrides
- When enabled, Phan will more aggressively assume class elements aren't overridden.- e.g. infer that non-final methods without return statements have type
void
.
Disabled by default.
- e.g. infer that non-final methods without return statements have type
New features(Analysis):
-
Support locally tracking assignments to and conditionals on
$this->prop
inside of function scopes. (#805, #204)This supports only one level of nesting. (i.e. Phan will not track
$this->prop->subProp
or$this->prop['field']
)Properties are deliberately tracked for just the variable
$this
(which can't be reassigned), and not other variables. -
Fix false positives with dead code detection for internal stubs in
autoload_internal_extension_signatures
. (#2605) -
Add a way to escape/unescape array shape keys (newlines, binary data, etc) (#1664)
e.g.
@return array{\n\r\t\x01\\:true}
in phpdoc would correspond toreturn ["\n\r\t\x01\\" => true];
Plugins:
-
Add
FFIAnalysisPlugin
to avoid false positives in uses of PHP 7.4'sFFI\CData
(#2659)
(C data of scalar types may be read and assigned as regular PHP data.$x = FFI::new(“int”); $x = 42;
)Note that this is only implemented for variables right now.