Skip to content
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

Add self to HasCollection type param in Model #54311

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

thena-seer-sfg
Copy link
Contributor

Summary

Psalm is giving me this error when trying to extend the Model class.
Extended template param TModel of Illuminate\Database\Eloquent\Collection<array-key, static> expects type Illuminate\Database\Eloquent\Model, type static given (see https://psalm.dev/183)

The proposed change solves the error by indicating that whatever type resolved by static should also resolve as self AKA Model, according to the Collection template requirement.

My composer.json has:

        "php": "^8.3",
        "laravel/framework": "^11.0",
...
        "vimeo/psalm": "5.26.1",
        "psalm/plugin-laravel": "^2.11"

@taylorotwell taylorotwell merged commit 3c71a81 into laravel:11.x Jan 22, 2025
40 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.

2 participants