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

Support for mocking methods with "static" return type #620

Open
aik099 opened this issue Mar 30, 2024 · 0 comments · May be fixed by #621
Open

Support for mocking methods with "static" return type #620

aik099 opened this issue Mar 30, 2024 · 0 comments · May be fixed by #621

Comments

@aik099
Copy link
Member

aik099 commented Mar 30, 2024

When attempting to mock a method with a static return type (see https://php.watch/versions/8.0/static-return-type), then you'll get this error:

Prophecy\Exception\Prophecy\MethodProphecyException: Cannot create a return value for the method as the type "static" is not supported. Configure an explicit return value instead.

Code:

class Process implements \IteratorAggregate
{
    public function mustRun(?callable $callback = null, array $env = []): static
    {
        return $this;
    }
}
@aik099 aik099 linked a pull request Mar 30, 2024 that will close this issue
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 a pull request may close this issue.

1 participant