Skip to content

Commit 6a11a7f

Browse files
committed
Improve Mapper::map PHPStan annotation
1 parent 707ab6a commit 6a11a7f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/Valinor/Mapper.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,18 @@ public function allowSuperfluousKeys(): self
4545
}
4646

4747
/**
48-
* @template T
49-
* @param class-string<T> $signature
48+
* @template T of object
49+
*
50+
* @param string|class-string<T> $signature
5051
*
5152
* @throws InvalidArgumentException
5253
*
54+
* @phpstan-return (
55+
* $signature is class-string<T>
56+
* ? T
57+
* : ($signature is class-string ? object : mixed)
58+
* )
59+
*
5360
* @return T
5461
*/
5562
public function map(string $signature, mixed $source): mixed

0 commit comments

Comments
 (0)