Psalm v4.1.1 Release Notes

Release Date: 2020-11-02 // 6 months 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)