Skip to content

Conversation

@kbond
Copy link
Member

@kbond kbond commented Jul 4, 2025

Note

This is only a BC break for static analysis.

Since 90+% of the time, you don't really care about the key when using Collection, I've swapped the @template for these two values and used PHPStan's default template type (as array-key) for the key:

Before:

@return Collection<array-key,object>

After:

@return Collection<object>

If you still want to define the key, it's the second template:

@return Collection<object,int>

@kbond kbond merged commit 7c9bd0e into zenstruck:1.x Jul 4, 2025
18 checks passed
@kbond kbond deleted the phpstan-improvements branch July 4, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant