Skip to content

Commit 877cbf6

Browse files
committed
Update type-specifier-context-return-type.php
1 parent 0b4b6cb commit 877cbf6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/PHPStan/Analyser/data/type-specifier-context-return-type.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class ContextReturnType {
88
public function returnsInt(int $specifiedContextReturnType): int {}
99

10-
public function doFoo(int $i) {
10+
public function doFooLeft(int $i) {
1111
assertType('int', $i);
1212
if ($this->returnsInt($i) > 0) {
1313
assertType('int<1, max>', $i);
@@ -16,4 +16,14 @@ public function doFoo(int $i) {
1616
}
1717
assertType('int', $i);
1818
}
19+
20+
public function doFooRight(int $i) {
21+
assertType('int', $i);
22+
if (0 < $this->returnsInt($i)) {
23+
assertType('int<1, max>', $i);
24+
} else {
25+
assertType('int<min, 0>', $i);
26+
}
27+
assertType('int', $i);
28+
}
1929
}

0 commit comments

Comments
 (0)