PHPStan reports incorrect "not covariant" for Aedart\Streams\Stream::__debugInfo()
aedart opened this issue · 1 comments
aedart commented
Description
When running PHPStan, the following error is returned:
------ -------------------------------------------------------------------------------------------------------------
Line packages/Streams/src/Stream.php
------ -------------------------------------------------------------------------------------------------------------
905 Return type array|null of method Aedart\Streams\Stream::__debugInfo() is not covariant
with return type array of method Aedart\Contracts\Streams\Stream::__debugInfo().
------ -------------------------------------------------------------------------------------------------------------
I have tried to reproduce this error in a pure class, but something else is messing up PHPStan.
Version & Environment
PHPStan version: 1.10.16
Steps to reproduce
Run composer run analyse
Expected behaviour
No errors...
Possible solution
If the array
return type is removed from the interface, PHPStan does not fail. But, that seems to be a wrong way of fixing this issue.
Furthermore, the error message cannot be ignored using ignoreErrors
.
For now, the entire file should just be ignored, until a newer version of PHPStan is released. If the error continues to persist, then a different solution must be found.
aedart commented
PHPStan released a patch that seems to have fixed this issue. Changed the min. required version of PHPStan...