Skip to content

Commit 61fe573

Browse files
committed
Refactored conditional expressions
1 parent 19cdd3c commit 61fe573

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Fixer/AlignedMethodChainFixer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ private function findNextChain(int $search): ?int
8686

8787
private function isStartOfMultilineChain(int $idx): bool
8888
{
89-
$next = ($this->tokens[$idx + 2]->getContent() === '(') ? $this->findClosing($idx + 2) + 1 : $idx + 2;
89+
$next = $this->tokens[$idx + 2]->getContent() === '(' ? $this->findClosing($idx + 2) + 1 : $idx + 2;
9090
if ($this->tokens[$next]->isWhitespace() && $this->tokens[$next + 1]->isGivenKind(T_OBJECT_OPERATOR)) {
9191
return true;
9292
}
9393

94-
return $this->tokens[$next]->isGivenKind(T_OBJECT_OPERATOR) ? $this->isStartOfMultilineChain($next) : false;
94+
return $this->tokens[$next]->isGivenKind(T_OBJECT_OPERATOR) && $this->isStartOfMultilineChain($next);
9595
}
9696

9797
private function indentationLength(int $idx): int

src/Fixer/ArrayContext.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private function isMultipleAssign(int $firstArrow, int $lineEnd): bool
7878
$last = $this->tokens->getPrevTokenOfKind($lineEnd, [[T_DOUBLE_ARROW], [CT::T_ARRAY_SQUARE_BRACE_CLOSE]]);
7979
if ($this->tokens[$last]->isGivenKind(CT::T_ARRAY_SQUARE_BRACE_CLOSE)) {
8080
$continueFrom = $this->tokens->findBlockStart(Tokens::BLOCK_TYPE_ARRAY_SQUARE_BRACE, $last);
81-
return $continueFrom < $firstArrow ? true : $this->isMultipleAssign($firstArrow, $continueFrom);
81+
return $continueFrom < $firstArrow || $this->isMultipleAssign($firstArrow, $continueFrom);
8282
}
8383

8484
return $firstArrow !== $last;

0 commit comments

Comments
 (0)