Skip to content

Commit 207acf4

Browse files
committed
patched MethodArgumentSpaceFixer - formats only arguments, not every expression
Preserves this format: && (getenv('FORCE_COLOR') || (function_exists('sapi_windows_vt100_support') ? sapi_windows_vt100_support(STDOUT) : @stream_isatty(STDOUT)) // @ may trigger error 'cannot cast a filtered stream on this system' );
1 parent 71070ac commit 207acf4

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Fixer/MethodArgumentSpaceFixer.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,18 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens): void
161161
}
162162

163163
$meaningfulTokenBeforeParenthesis = $tokens[$tokens->getPrevMeaningfulToken($index)];
164-
165-
if (
166-
$meaningfulTokenBeforeParenthesis->isKeyword()
167-
&& !$meaningfulTokenBeforeParenthesis->isGivenKind($expectedTokens)
168-
) {
169-
continue;
170-
}
171-
172-
$isMultiline = $this->fixFunction($tokens, $index);
173-
174-
if (
175-
$isMultiline
176-
&& 'ensure_fully_multiline' === $this->configuration['on_multiline']
177-
&& !$meaningfulTokenBeforeParenthesis->isGivenKind(T_LIST)
178-
) {
179-
$this->ensureFunctionFullyMultiline($tokens, $index);
180-
}
164+
165+
if ($meaningfulTokenBeforeParenthesis->isGivenKind(T_STRING)) {
166+
$isMultiline = $this->fixFunction($tokens, $index);
167+
168+
if (
169+
$isMultiline
170+
&& 'ensure_fully_multiline' === $this->configuration['on_multiline']
171+
&& !$meaningfulTokenBeforeParenthesis->isGivenKind(T_LIST)
172+
) {
173+
$this->ensureFunctionFullyMultiline($tokens, $index);
174+
}
175+
}
181176
}
182177
}
183178

@@ -507,4 +502,9 @@ private function isNewline(Token $token): bool
507502
{
508503
return $token->isWhitespace() && str_contains($token->getContent(), "\n");
509504
}
505+
506+
public function getName(): string
507+
{
508+
return 'Nette/' . parent::getName();
509+
}
510510
}

0 commit comments

Comments
 (0)