-
Notifications
You must be signed in to change notification settings - Fork 461
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
Mocking final classes reports unresolvable type by PHPStan #1411
Comments
Ilyes512
changed the title
Mocking final classes is broken with latest 2 releases
Mocking final classes reports unresolvable type by PHPStan
Apr 15, 2024
Hey @Ilyes512, You are absolutely right, that was my mistake, the doc comments were incomplete. I believe we are working on this in #1410, can you please test that branch Thank you for reporting this issue. |
ghostwriter
added
Bug
An error or unexpected behavior.
and removed
triage
needs to be triaged
labels
Apr 15, 2024
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mockery Version
1.6.11
PHP Version
PHP 8.2
Issue Description
PHPStan returns
Return type of call to static method Mockery::mock() contains unresolvable type.
when I try to mock a class that isfinal
(in this case it's also readonly, but the issue is caused by the final statement).In my PHPUnit bootstrap I setup dg\bypass-finals so it "technically" possible to create the mock. This has always worked up to and including version
1.6.9
. It's only the last 2 releases of Mockery that PHPStan started reporting the above errors.Steps to Reproduce
dg/bypass-finals
configured in PHPUnit's bootstrap file.Expected Behavior
No errors PHPStan errors
Actual Behavior
PHPStan reports on the line with
Mockery::mock()
:Exception or Error
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: