Skip to content

[DeadCode] Skip return false pseudo type in union on RemoveUselessReturnTagRector#5172

Merged
samsonasik merged 2 commits intomainfrom
pseudo-false
Oct 15, 2023
Merged

[DeadCode] Skip return false pseudo type in union on RemoveUselessReturnTagRector#5172
samsonasik merged 2 commits intomainfrom
pseudo-false

Conversation

@samsonasik
Copy link
Copy Markdown
Member

The following code is valid:

final class SkipReturnFalseOnUnionBool
{
    /**
     * @return false|\stdClass
     */
    function run(): bool|\stdClass
    {
        if (rand(0, 1)) {
            return false;
        }

        return new \stdClass();
    }
}

see https://phpstan.org/r/00534257-55dd-42d2-9104-c25aa5ca9872

@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit e2ba601 into main Oct 15, 2023
@samsonasik samsonasik deleted the pseudo-false branch October 15, 2023 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants