You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Closure returning never leaves the template unresolved when the parameter is Closure(): Foo<E> #15770
When the argument passed for a Closure(): Opt<E> parameter always throws, so that its return type is never, PHPStan does not resolve the template E. It reports argument.templateType, and the call returns Opt<mixed>.
This is close to #15167, which was fixed in phpstan/phpstan-src#6365. That issue covered a union parameter type, callable(): (P<TR>|TR). This case has no union, and it still fails.
Real-world example: Psl\Option\Option::orElse() in php-standard-library 6.x uses the same signature. A common idiom, $option->orElse(static fn () => throw new SomeException()), now produces Option<mixed>.
Activity