Skip to content
New issue

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

Narrow subtype for RecursiveIteratorIterator $iterable param #3425

Closed
simPod opened this issue Jun 9, 2020 · 2 comments
Closed

Narrow subtype for RecursiveIteratorIterator $iterable param #3425

simPod opened this issue Jun 9, 2020 · 2 comments

Comments

@simPod
Copy link
Contributor

simPod commented Jun 9, 2020

https://phpstan.org/r/ec7fe70c-0127-45a4-9f83-f9d8bd63304f

<?php declare(strict_types = 1);

new RecursiveIteratorIterator((function() { yield 22; })());

This code crashes https://3v4l.org/evDe2 because RecursiveIteratorIterator's template T in stub is of \Traversable and not of \RecursiveIterator|\IteratorAggregate as specified in docs https://www.php.net/manual/en/recursiveiteratoriterator.construct.php

(crosslink phpstan/phpstan-src#228)

@ondrejmirtes ondrejmirtes added this to the Generics milestone Jun 9, 2020
@ondrejmirtes
Copy link
Member

Implemented: phpstan/phpstan-src@d28b61b

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants