Psalm v4.3.1 Release Notes

Release Date: 2020-12-03 // over 3 years ago
    • prevent false-positive on isset in a finally block when checking a catch variable (#4764)
    • prevent bug when calling parent constructor during property initialisation checks (#4760)
    • πŸ›  fix false-positive bug when an assignment with a ternary re-assigns a ternary variable (#4759)

Previous changes from v4.3.0

  • πŸ”‹ Features

    • UnusedConstructor is now a separate issue from UnusedMethod. This allows people to use the private constructor pattern to prevent instantiation of classes that just have static methods (#4656)
    • πŸ‘ RedundantCast is now a separate issue from RedundantCondition. It is now emitted for more redundant casts thanks to @orklah adding better detection (#4695)
    • πŸ‘ @odoucet added support for the CodeClimate output format (#4387)
    • βœ… @weirdan added a test to ensure all new Psalm annotations are documented (#4723)
    • RedundantPropertyInitializationCheck is now emitted for isset checks on class properties that Psalm thinks should be defined. This allows users who prefer to initialize properties outside constructors to silence just that issue (#4732)

    πŸ›  Bugfixes


    • πŸ‘ @orklah added support for adding static return types when running in PHP 8 (#4641)
    • πŸ‘ @orklah added support for adding int|string phpdoc standin for array-key (#4645)
    • πŸ‘ @orklah added support for adding string phpdoc standin for Foo::class (#4651)
    • πŸ‘‰ use union types in PHP 8 wherever possible (#4643)

    Taint analysis

    PHP 8 compatibility

    • Promoted properties are always treated as initialised (#4615)
    • Flag invalid attribute arguments (#4611)
    • Ensure classes used as attributes themselves have the Attribute attribute (#4475)
    • Ensure the Attribute attribute is only valid on classes (#4609)
    • πŸ›  @orklah fixed param names on core functions to enable named-argument calling in PHP 8 (#4745)
    • πŸ›  @orklah fixed return type additions when returning from finally (#4746)


    • πŸ‘ Allow the Phar to run in PHP 7.2 (#4640)
    • Prevent crash with recursively-defined @psalm-type in root namespace (#4653)
    • @staabm made many file-based functions impure (#4674, #4676, #4679, #4678)
    • @erikjwaxx narrowed the return type for $a <=> $b (#4680)
    • @orklah prevented the use of illegal array keys (#4660)
    • πŸ‘ @BenMorel added a better return type for `PDOStatement::fetchObject' (#4682)
    • treat isset like !== null when the variable is defined (#4699)
    • πŸ›  @orklah fixed an incorrect cast to int when the integer is very large (#4702)
    • πŸ›  @LeSuisse fixed a bug in the taink sink map (#4703)
    • @orklah fixed reconciliation of is_object($some_iterable) (#4712)
    • πŸ‘‰ use correct keys when a list with a known length is compared to an array (#3017)
    • template types are no longer substituted when they’re defined on the same class (#4733)
    • πŸ‘ provide better support for nested template type definitions (#4731)
    • @orklah ensured that non-emptiness is treated as a docblock-level assertion (#4736)
    • πŸ‘ @orklah added much better typing for bitshift operators (#4740)
    • simplified assertions generated from array_key_exists to prevent performance degradation (#4743)
    • prevent stubs from breaking implicit docblock param inference (#4705)
    • πŸ‘ allow errors stemming from @final attribute to be suppressed (#4751)