-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
ArrayAccess mixed contravariant false positive #4854
Comments
Same here:
PHPStan does not access the php core types. |
@sgc-fireball Yours is a completely different problem, please open a separate issue for that, thanks. |
@soullivaneuh After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-36: Parameter #1 $offset (int|null) of method App\Registrar\DomainsAvailability\AbstractDomainsAvailability::offsetSet() should be contravariant with parameter $offset (mixed) of method ArrayAccess<mixed,mixed>::offsetSet()
-36: Parameter #2 $value (int) of method App\Registrar\DomainsAvailability\AbstractDomainsAvailability::offsetSet() should be contravariant with parameter $value (mixed) of method ArrayAccess<mixed,mixed>::offsetSet()
-48: Parameter #1 $offset (int) of method App\Registrar\DomainsAvailability\AbstractDomainsAvailability::offsetExists() should be contravariant with parameter $offset (mixed) of method ArrayAccess<mixed,mixed>::offsetExists()
-56: Parameter #1 $offset (int) of method App\Registrar\DomainsAvailability\AbstractDomainsAvailability::offsetUnset() should be contravariant with parameter $offset (mixed) of method ArrayAccess<mixed,mixed>::offsetUnset()
-64: Parameter #1 $offset (int) of method App\Registrar\DomainsAvailability\AbstractDomainsAvailability::offsetGet() should be contravariant with parameter $offset (mixed) of method ArrayAccess<mixed,mixed>::offsetGet()
+No errors |
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. |
Bug report
I use
@extends
keyword onArrayAccess
to have a better type checking with PHPStan.It looks to recognize it, but want the parameters to be contravariant with the native
ArrayAccess
native class methods.However, if this not a bug, I don't see how this should be resolved. 🤔
Code snippet that reproduces the problem
https://phpstan.org/r/f3a9c0d9-96b4-4b97-8c00-d908147465c3
Expected output
No error?
The text was updated successfully, but these errors were encountered: