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

Bogus error when assigning to offset of ArrayObject<array<something>> #6398

Open
dktapps opened this issue Jan 17, 2022 · 7 comments
Open

Bogus error when assigning to offset of ArrayObject<array<something>> #6398

dktapps opened this issue Jan 17, 2022 · 7 comments
Labels
Milestone

Comments

@dktapps
Copy link
Contributor

dktapps commented Jan 17, 2022

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/fbafd268-227e-401e-9a26-47fcc9d8541f

Expected output

No error should be reported.

@ondrejmirtes ondrejmirtes added this to the Generics milestone Feb 1, 2022
@phpstan-bot
Copy link
Contributor

@dktapps After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-PHP 7.2 – 8.1 (1 error)
+PHP 7.2 – 8.1 (2 errors)
 ==========
 
+14: Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>|null) does not accept ArrayObject<(int|string), mixed>.
 16: Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>|null) does not accept non-empty-array<int, non-empty-array<string, mixed>>|ArrayObject<int, array<string, mixed>>.
 
-PHP 7.1 (3 errors)
+PHP 7.1 (4 errors)
 ==========
 
+14: Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>|null) does not accept ArrayObject<(int|string), mixed>.
 16: Function spl_object_id not found.
 16: Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>|null) does not accept non-empty-array<int|string, non-empty-array<string, mixed>>|ArrayObject<int, array<string, mixed>>.
 23: Function spl_object_id not found.
Full report

PHP 7.2 – 8.1 (2 errors)

Line Error
14 `Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>
16 `Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>

PHP 7.1 (4 errors)

Line Error
14 `Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>
16 Function spl_object_id not found.
16 `Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>
23 Function spl_object_id not found.

@dktapps
Copy link
Contributor Author

dktapps commented Feb 27, 2022

welp

@ondrejmirtes
Copy link
Member

Relaxed it a bit: phpstan/phpstan-src@089d4c6

@dktapps
Copy link
Contributor Author

dktapps commented Mar 7, 2022

why is that change exclusive to bleeding-edge?

@ondrejmirtes
Copy link
Member

Because it's a new and stricter behaviour that will be enabled for everyone in PHPStan 2.0.

@ondrejmirtes
Copy link
Member

@phpstan-bot
Copy link
Contributor

@dktapps After the latest push in 1.11.x, PHPStan now reports different result with your code snippet:

@@ @@
-PHP 7.2 – 8.1 (1 error)
-==========
-
-16: Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>|null) does not accept non-empty-array<int, non-empty-array<string, mixed>>|ArrayObject<int, array<string, mixed>>.
-
-PHP 7.1 (3 errors)
-==========
-
-16: Function spl_object_id not found.
-16: Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>|null) does not accept non-empty-array<int|string, non-empty-array<string, mixed>>|ArrayObject<int, array<string, mixed>>.
-23: Function spl_object_id not found.
+16: Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>|null) does not accept non-empty-array<int, non-empty-array<string, mixed>>|ArrayObject<int, array<string, mixed>>.
Full report
Line Error
16 `Static property AsyncTask::$threadLocalStorage (ArrayObject<int, array<string, mixed>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants