Psalm v3.16 Release Notes

Release Date: 2020-09-15 // over 3 years ago
  • ๐Ÿ”‹ Features

    ๐Ÿ†• New PHPStorm-optimised output format

    โž• Added a phpstorm report format that displays errors in a manner that PHPStorm can parse more easily (#4085) โ€“ thanks @the-toster (with additional help from @Rarst)

    Detection of strpos issues

    Psalm will now raise two separate issues for the following code:

    function foo(string $s) : void { if (strpos(".", $s) !== -1) {} }
    

    The first, InvalidLiteralArgument, complains a string was passed where a variable was expected. The second complains that the output of strpos can never be negative.

    ๐Ÿ‘ Allow intersection of object-like arrays and regular arrays

    Psalm now allows the docblock array{foo: string}&array<string, string>, understanding it to mean an array of strings with one explicit known key.

    @psalm-stub-override

    โž• Added support for @psalm-stub-override which only renders the stub valid if the given class already exists โ€“ thanks @weirdan (#4177)

    @psalm-suppress Issue1, Issue2

    โž• Added support for multiple suppressed issues on a given line โ€“ thanks @weirdan (#4179)

    ๐Ÿ›  Bugfixes

    ๐Ÿ‘ Allow multiple issues of the same type at a single position

    โšก๏ธ Psalm will now report multiple issues that map to the same code position (but whose message body is different). If you use the baseline, you might need to update it accordingly (#4167)

    ๐Ÿ›  Other bugfixes

    • ๐Ÿ‘ allow slashes in docblock tags (#4112)
    • ensure calling Closure::__invoke doesn't break when running Psalm in PHP 7.2.11 and below (#4111)
    • refine closure types more accurately according to a callable
    • prevent crash when suppressing UndefinedTrait (#4130)
    • improve inference of preg_match_all $matches array value (#4128)
    • ๐Ÿ›  fix a crash when using a short closure without specifying the Closure type anywhere in the affected methods (#4148)
    • ๐Ÿ‘ allow null checks on the output of Iterator::current (#4146)
    • Language Server @matthijskooijman made a couple of improvements (#4143)
    • treat literal numeric strings as numeric always (#4154)
    • Taint analysis @craigfrancis added additional mysql sinks (#4155)
    • Language Server @ngyuki fixed a bug using the Phar (#4174)
    • ๐Ÿ›  Fix Psalm's assertion generation from count($arr) <= 1 (#4169)
    • @ygottschalk improved Psalm's assertion generation from count calls further (#4175)
    • ๐Ÿ‘Œ Improve error message (and location) for unused params once they've been written to (#4127)
    • prevent an empty docblock from suppressing missing property types (#4178)
    • properly detect yield expressions in function arguments (#4122)
    • ๐Ÿ”€ improved Psalm's understanding of array_merge and array_filter functions