github vimeo/psalm 3.16
A smattering of things

latest releases: 5.24.0, 5.23.1, 5.23.0...
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

Don't miss a new psalm release

NewReleases is sending notifications on new releases.