Skip to content

Commit

Permalink
Enhancement: Add yield from
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jun 3, 2019
1 parent c975ffe commit 9550391
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ final class SingleSpaceAfterConstructFixer extends AbstractFixer implements Conf
'return' => T_RETURN,
'throw' => T_THROW,
'yield' => T_YIELD,
'yield_from' => T_YIELD_FROM,
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,39 @@ public function provideFixWithYieldCases()
],
];
}

/**
* @requires PHP 7.0
* @dataProvider provideFixWithYieldFromCases
*
* @param string $expected
* @param null|string $input
*/
public function testFixWithYieldFrom($expected, $input = null)
{
$this->fixer->configure([
'constructs' => [
'yield_from',
],
]);

$this->doTest($expected, $input);
}

public function provideFixWithYieldFromCases()
{
return [
[
'<?php function foo() { yield from [2, 12, 13]; } ?>',
],
[
'<?php function foo() { yield from [2, 12, 13]; } ?>',
'<?php function foo() { yield from [2, 12, 13]; } ?>',
],
[
'<?php function foo() { yield from /* foo */[2, 12, 13]; } ?>',
'<?php function foo() { yield from/* foo */[2, 12, 13]; } ?>',
],
];
}
}

0 comments on commit 9550391

Please sign in to comment.