packagist phan/phan 2.5.0
Release 2.5.0 supporting PHP 7.0-7.4 syntax

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

New Features(CLI):

  • Support using directory_suppressions in Phan baseline files in --load-baseline. (#3698)
  • Improve error message for warnings about Phan being unable to read files in the analyzed directory.

New Features(Analysis):

  • Instead of failing to parse intersection types in phpdoc entirely, parse them as if they were union types. (#1629)
    The annotations @phan-param, @phan-return, @phan-var, etc. can be used to override the regular phpdoc in the various cases where this behavior causes problems.

    Future Phan releases will likely about unsupported phpdoc (e.g. int&string) and have actual support for intersection types.

  • Emit PhanUndeclaredConstantOfClass (severity critical) for undeclared class constants instead of PhanUndeclaredConstant (severity normal)
    This should not be confused with PhanUndeclaredClassConstant, which already exists and refers to accessing class constants of classes that don't exist.

  • Emit the expression that's an invalid object with issue types such as PhanTypeExpectedObject*, PhanTypeInvalidInstanceof (#3717)

  • Emit PhanCompatibleScalarTypePHP56 and PhanCompatibleAnyReturnTypePHP56 for function signatures when target_php_version is '5.6' (#915)
    (This also requires that backward_compatibility_checks be enabled.)

  • Use more accurate line numbers for warnings about function parameters.

  • When assume_real_types_for_internal_functions is on and a function has a non-empty return type in Reflection,
    make Phan's known real type signatures override the real reflection return type information (useful when Phan infers list<string> and Reflection says array).
    Phan previously used the type from Reflection.

  • Normalize phpdoc parameter and return types when there is a corresponding real type in the signature. (#3725)
    (e.g. convert bool|false|null to ?bool)

Plugins:

  • Add SubscribeEmitIssueCapability to detect or suppress issues immediately before they are emitted. (#3719)

Bug fixes:

  • Don't include issues that weren't emitted in the file generated by --save-baseline (#3719)
  • Fix incorrect file location for other definition in PhanRedefinedClassReference under some circumstances.
  • Fix incorrect issue name: PhanCompatibleNullableTypePHP71 should be named PhanCompatibleObjectTypePHP71
  • Fix false positive PhanPartialTypeMismatchProperty when a php 7.4 typed property has a default expression value (#3725)

Don't miss a new phan release

NewReleases is sending notifications on new releases.