Skip to content

Commit 29b2d1c

Browse files
committed
Cleanup
1 parent a32f46c commit 29b2d1c

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

SlevomatCodingStandard/Helpers/ArrayKeyValue.php

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -128,29 +128,42 @@ private function addValues(File $phpcsFile): void
128128

129129
if ($token['code'] === T_DOUBLE_ARROW) {
130130
$this->pointerArrow = $i;
131-
} elseif ($token['code'] === T_COMMA) {
131+
continue;
132+
}
133+
134+
if ($token['code'] === T_COMMA) {
132135
$this->pointerComma = $i;
133-
} elseif ($token['code'] === T_ELLIPSIS) {
136+
continue;
137+
138+
}
139+
140+
if ($token['code'] === T_ELLIPSIS) {
134141
$this->unpacking = true;
135-
} elseif ($this->pointerArrow === null) {
136-
if (array_key_exists('scope_closer', $token) && $token['scope_closer'] > $i) {
137-
$key .= TokenHelper::getContent($phpcsFile, $i, $token['scope_closer']);
138-
$i = $token['scope_closer'];
139-
continue;
140-
}
141-
142-
if (array_key_exists('parenthesis_closer', $token)) {
143-
$key .= TokenHelper::getContent($phpcsFile, $i, $token['parenthesis_closer']);
144-
$i = $token['parenthesis_closer'];
145-
continue;
146-
}
147-
148-
if ($firstNonWhitespace === null && $token['code'] !== T_WHITESPACE) {
149-
$firstNonWhitespace = $i;
150-
}
151-
if (in_array($token['code'], TokenHelper::$inlineCommentTokenCodes, true) === false) {
152-
$key .= $token['content'];
153-
}
142+
continue;
143+
}
144+
145+
if ($this->pointerArrow !== null) {
146+
continue;
147+
}
148+
149+
if (array_key_exists('scope_closer', $token) && $token['scope_closer'] > $i) {
150+
$key .= TokenHelper::getContent($phpcsFile, $i, $token['scope_closer']);
151+
$i = $token['scope_closer'];
152+
continue;
153+
}
154+
155+
if (array_key_exists('parenthesis_closer', $token)) {
156+
$key .= TokenHelper::getContent($phpcsFile, $i, $token['parenthesis_closer']);
157+
$i = $token['parenthesis_closer'];
158+
continue;
159+
}
160+
161+
if ($firstNonWhitespace === null && $token['code'] !== T_WHITESPACE) {
162+
$firstNonWhitespace = $i;
163+
}
164+
165+
if (in_array($token['code'], TokenHelper::$inlineCommentTokenCodes, true) === false) {
166+
$key .= $token['content'];
154167
}
155168
}
156169
$haveIndent = $firstNonWhitespace !== null && TokenHelper::findFirstNonWhitespaceOnLine(

0 commit comments

Comments
 (0)