https://psalm.dev/r/7855aed71f
```php
*/
public static function type1(): self {
return new self(self::TYPE1, 'some-string');
}
}
```
```
Psalm output (using commit faad966):
No issues!
```
https://psalm.dev/r/d5cb90384d
```php
*/
public static function type1(): self {
return new self('some-string', self::TYPE1);
}
}
```
```
Psalm output (using commit faad966):
INFO: MixedReturnTypeCoercion - 23:16 - The type 'SomeTemplatedClass<'type1'|mixed>' is more general than the declared return type 'SomeTemplatedClass<'type1'>' for SomeTemplatedClass::type1
INFO: MixedReturnTypeCoercion - 20:16 - The declared return type 'SomeTemplatedClass<'type1'>' for SomeTemplatedClass::type1 is more specific than the inferred return type 'SomeTemplatedClass<'type1'|mixed>'
```
This works ok: https://psalm.dev/r/7855aed71f But if the constructor parameters are reversed, then it's not ok anymore: https://psalm.dev/r/d5cb90384d
I expect in both scenarios to not have issues. The problem exists in versions >=4.9.0
Also, cannot reproduce anymore if type of
$someParam
is?string
, so maybe that conditional type is part of the fault.