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

Return type (int) of method SomeClass::count() should be covariant with return type (int<0, max>) of method Countable::count() #3997

Closed
snapshotpl opened this issue Oct 24, 2020 · 3 comments

Comments

@snapshotpl
Copy link

Bug report

After update to 0.12.51 all my classes with implemented Countable report issue:

Return type (int) of method SomeClass::count() should be covariant with return type (int<0, max>) of method Countable::count()

It appear when strict mode it's enabled.

Code snippet that reproduces the problem

https://phpstan.org/r/02ca7893-6eb0-4318-9e74-5a6a0e0d5d2f

Expected output

No error or idea how to resolve this.

@dktapps
Copy link
Contributor

dktapps commented Oct 24, 2020

This works as a workaround: https://phpstan.org/r/2073aeda-dd5f-4af2-b403-9733c3117817

but I would expect this to be inherited from Countable's PHPDoc, like it is for any userland interface... https://phpstan.org/r/da649756-6fd9-4b6f-8787-4274532e48d0

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@fb8d3ef

@github-actions
Copy link

github-actions bot commented May 9, 2021

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 github-actions bot locked as resolved and limited conversation to collaborators May 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants