packagist phan/phan 2.1.0
Release 2.1.0 supporting PHP 7.0-7.3 syntax

latest releases: v5.x-dev, dev-fix-4782, dev-MapReal-php81-82...
4 years ago

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 setting color_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 setting PHAN_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)) and assert($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(); and return $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 and PhanTypeInstantiateTraitStaticOrSelf as lower-severity warnings about return new self() and return 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 implements ArrayAccess (#2797)

Language Server/Daemon mode:

  • Add --language-server-min-diagnostics-delay-ms <ms>, to work around race conditions in some language clients.

Don't miss a new phan release

NewReleases is sending notifications on new releases.