Skip to content

Commit 8c09939

Browse files
rodrigoprimojrfnl
authored andcommitted
Generic/DisallowLongArraySyntax: simplify if statement
This commit uses a single isset() to check if two variables are set instead of using two isset() calls.
1 parent a0c505e commit 8c09939

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ public function process(File $phpcsFile, $stackPtr)
4545

4646
$error = 'Short array syntax must be used to define arrays';
4747

48-
if (isset($tokens[$stackPtr]['parenthesis_opener']) === false
49-
|| isset($tokens[$stackPtr]['parenthesis_closer']) === false
50-
) {
48+
if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) {
5149
// Live coding/parse error, just show the error, don't try and fix it.
5250
$phpcsFile->addError($error, $stackPtr, 'Found');
5351
return;

0 commit comments

Comments
 (0)