Skip to content

Commit 287afe2

Browse files
committed
handle yield from
1 parent dbcbead commit 287afe2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Fixer/FunctionNotation/VoidReturnFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private function hasVoidReturn(Tokens $tokens, $startIndex, $endIndex)
200200
continue;
201201
}
202202

203-
if ($tokens[$i]->isGivenKind(T_YIELD)) {
203+
if ($tokens[$i]->isGivenKind([T_YIELD, T_YIELD_FROM])) {
204204
return false; // Generators cannot return void.
205205
}
206206

tests/Fixer/FunctionNotation/VoidReturnFixerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function provideFixCases()
4545
['<?php function foo($param) { return null; }'],
4646
['<?php function foo($param) { yield; }'],
4747
['<?php function foo($param) { yield $param; }'],
48+
['<?php function foo($param) { yield from test(); }'],
4849
['<?php function foo($param): Void {}'],
4950
['<?php interface Test { public function foo($param); }'],
5051
['<?php function foo($param) { return function($a) use ($param): string {}; }'],

0 commit comments

Comments
 (0)