Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
zonuexe wants to merge 4 commits into phpstan:2.1.x
base: 2.1.x
Choose a base branch
Loading
from zonuexe:feature/keyless-constant-as-tuple

Conversation

@zonuexe
Copy link
Contributor

@zonuexe zonuexe commented Mar 11, 2025
edited
Loading

@zonuexe zonuexe marked this pull request as draft March 11, 2025 11:52
@zonuexe zonuexe changed the title (削除) Impl keyless array-shapes as Tuple (削除ここまで) (追記) Treat array-shapes without keys as tuples (追記ここまで) Mar 11, 2025
Copy link
Contributor Author

zonuexe commented 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 dbc452f to c044612 Compare March 11, 2025 12:42
Copy link
Member

We tried something similar here but decided against it #3381

Copy link
Member

I don't think we should make any difference between array{int} and array{0: int}`. It should be the same thing...

mvorisek reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /