10BC0 Callable parameter types aren't correctly inferred · Issue #3818 · phpstan/phpstan · GitHub
[go: up one dir, main page]

Skip to content

Callable parameter types aren't correctly inferred #3818

@nreynis

Description

@nreynis

Bug report

Types applied to callable doesn't seems to be correctly inferred.

Code snippet that reproduces the problem

https://phpstan.org/r/24105e02-8d5f-4fd9-a237-01ebec9938a9

Expected output

Both lines 29 and 34 should raise Else branch is unreachable because ternary operator condition is always true., only line 29 does.

Line 34 error reveals that the callable is inferred to callable(mixed): DateTimeImmutable generic should have been propagated to the callable and it should expect callable(T of DateTime): DateTimeImmutable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0