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
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): DateTimeImmutablegeneric should have been propagated to the callable and it should expectcallable(T of DateTime): DateTimeImmutable