Skip to content

Bitwise flags not working quite well with self::CONST_* #4732

@Seldaek

Description

@Seldaek

Bug report

Bitwise flags are not working together with self::CONST_* - sorry if I missed something in the type docs that helps declare this better. I don't know if it needs a new type to specify ints that are bit masks or what exactly. Might be a feature request rather than bug report.. Psalm seems to output the same error, so maybe I'm the problem, but it doesn't seem to be that unreasonable to list all valid constants that can be passed in, without listing all possible combinations or just typing it as an int. Listing constants helps with auto-completion and self-documentation so it'd be great to be able to.

Code snippet that reproduces the problem

https://phpstan.org/r/ab87e34e-a3c2-4afe-a7cd-f77f8406df27

Expected output

No error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions