Skip to content

Fix list description with offset required#5212

Merged
VincentLanglet merged 1 commit intophpstan:2.1.xfrom
VincentLanglet:makeOffsetRequired
Mar 12, 2026
Merged

Fix list description with offset required#5212
VincentLanglet merged 1 commit intophpstan:2.1.xfrom
VincentLanglet:makeOffsetRequired

Conversation

@VincentLanglet
Copy link
Contributor

Now #5067 is merged, it allows this.

public function testList(array $b): void
{
if (array_key_exists(3, $b)) {
assertType('list{0: string, 1: string, 2?: string, 3: string}', $b);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since 3 is required, 2 shouldn't be described as optional.

@VincentLanglet VincentLanglet force-pushed the makeOffsetRequired branch 2 times, most recently from 3a3b2c9 to f25ff73 Compare March 12, 2026 16:25
@VincentLanglet VincentLanglet marked this pull request as ready for review March 12, 2026 17:13
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@VincentLanglet VincentLanglet requested a review from staabm March 12, 2026 17:13
@VincentLanglet VincentLanglet merged commit 9e4186e into phpstan:2.1.x Mar 12, 2026
642 of 652 checks passed
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