Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psalter changing return type of function returning anonymous class #5145

Closed
thiagorb opened this issue Feb 2, 2021 · 1 comment · Fixed by #5146
Closed

Psalter changing return type of function returning anonymous class #5145

thiagorb opened this issue Feb 2, 2021 · 1 comment · Fixed by #5146
Labels

Comments

@thiagorb
Copy link

thiagorb commented Feb 2, 2021

Before Psalter

<?php

class A {}

function f(): A
{
    return new class extends A {};
}

After Psalter

<?php

class A {}

function f(): object
{
    return new class extends A {};
}

The return type of the function f was changed to object. Is this intended?

Would it be doable to use the class the anonymous class extends from if it is the case?

@psalm-github-bot
Copy link

Hey @thiagorb, can you reproduce the issue on https://psalm.dev ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants