Skip to content

[BUG] "Method…should return Generator but returns false" #574

@mfn

Description

@mfn

This is a false positive, because returning false from a method which yields still returns a Generator, see:

<?php

function foo(): Generator
{
    return false;
    yield "yolo";
}

var_dump(foo());

Output:

object(Generator)#1 (0) { }

See also https://3v4l.org/VcSpa

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions