Skip to content

Optional callable parameters are not enforced #8438

Description

@stof

https://psalm.dev/r/1b710fb4db does not report any error while executing it breaks (see https://3v4l.org/vjkCN)

It should report an error on line 11, as the callback has a type callable(string): string, which cannot be passed to callable(string=): string.

For reference, the same issue exists in phpstan. It is tracked at phpstan/phpstan#7320 (they used to fix it, but they reverted it due to the ecosystem impact because doctrine/collections used to have wrong type declarations for their callbacks, but this is now fixed in doctrine/collections 1.7.2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions