I went with @return Generator|SomeObject[]
, where SomeObject
is the thing being yielded.
PhpStorm handles this well too, as it now normally hints Generator
methods and when iterated it hints SomeObject
methods.
(Still, I would prefer a native @yield
.)