Skip to content

Commit 9abf27e

Browse files
committed
Optimize boolean conditions
1 parent 309cf6e commit 9abf27e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

MO4/Sniffs/Arrays/ArrayDoubleArrowAlignmentSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function process(File $phpcsFile, $stackPtr): void
9696
$previous = $tokens[($i - 1)];
9797

9898
// Skip nested arrays.
99-
if (true === \in_array($current['code'], $this->arrayTokens, true)) {
99+
if (\in_array($current['code'], $this->arrayTokens, true)) {
100100
$i = T_ARRAY === $current['code'] ? ($current['parenthesis_closer'] + 1) : ($current['bracket_closer'] + 1);
101101

102102
continue;
@@ -145,7 +145,7 @@ public function process(File $phpcsFile, $stackPtr): void
145145
$j = ($i - 1);
146146

147147
while (($j >= 0) && ($tokens[$j]['line'] === $current['line'])) {
148-
if (false === \in_array($tokens[$j]['code'], PHP_CodeSniffer_Tokens::$emptyTokens, true)) {
148+
if (!\in_array($tokens[$j]['code'], PHP_CodeSniffer_Tokens::$emptyTokens, true)) {
149149
$hasKeyInLine = true;
150150
}
151151

MO4/Sniffs/Formatting/AlphabeticalUseStatementsSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
8989
*/
9090
public function process(File $phpcsFile, $stackPtr): void
9191
{
92-
if (false === \in_array($this->order, self::SUPPORTED_ORDERING_METHODS, true)) {
92+
if (!\in_array($this->order, self::SUPPORTED_ORDERING_METHODS, true)) {
9393
$error = \sprintf(
9494
"'%s' is not a valid order function for %s! Pick one of: %s",
9595
$this->order,

MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function process(File $phpcsFile, $stackPtr): void
125125
foreach ($tokens[$nsSep]['comment_tags'] as $tag) {
126126
$content = $tokens[$tag]['content'];
127127

128-
if (false === \array_key_exists($content, $docCommentTags)) {
128+
if (!\array_key_exists($content, $docCommentTags)) {
129129
continue;
130130
}
131131

@@ -179,7 +179,7 @@ public function process(File $phpcsFile, $stackPtr): void
179179
// phpcs:enable
180180

181181
foreach ($typeTokens as $typeToken) {
182-
if (true === \in_array($typeToken, $useStatements, true)) {
182+
if (\in_array($typeToken, $useStatements, true)) {
183183
continue;
184184
}
185185

@@ -231,7 +231,7 @@ protected function getUseStatements(File $phpcsFile, int $start, int $end): arra
231231
true
232232
);
233233

234-
if (false === $classNameEnd) {
234+
if (!$classNameEnd) {
235235
break;
236236
}
237237

@@ -341,7 +341,7 @@ private function checkShorthandPossible(File $phpcsFile, array $useStatements, s
341341

342342
$fullClassName = $this->getFullyQualifiedClassName($className);
343343

344-
if (true === \array_key_exists($fullClassName, $useStatements)) {
344+
if (\array_key_exists($fullClassName, $useStatements)) {
345345
$replacement = $useStatements[$fullClassName];
346346

347347
$data = [

0 commit comments

Comments
 (0)