packagist phan/phan 5.2.1
Release 5.2.1 supporting PHP 7.0-8.1 syntax

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

New Features:

  • Improve analysis of conditions detecting the empty/non-empty array. (#4523)
    E.g. support if ($x === []) {...} else {...}, if (count($x) > 0) {...} else {...}, etc.
  • Raise severity of PhanTypeNonVarPassByRef to critical. It throws an Error in php 8.0+. (#3830)
  • Infer from conditions such as in_array($var, $array, true) that $array is a non-empty array and that $var is of a type found in the elements of $array. (#2511)

Plugins:

  • Emit a proper warning when InvokePHPNativeSyntaxCheckPlugin is passed a path to a php binary that is missing or invalid (or if the syntax check crashed). (#4116)
    Previously, Phan would crash with an error such as fwrite(): write of 8196 bytes failed with errno=32 Broken pipe
  • Fix false positive PhanPluginMoreSpecificActualReturnType for phpdoc array shape return type and returned generic array. (#4531)

Bug fixes:

  • Fix type inference logic that was looking for array specializations rather than array or any array subtype (#4512)

  • Fix false positive PhanUnreferencedClosure/PhanUnreferencedFunction seen when a closure/function name was passed to a function such as uasort that already had a plugin analyzing calls of the closure. (#4090, #4519)

  • Fix false positive/negative PhanTypeMissingReturn* instances. (#4537)

    The check was wrong and should have been checking for a statement list that throws/exits.
    Return statements can be omitted if a function unconditionally exits.

    Also, check for the real never return type when emitting issues

  • Fix false positive PhanPossiblyUndefinedGlobalVariable* instance when global $var is used within a conditional. (#4539)

  • Fix false positive PhanPluginRedundantAssignmentInLoop instance when a variable is modified in a catch statement with a break/continue. (#4542)

  • Fix some incorrect line numbers in some plugin issues.

  • Fix crash seen when parsing intersection types containing union types such as non-empty-array&array<'a'|'b'> (#4544)

Maintenance:

  • Fix old return type signature for get_headers (#3273)
  • Print instructions on how to upgrade php-ast to 1.0.11+ if an outdated version is installed. (#4532)

Don't miss a new phan release

NewReleases is sending notifications on new releases.