phpstan icon indicating copy to clipboard operation
phpstan copied to clipboard

ConstantArrayType is not accepted into ConstantArrayType with the same description

Open mvorisek opened this issue 2 years ago • 2 comments

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 avatar Apr 14 '24 11:04 mvorisek

@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'}

phpstan-bot avatar Oct 07 '24 16:10 phpstan-bot

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[bot] avatar Nov 08 '24 01:11 github-actions[bot]