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

1.6.12 typehint issue with spy methods #1421

Open
brettmc opened this issue May 17, 2024 · 2 comments · May be fixed by #1427
Open

1.6.12 typehint issue with spy methods #1421

brettmc opened this issue May 17, 2024 · 2 comments · May be fixed by #1427
Labels
Bug An error or unexpected behavior.
Milestone

Comments

@brettmc
Copy link

brettmc commented May 17, 2024

Mockery Version

1.6.12

PHP Version

PHP 8.3

Issue Description

After updating to mockery 1.6.12 today, both my IDE (phpstorm 2024.1.1) and psalm (5.24.0) started complaining about missing methods, which seems to only happen on mocks created via Mockery::spy():

Method Mockery\LegacyMockInterface::once does not exist (see https://psalm.dev/181)
Method Mockery\LegacyMockInterface::with does not exist (see https://psalm.dev/181)

It still works (as in, tests with these spies run and work as expected), but static analysis is not happy. We also use psalm/plugin-mockery (latest version).

Steps to Reproduce

$mock = Mockery::spy(SpanProcessorInterface::class);
$mock
  ->shouldHaveReceived('some.method')
  ->once()
  ->with('some.parameter');

Expected Behavior

No response

Actual Behavior

No response

Exception or Error

No response

Additional Information

The phpunit tests extend MockeryTestCase.
I also tried using mock()->shouldIgnoreMissing() which had the same issue.

@brettmc brettmc added the triage needs to be triaged label May 17, 2024
@ghostwriter ghostwriter added Bug An error or unexpected behavior. Work in Progress issue or pull request is currently being worked on and removed triage needs to be triaged labels May 17, 2024
@ghostwriter ghostwriter added this to the 1.6.13 milestone May 17, 2024
@ghostwriter
Copy link
Member

Hey @brettmc,

Thanks for reporting this issue.

I'm actively working on a patch on a local branch to fix this and other similar issues.

I'll provide a link to the pull request once it's ready for review.

@ghostwriter ghostwriter linked a pull request May 23, 2024 that will close this issue
@ghostwriter
Copy link
Member

Hey @brettmc,

Thanks for your patience, pull request #1427 is ready for review.

@ghostwriter ghostwriter removed the Work in Progress issue or pull request is currently being worked on label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error or unexpected behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants