phpstan
phpstan copied to clipboard
ConstantArrayType is not accepted into ConstantArrayType with the same description
Bug report
There is some internal issue. In the repro, all types are the same.
Even more interesting - when the type is defined manually (uncomment the l35 to reproduce) - the issue is gone.
Code snippet that reproduces the problem
https://phpstan.org/r/850078c3-6db8-41a7-a888-bc5d7517e8fe
Expected output
no phpstan error
@mvorisek After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
@@ @@
34: Dumped type: array{foo: 'x', 2: 'x'}
-36: Dumped type: array{foo: 'x', 2: 'x'}
-39: Parameter #1 $expected of static method HelloWorld::assertSame() expects array{foo: 'x', 2: 'x'}, array{foo: 'x', 2: 'x'} given.
+36: Dumped type: array{foo: 'x', 2: 'x'}
Full report
| Line | Error |
|---|---|
| 34 | Dumped type: array{foo: 'x', 2: 'x'} |
| 36 | Dumped type: array{foo: 'x', 2: 'x'} |
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.