New features(Analysis):
- Emit
PhanTypeVoidExpression
when using an expression returningvoid
in places such as array keys/values. - More accurately infer unspecified types when closures are used with
array_map
(#3973) - Don't flatten array shapes and literal values passed to closures when analyzing closures. (Continue flattening for methods and global functions)
- Link to documentation for internal stubs as a suggestion for undeclared class issues when Phan has type information related to the class in its signature files.
See https://github.com/phan/phan/wiki/Frequently-Asked-Questions#undeclared_element - Properly render the default values if available(
ReflectionParameter->isDefaultValueAvailable()
) in php 8.0+. - Properly set the real union types based on reflection information for functions/methods in more edge cases.
- Properly infer that union types containing the empty array shape are possibly empty after sorting (#3980)
- Infer a more accurate real type set from unary ops
~
,+
, and-
(#3991) - Improve ability to infer assignments within true branch of complex expressions in conditions such as
if (A && complex_expression) { } else { }
(#3992)
Plugins:
- Add
ShortArrayPlugin
, to suggest using[]
instead ofarray()
orlist()
- In
DuplicateExpressionPlugin
, emitPhanPluginDuplicateExpressionAssignmentOperation
ifX = X op Y
is seen and it can be converted toX op= Y
(#3985)
(excluding??=
for now) - Add
SimplifyExpressionPlugin
, to suggest shortening expressions such as$realBool ? true : false
or$realBool === false
- Add
RemoveDebugStatementPlugin
, to suggest removing debugging output statements such asecho
,print
,printf
,fwrite(STDERR, ...)
,var_export(...)
, inline html, etc.
This is only useful in applications or libraries that print output in only a few places, as a sanity check that debugging statements are not accidentally left in code.