Skip to content

Commit

Permalink
PHP 8.0 | Generic.CodeAnalysis.EmptyPHPStatement: add support for match
Browse files Browse the repository at this point in the history
  • Loading branch information
javer committed Mar 17, 2021
1 parent ef0273a commit b05f769
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function process(File $phpcsFile, $stackPtr)
}

$scopeOwner = $tokens[$tokens[$prevNonEmpty]['scope_condition']]['code'];
if ($scopeOwner === T_CLOSURE || $scopeOwner === T_ANON_CLASS) {
if ($scopeOwner === T_CLOSURE || $scopeOwner === T_ANON_CLASS || $scopeOwner === T_MATCH) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ echo $a{0};
if ($foo) {
;
}

// Do not remove semicolon after match
$c = match ($a) {
1 => true,
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ echo $a{0};

if ($foo) {
}

// Do not remove semicolon after match
$c = match ($a) {
1 => true,
};

0 comments on commit b05f769

Please sign in to comment.