phpstan icon indicating copy to clipboard operation
phpstan copied to clipboard

Internal mixin class incorrectly generating method.internalClass errors

Open simon-tma opened this issue 7 months ago • 1 comments

Bug report

PestPHP uses functions from a mixin that is @internal. PHPStan is now flagging those method calls with method.internalClass errors despite the base class not being internal.

Example code:

        \expect($value)
            ->toBeArray()
            ->toHaveCount(3)
            ->toHaveKey('capacity')
            ->toHaveKey('space')
            ->toHaveKey('spaces');

Each method call here is now throwing:

Call to method toHaveKey() of internal class Pest\Mixins\Expectation from outside its root namespace Pest.

The playground link is a smaller version of this.

Code snippet that reproduces the problem

https://phpstan.org/r/30b85dca-0c3c-4013-aa2f-f742ccd0753e

Expected output

No errors

Did PHPStan help you today? Did it make you happy in any way?

No response

simon-tma avatar May 16 '25 00:05 simon-tma

Not sure about this, same reasoning as in https://github.com/phpstan/phpstan/issues/13021#issuecomment-2886080434

ondrejmirtes avatar May 16 '25 09:05 ondrejmirtes

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Oct 14 '25 01:10 github-actions[bot]