github phan/phan 3.0.4
Release 3.0.4 supporting PHP 7.0-7.4 syntax

latest releases: 5.4.3, 5.4.2, 5.4.1...
3 years ago

New features(Analysis):

  • Emit PhanTypeVoidExpression when using an expression returning void 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 of array() or list()
  • In DuplicateExpressionPlugin, emit PhanPluginDuplicateExpressionAssignmentOperation if X = X op Y is seen and it can be converted to X 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 as echo, 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.

Bug fixes:

  • Treat @method static foo() as an instance method returning the union type static (#3981)
    Previously, Phan treated it like a static method with type void based on an earlier phpdoc spec.
  • Fix the way that Phan inferred the finally block's exit status affected the try block. (#3987)

Don't miss a new phan release

NewReleases is sending notifications on new releases.