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

Mock methods with static return types #1157

Merged
merged 4 commits into from Jan 11, 2022
Merged

Mock methods with static return types #1157

merged 4 commits into from Jan 11, 2022

Conversation

ghostwriter
Copy link
Member

This patch resolves #1155, via the following changes:

  • Add tests and fixtures
  • Mock methods with static return type.
class Foo
{
    public function getFoo(): static
    {
        return $this;
    }
}

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@davedevelopment
Copy link
Collaborator

Thank you!

@ghostwriter ghostwriter deleted the bugfix/mock-static-return-types branch January 11, 2022 12:39
@ramsey
Copy link

ramsey commented Jan 12, 2022

Thanks, @ghostwriter!

@ruudk
Copy link
Contributor

ruudk commented Jan 14, 2022

Thanks for this. Would be great to have this tagged 🙏

Edit: Created an issue to track this differently: #1161

@ghostwriter ghostwriter self-assigned this May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Attempting to mock a method with static return type in PHP 8 results in ParseError
4 participants