Skip to content

Commit c42ae64

Browse files
committed
[Php70] Handle return ternary on IfIssetToCoalescingRector
1 parent 9f4509d commit c42ae64

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Rector\Tests\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector\Fixture;
4+
5+
class WithTernaryReturn
6+
{
7+
private $values = [];
8+
private $nullable = false;
9+
10+
public function resolve($param)
11+
{
12+
if (isset($this->values[$param])) {
13+
return $this->values[$param];
14+
}
15+
16+
return $this->nullable ? null : false;
17+
}
18+
}
19+
20+
?>
21+
-----
22+
<?php
23+
24+
namespace Rector\Tests\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector\Fixture;
25+
26+
class WithTernaryReturn
27+
{
28+
private $values = [];
29+
private $nullable = false;
30+
31+
public function resolve($param)
32+
{
33+
return $this->values[$param] ?? ($this->nullable ? null : false);
34+
}
35+
}
36+
37+
?>

0 commit comments

Comments
 (0)