You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a project that uses PHPUnit and Psalm, Psalm detects the issue in PHPUnit that cannot be fixed in the project and therefore has to be suppressed.
Current behavior
ERROR: InternalMethod - tests/ExampleTest.php:17:12 - The method
PHPUnit\Framework\MockObject\Builder\InvocationMocker::method has been marked as internal
(see https://psalm.dev/175)
)->method('test');
The above is caused by the interface returning a class marked as @internal:
@ostrolucky, thanks for the pointer. I thought of adding an interface that extends InvocationStubber and MethodNameMatch. Then, instead of returning an InvocationMocker, the method could return an instance of that interface.
But just removing @internal may be an acceptable short-term solution.
Summary
In a project that uses PHPUnit and Psalm, Psalm detects the issue in PHPUnit that cannot be fixed in the project and therefore has to be suppressed.
Current behavior
The above is caused by the interface returning a class marked as
@internal
:phpunit/src/Framework/MockObject/MockObject.php
Line 24 in 7f664ff
phpunit/src/Framework/MockObject/Builder/InvocationMocker.php
Lines 29 to 32 in cb13599
This issue was already brought up in #3742 (comment).
How to reproduce
See the full demo project in the gist:
Since the project's tests extend and use the PHPUnit test classes, suppressing errors in the
vendor/
directory doesn't help.Expected behavior
PHPUnit doesn't expose the internal parts of its API to the userland.
The text was updated successfully, but these errors were encountered: