Skip to content

Commit

Permalink
bug #4830 TernaryToNullCoalescingFixer - handle yield from (SpacePossum)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.15 branch.

Discussion
----------

TernaryToNullCoalescingFixer - handle yield from

Commits
-------

c07a1e1 TernaryToNullCoalescingFixer - handle yield from
  • Loading branch information
SpacePossum committed Feb 20, 2020
2 parents 25fa900 + c07a1e1 commit d51dd1e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Fixer/Operator/TernaryToNullCoalescingFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ private function hasChangingContent(Tokens $tokens)
T_INC,
T_STRING,
T_YIELD,
T_YIELD_FROM,
];

foreach ($tokens as $token) {
Expand Down
1 change: 1 addition & 0 deletions tests/Fixer/Operator/TernaryToNullCoalescingFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function provideFixCases()
['<?php $x = isset($a[foo()]) ? $a[foo()] : null;'],
['<?php $x = isset($a[$callback()]) ? $a[$callback()] : null;'],
['<?php $y = isset($a) ? 2**3 : 3**2;'],
['<?php $x = function(){isset($a[yield from $a]) ? $a[yield from $a] : null;};'],
// Fix cases.
'Common fix case (I).' => [
'<?php $x = $a ?? null;',
Expand Down

0 comments on commit d51dd1e

Please sign in to comment.