We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a function
/** * @template Tk * @template Tv * * @param Generator<Tk, Tv, mixed, mixed> $generator * * @return iterable<Tk, Tv> */ function rewindable(Generator $generator): iterable;
I want to apply this function on a variable of type iterable when it's instance of Generator
iterable
$new = $old instanceof Generator ? rewindable($old) : $old;
$old is of type iterable<A,B> and I'd expect $new to be of the same type. However, the type info is lost and $new is of type iterable<mixed>.
$old
iterable<A,B>
$new
iterable<mixed>
https://phpstan.org/r/8e49d7cf-ee0f-4943-8c7c-d5e1cd8596b8
L34: Dumped type: iterable<ToString>
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug report
I have a function
I want to apply this function on a variable of type
iterable
when it's instance of Generator$new = $old instanceof Generator ? rewindable($old) : $old;
$old
is of typeiterable<A,B>
and I'd expect$new
to be of the same type. However, the type info is lost and$new
is of typeiterable<mixed>
.Code snippet that reproduces the problem
https://phpstan.org/r/8e49d7cf-ee0f-4943-8c7c-d5e1cd8596b8
Expected output
L34: Dumped type: iterable<ToString>
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: