Skip to content

Array not considered as iterable #3072

@TheCelavi

Description

@TheCelavi

Bug report

Installed version: 0.12.14

It seams that array is not considered as valid iterable, while array is iterable: https://www.php.net/manual/en/language.types.iterable.php

Code snippet that reproduces the problem


<?php declare(strict_types = 1);

class HelloWorld
{
	/**
	 * @template T
	 * @return iterable<T>
	 */
	public function getIterable(): iterable
	{
		return [];
	}
}

https://phpstan.org/r/15458536-75a3-4a6b-9988-3d3999fe6441

Expected output

OK

Code should pass check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions