Commit effad95 1 parent e76f64e commit effad95 Copy full SHA for effad95
File tree 3 files changed +39
-5
lines changed
3 files changed +39
-5
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,14 @@ function (ParameterReflectionWithPhpDocs $param): ParameterReflectionWithPhpDocs
84
84
85
85
$ paramOutType = $ param ->getOutType ();
86
86
if ($ paramOutType !== null ) {
87
- $ paramOutType = TemplateTypeHelper::resolveTemplateTypes (
88
- $ paramOutType ,
89
- $ this ->resolvedTemplateTypeMap ,
90
- $ this ->callSiteVarianceMap ,
91
- TemplateTypeVariance::createCovariant (),
87
+ $ paramOutType = TypeUtils::resolveLateResolvableTypes (
88
+ TemplateTypeHelper::resolveTemplateTypes (
89
+ $ this ->resolveConditionalTypesForParameter ($ paramOutType ),
90
+ $ this ->resolvedTemplateTypeMap ,
91
+ $ this ->callSiteVarianceMap ,
92
+ TemplateTypeVariance::createCovariant (),
93
+ ),
94
+ false ,
92
95
);
93
96
}
94
97
Original file line number Diff line number Diff line change @@ -333,6 +333,7 @@ public function dataFileAsserts(): iterable
333
333
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-4500.php ' );
334
334
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-4504.php ' );
335
335
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-4436.php ' );
336
+ yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-10699.php ' );
336
337
yield from $ this ->gatherAssertTypes (__DIR__ . '/../Rules/Properties/data/bug-3777.php ' );
337
338
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-2549.php ' );
338
339
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/bug-1945.php ' );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Bug10699 ;
4
+
5
+ use function PHPStan \Testing \assertType ;
6
+
7
+ /**
8
+ * @param int $flags
9
+ * @param mixed $out
10
+ *
11
+ * @param-out ($flags is 2 ? 20 : 10) $out
12
+ *
13
+ * @return ($flags is 2 ? 20 : 10)
14
+ */
15
+ function test (int $ flags , &$ out ): int
16
+ {
17
+ $ out = $ flags === 2 ? 20 : 10 ;
18
+
19
+ return $ out ;
20
+ }
21
+
22
+ function (): void {
23
+ $ res = test (1 , $ out );
24
+ assertType ('10 ' , $ res );
25
+ assertType ('10 ' , $ out );
26
+
27
+ $ res = test (2 , $ out );
28
+ assertType ('20 ' , $ res );
29
+ assertType ('20 ' , $ out );
30
+ };
You can’t perform that action at this time.
0 commit comments