fix: TrailingCommaInMultilineFixer
- handle trailing comma in language constructs
#9522
Annotations
2 warnings
PHP 8.3 mutation tests:
src/Fixer/ControlStructure/TrailingCommaInMultilineFixer.php#L156
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$this->fixBlock($tokens, $index);
continue;
}
- if ($fixParameters && ($tokens[$prevIndex]->isGivenKind(T_STRING) && $tokens[$prevPrevIndex]->isGivenKind(T_FUNCTION) || $tokens[$prevIndex]->isGivenKind([T_FN, T_FUNCTION, T_ISSET, T_UNSET, T_LIST]))) {
+ if ($fixParameters && ($tokens[$prevIndex]->isGivenKind(T_STRING) || $tokens[$prevPrevIndex]->isGivenKind(T_FUNCTION) || $tokens[$prevIndex]->isGivenKind([T_FN, T_FUNCTION, T_ISSET, T_UNSET, T_LIST]))) {
$this->fixBlock($tokens, $index);
}
if ($fixMatch && $tokens[$prevIndex]->isGivenKind(T_MATCH)) {
|
PHP 8.3 mutation tests:
src/Fixer/ControlStructure/TrailingCommaInMultilineFixer.php#L156
Escaped Mutant for Mutator "LogicalOrAllSubExprNegation":
--- Original
+++ New
@@ @@
$this->fixBlock($tokens, $index);
continue;
}
- if ($fixParameters && ($tokens[$prevIndex]->isGivenKind(T_STRING) && $tokens[$prevPrevIndex]->isGivenKind(T_FUNCTION) || $tokens[$prevIndex]->isGivenKind([T_FN, T_FUNCTION, T_ISSET, T_UNSET, T_LIST]))) {
+ if ($fixParameters && (!($tokens[$prevIndex]->isGivenKind(T_STRING) && $tokens[$prevPrevIndex]->isGivenKind(T_FUNCTION)) || !$tokens[$prevIndex]->isGivenKind([T_FN, T_FUNCTION, T_ISSET, T_UNSET, T_LIST]))) {
$this->fixBlock($tokens, $index);
}
if ($fixMatch && $tokens[$prevIndex]->isGivenKind(T_MATCH)) {
|