packagist vimeo/psalm 4.1.1
More attribute checks

latest releases: 5.x-dev, dev-master, dev-isTypeContainedByType_flags...
3 years ago

Features

More attribute checks

Psalm now checks that you're using attributes correctly (by verifying attribute targets).

int-mask and int-mask-of

This release also brings support for representing bitmasks concisely with the introduction of a new type int-mask.

int-mask<1, 2, 4> is automatically converted to 1|2|3|4|5|6|7.

Another new type, int-mask-of, allows you to represent masks of multiple values from a single source query

Given

class FileFlag {
    public const OPEN = 1;
    public const MODIFIED = 2;
    public const NEW = 4;
}

int-mask-of<FileFlag::*> is equivalent to int-mask<FileFlag::OPEN, FileFlag::MODIFIED, FileFlag::NEW>

Bugfixes

  • Psalm now supports multiline @extends and @implements docblock tags (#4453)
  • Psalm’s cache now gets busted in more situations when using a self-packaged Phar
  • Only treat two variables as the same if they were set in the same place (#4467)
  • Psalm now performs better inference after if (!class_exists($foo, false)) { return; } (#4466)

Don't miss a new psalm release

NewReleases is sending notifications on new releases.