Skip to content

Describe Ds\Vector::toArray() as a list - #7123

Merged
staabm merged 1 commit into
phpstan:2.3.xfrom
simPod:fix/ext-ds-vector-list
Nov 22, 2026
Merged

staabm merged 1 commit into
phpstan:2.3.xfrom
simPod:fix/ext-ds-vector-list

Conversation

@simPod

@simPod simPod commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

The ext-ds v1 stub gives Ds\Vector::toArray() the inherited array<int, TValue> return type. A vector returns its values in order with consecutive keys starting at zero, so this can be more precise.

Declare list<TValue> in PHPStan’s ext-ds v1 stub and add an inference assertion for Vector<int>::toArray(). The ext-ds v2 stub is unchanged.

AI Harness

OpenCode session: ses_f367a394bffe1ioqqBqiCEcwyO

@simPod
simPod marked this pull request as ready for review November 22, 2026 11:07
@phpstan-bot

Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

@staabm
staabm merged commit 1b20a17 into phpstan:2.3.x Nov 22, 2026
907 of 914 checks passed
@staabm

staabm commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants