Re: iterator_count signature for iterables
| From: | Marco Pivetta | Date: | Tue, 26 Nov 2024 11:00:24 +0000 |
| Subject: | Re: iterator_count signature for iterables | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126054@lists.php.net to get a copy of this message | ||
Hey Tim,
On Tue, 26 Nov 2024 at 10:50, Tim Düsterhus <tim@bastelstu.be> wrote:
> Hi
>
> Am 2024-11-26 10:40, schrieb Eugene Sidelnyk:
> > I think it would make sense to change the signature of iterator_count
> > to
> > accept iterable rather than array|Traversable so that static analysis
> > tools
> > would pick it up better
>
> That sounds like a bug in Psalm's understanding of union types. PHPStan
> handles it just fine:
> https://phpstan.org/r/8604ef1d-3500-4695-8c23-bb5d30ce4268
>
Is
Traversable|array an alias of iterable? Is it **always** like that?
Marco Pivetta
https://mastodon.social/@ocramius
https://ocramius.github.io/