Skip to content

Mock methods with static return types#1157

Merged
davedevelopment merged 4 commits intomockery:masterfrom
ghostwriter:bugfix/mock-static-return-types
Jan 11, 2022
Merged

Mock methods with static return types#1157
davedevelopment merged 4 commits intomockery:masterfrom
ghostwriter:bugfix/mock-static-return-types

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

Comments