phpstan-src
phpstan-src copied to clipboard
Treat array-shapes without keys as tuples
refs https://github.com/phpstan/phpstan/issues/12725
I'm a bit surprised that this single change digs up list-shapes that were previously imported from Psalm.
2) PHPStan\Analyser\NodeScopeResolverTest::testFile with data set "tests/PHPStan/Analyser/nsrt/list-shapes.php" ('/home/runner/work/phpstan-src...es.php')
Failed assertions in /home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Analyser/nsrt/list-shapes.php:
Line 21:
Expected: array{'a'}
Actual: list{'a'}
Line 22:
Expected: array{'a', 'b'}
Actual: list{'a', 'b'}
Line 23:
Expected: array{0: 'a', 1?: 'b'}
Actual: list{0: 'a', 1?: 'b'}
We tried something similar here but decided against it https://github.com/phpstan/phpstan-src/pull/3381
I don't think we should make any difference between array{int} and array{0: int}`. It should be the same thing...