You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@return static<...> arguments are applied by position to the called subclass instead of projected through @extends #13988
Prefixed<float, string, bool>, declared @extends Base<TA2, TB2>, is Base<string, bool>. withIntB() gives Trace: $r: Prefixed<string, int>&static. That drops TZ and has 2 type arguments for a 3-template class.
Psalm applies the resolved arguments of static<...> by position to the template list of the class it is called on.
What you expected
The arguments of static<...> belong to the declaring class's templates, so they should be projected onto the called class through its @extends mapping:
Swapped<int, string> (TX is TB, so int; TY is TA, so string)
Prefixed<float, string, int> (TZ stays float)
An overriding method's inherited return type is projected the same positional way: an override withIntB(): static { return $this; } in Swapped gets the declared return Swapped<TY, int> instead of Swapped<int, TY>.
Psalm version, PHP version
psalm.dev dev-master@7f128f6cd, PHP 8.3; also dev-master@7b7e53e1a locally, PHP 8.5.
Impact
psalm/psalm-plugin-laravel has to build Laravel's factory count() result in a return type provider, mapping the subclass's template arguments by hand (psalm/psalm-plugin-laravel#1625). A stub declaring @return static<TModel, ...> would mis-type every user factory subclass whose template list differs from Factory<TModel, TCount>.
Activity
psalm-github-bot commentedon Nov 16, 2026
I found these snippets:
https://psalm.dev/r/747a6e8dc8
fix: map trait-declared and intersection static<...> arguments correc…