Skip to content

Commit

Permalink
Generic/DisallowSpaceIndent: add test with multi-line yield from
Browse files Browse the repository at this point in the history
As the indentation whitespace in a multi-line `yield from` expression is now tokenized as `T_WHITESPACE`, instead of being tokenized as part of the (second) `T_YIELD_FROM` token, space indentation of such a line will now be handled correctly by the sniff.

This commit just adds a test to confirm and safeguard this.
  • Loading branch information
jrfnl committed Oct 25, 2024
1 parent 7e69205 commit f3985c7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ $x = 1;
Another line.
*/

// A `yield from` can be multiline and may contain spaces in the indentation whitespace between the keywords.
function myGenerator() {
yield
from
gen2();
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ $x = 1;

Another line.
*/

// A `yield from` can be multiline and may contain spaces in the indentation whitespace between the keywords.
function myGenerator() {
yield
from
gen2();
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ $x = 1;
Another line.
*/

// A `yield from` can be multiline and may contain spaces in the indentation whitespace between the keywords.
function myGenerator() {
yield
from
gen2();
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,10 @@ $x = 1;

Another line.
*/

// A `yield from` can be multiline and may contain spaces in the indentation whitespace between the keywords.
function myGenerator() {
yield
from
gen2();
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function getErrorList($testFile='')
115 => 1,
117 => 1,
118 => 1,
123 => 1,
];

case 'DisallowSpaceIndentUnitTest.3.inc':
Expand Down

0 comments on commit f3985c7

Please sign in to comment.