phan v3.0.3 Release Notes

Release Date: 2020-06-21 // almost 4 years ago
  • 🆕 New features(Analysis):

    • Include the most generic types when conditions such as is_string() to union types containing mixed (#3947)
    • More aggressively infer that while and for loop bodies are executed at least once in functions outside of other loops (#3948)
    • Infer the union type of !$expr from the type of $expr (#3948)
    • 0️⃣ Re-enable simplify_ast by default in .phan/config.php (#3944, #3945)
    • Avoid false positives in --constant-variable-detection for ++/--
    • 🚚 Make if (!$nullableValue) { } remove truthy literal scalar values such as 'value' and 1 and 1.0 when they're nullable
    • Emit PhanTypeVoidArgument when passing a void return value as a function argument (#3961)
    • 🔀 Correctly merge the possible union types of pass-by-reference variables (#3959)
    • 👌 Improve php 8.0-dev shim support. Fix checking for array references and closure use references in php 8.0+.
    • More aggressively check if expression results should be used for conditionals and binary operators.

    🔌 Plugins:

    • ➕ Add ConstantVariablePlugin to point out places where variables are read when they have only one possible scalar value. (#3953)
      0️⃣ This may help detect logic errors such as $x === null ? json_encode($x) : 'default' or code that could be simplified,
      but most issues it emits wouldn't be worth fixing due to hurting readability or being false positives.
    • ➕ Add MergeVariableInfoCapability for plugins to hook into ContextMergeVisitor and update data for a variable
      🔀 when merging the outcome of different scopes. (#3956)
    • 🔌 Make UseReturnValuePlugin check if a method is declared as pure before using the dynamic checks based on percentage of
      calls where the return value is used, if that option is enabled.
    • 🔌 In DuplicateArrayKeyPlugin, properly check for duplicate non-scalar cases.

    Language Server/Daemon mode:

    • 🛠 Fix bug where the Phan daemon would crash on the next request after analyzing a file outside of the project being analyzed,
      when pcntl was disabled or unavailable (#3954)

    🐛 Bug fixes:

    • 🛠 Fix PhanDebugAnnotation output for variables after the first one in @phan-debug-var $a, $b (#3943)
    • 👉 Use the correct constant to check if closure use variables are references in php 8.0+

    Miscellaneous:

    • ⚡️ Update function signature stubs for the memcache PECL (#3841)

    🚀 The GPG key used to sign releases has changed (it expired). See #1759