Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic.Formatting.MultipleStatementAlignment does see PHP close tag as end of statement block #2018

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ public function checkAlignment($phpcsFile, $stackPtr)
break;
}

if ($tokens[$assign]['code'] === T_CLOSE_TAG) {
// Breaking out of PHP ends the assignment block.
break;
}

if ($tokens[$assign]['code'] === T_OPEN_SHORT_ARRAY
&& isset($tokens[$assign]['bracket_closer']) === true
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,17 @@ $foo = [
$abc = 'something';
if ($foo) {}
$defghi = 'longer something';

public function get_location_details( $location_id, $atts ) {
$coords_lat = 'abc';
$coords_long = 'def';
?>

<div>
<?php
$location = 'ghi';
$other_location = 'jkl';
?>
</div>
<?php
}
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,17 @@ $foo = [
$abc = 'something';
if ($foo) {}
$defghi = 'longer something';

public function get_location_details( $location_id, $atts ) {
$coords_lat = 'abc';
$coords_long = 'def';
?>

<div>
<?php
$location = 'ghi';
$other_location = 'jkl';
?>
</div>
<?php
}