Skip to content

Missing type hint for Generator/Iterator/IteratorAggregate is not reported #7498

@baci266

Description

@baci266

Bug report

It seems that PHPStan is not reporting missing type hint for:

  • Generator
  • Iterator
  • IteratorAggregate

It works fine for Traversable

Code snippet that reproduces the problem

class Test
{
	public static function generator(): Generator
	{
		yield 'test';
	}
}

https://phpstan.org/r/ea648942-e5e9-4400-b219-07f69ef7465d

Expected output

Method Test::generator() return type has no value type specified in iterable type Generator.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions