-
Couldn't load subscription status.
- Fork 544
Treat array-shapes without keys as tuples #3872
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
Draft
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@zonuexe
zonuexe
changed the title
(削除) Impl keyless array-shapes as Tuple (削除ここまで)
(追記) Treat array-shapes without keys as tuples (追記ここまで)
Mar 11, 2025
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'}
@zonuexe
zonuexe
force-pushed
the
feature/keyless-constant-as-tuple
branch
from
March 11, 2025 12:42
dbc452f to
c044612
Compare
We tried something similar here but decided against it #3381
I don't think we should make any difference between array{int} and array{0: int}`. It should be the same thing...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
refs phpstan/phpstan#12725