psalm
psalm copied to clipboard
`MismatchingDocblockReturnType` with `iterable|object`
I believe this should not result in a MismatchingDocblockReturnType
https://psalm.dev/r/e367d0726c
/**
* @template T
*/
interface FooInterface {
/**
* @return T|iterable<T>|null
*/
public function foo(): object|array|null;
}
Using T|array<T>|\Traversable<T>|null
also gives the same result.
I found these snippets:
https://psalm.dev/r/e367d0726c
<?php
/**
* @template T
*/
interface FooInterface {
/**
* @return T|iterable<T>|null
*/
public function foo(): object|array|null;
}
Psalm output (using commit 08afc45):
ERROR: MismatchingDocblockReturnType - 8:16 - Docblock has incorrect return type '(T:FooInterface as mixed)|(iterable<mixed, T:FooInterface as mixed>)|null', should be 'array<array-key, mixed>|null|object'