File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
tests/PHPStan/Analyser/nsrt Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Bug11188 ;
4+
5+ use DateTime ;
6+ use function PHPStan \Testing \assertType ;
7+
8+ /**
9+ * @template TDefault of string
10+ * @template TExplicit of string
11+ *
12+ * @param TDefault $abstract
13+ * @param array<string, mixed> $parameters
14+ * @param TExplicit|null $type
15+ * @return (
16+ * $type is class-string ? new<TExplicit> :
17+ * $abstract is class-string ? new<TDefault> : mixed
18+ * )
19+ */
20+ function instance (string $ abstract , array $ parameters = [], ?string $ type = null ): mixed
21+ {
22+ return 'something ' ;
23+ }
24+
25+ function (): void {
26+ assertType (DateTime::class, instance ('cache ' , [], DateTime::class));
27+ assertType (DateTime::class, instance (DateTime::class));
28+ };
You can’t perform that action at this time.
0 commit comments