Psalm version: 3.7.2
See my simplified example here: https://psalm.dev/r/8c78332c09
_Note: The psalter warning doesn't show on the website, but I can see the warning when running psalm locally_
Psalm is recommending to use the psalter with --issues=MissingParamType on a library which is 100% typed.
In my library - I have 2 similar classes:
Result<TOkay, TError>
Either<TLeft, TRight>
Under the hood of Result<TOkay, TError> is actually composed of an Either<TLeft, TRight>.
Thus, in my codebase: Result<TOkay, TError> is essentially the same as Either<TOkay, TError>
The psalter notices this and suggests changing either from Either<TLeft, TRight> -> Either<TOkay, TError>.
The psalter is not wrong with its types.
However, I want the generics on both classes as both are public in my library.
The types are generic so they support more use cases than the ones limited to my library src. This allows consumers to type-check against my library.
The real problem is psalm notices I could be more strict given only my library src.
I have a library: https://github.com/iFixit/php7-optional
This master build is recommending to use the psalter with --alter --issues=MissingParamType --dry-run
Thanks! It was just a bug around erroneously fixing templated params that default to mixed.
Ah, that makes sense! Thanks @muglug for the fast fix
Most helpful comment
Thanks! It was just a bug around erroneously fixing templated params that default to
mixed.