Skip to content

Commit dac2971

Browse files
committed
Remove useless parentheses
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
1 parent 9d3d3b3 commit dac2971

14 files changed

Lines changed: 20 additions & 22 deletions

File tree

src/Components/AlterOperation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
318318
public static function build($component, array $options = [])
319319
{
320320
$ret = $component->options . ' ';
321-
if ((isset($component->field)) && ($component->field !== '')) {
321+
if (isset($component->field) && ($component->field !== '')) {
322322
$ret .= $component->field . ' ';
323323
}
324324
$ret .= TokensList::build($component->unknown);

src/Components/ArrayObj.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
160160
// (a) => array('a')
161161
//
162162
$lastRaw = trim($lastRaw);
163-
if ((empty($options['type']))
163+
if (empty($options['type'])
164164
&& ((strlen($lastRaw) > 0) || ($isCommaLast))
165165
) {
166166
$ret->raw[] = $lastRaw;

src/Components/DataType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
136136
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
137137
$parameters = ArrayObj::parse($parser, $list);
138138
++$list->idx;
139-
$ret->parameters = (($ret->name === 'ENUM') || ($ret->name === 'SET')) ?
139+
$ret->parameters = ($ret->name === 'ENUM') || ($ret->name === 'SET') ?
140140
$parameters->raw : $parameters->values;
141141
}
142142
$ret->options = OptionsArray::parse($parser, $list, static::$DATA_TYPE_OPTIONS);

src/Components/Key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
161161
if ($token->value === '(') {
162162
$state = 3;
163163
} elseif (($token->value === ',') || ($token->value === ')')) {
164-
$state = ($token->value === ',') ? 2 : 4;
164+
$state = $token->value === ',' ? 2 : 4;
165165
if (! empty($lastColumn)) {
166166
$ret->columns[] = $lastColumn;
167167
$lastColumn = [];

src/Components/OptionsArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public static function build($component, array $options = [])
288288
$options[] = $option;
289289
} else {
290290
$options[] = $option['name']
291-
. ((! empty($option['equals']) && $option['equals']) ? '=' : ' ')
291+
. (! empty($option['equals']) && $option['equals'] ? '=' : ' ')
292292
. (! empty($option['expr']) ? $option['expr'] : $option['value']);
293293
}
294294
}

src/Components/PartitionDefinition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public static function build($component, array $options = [])
247247
return trim(
248248
'PARTITION ' . $component->name
249249
. (empty($component->type) ? '' : ' VALUES ' . $component->type . ' ' . $component->expr . ' ')
250-
. ((! empty($component->options) && ! empty($component->type)) ? '' : ' ') . $component->options . $subpartitions
250+
. (! empty($component->options) && ! empty($component->type) ? '' : ' ') . $component->options . $subpartitions
251251
);
252252
}
253253
}

src/Context.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public static function isComment($str, $end = false)
339339
if ($str[0] === '#') {
340340
return Token::FLAG_COMMENT_BASH;
341341
} elseif (($len > 1) && ($str[0] === '/') && ($str[1] === '*')) {
342-
return (($len > 2) && ($str[2] === '!')) ?
342+
return ($len > 2) && ($str[2] === '!') ?
343343
Token::FLAG_COMMENT_MYSQL_CMD : Token::FLAG_COMMENT_C;
344344
} elseif (($len > 1) && ($str[0] === '*') && ($str[1] === '/')) {
345345
return Token::FLAG_COMMENT_C;
@@ -385,7 +385,7 @@ public static function isBool($str)
385385
*/
386386
public static function isNumber($str)
387387
{
388-
return (($str >= '0') && ($str <= '9')) || ($str === '.')
388+
return ($str >= '0') && ($str <= '9') || ($str === '.')
389389
|| ($str === '-') || ($str === '+') || ($str === 'e') || ($str === 'E');
390390
}
391391

src/Statement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public function validateClauseOrder($parser, $list)
552552
$minIdx = $clauseStartIdx;
553553
}
554554

555-
$lastIdx = ($clauseStartIdx !== -1) ? $clauseStartIdx : $lastIdx;
555+
$lastIdx = $clauseStartIdx !== -1 ? $clauseStartIdx : $lastIdx;
556556
}
557557

558558
return true;

src/Statements/CreateStatement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ public function parse(Parser $parser, TokensList $list)
622622
}
623623

624624
// Building the expression used for partitioning.
625-
$this->$field .= ($token->type === Token::TYPE_WHITESPACE) ? ' ' : $token->token;
625+
$this->$field .= $token->type === Token::TYPE_WHITESPACE ? ' ' : $token->token;
626626

627627
// Last bracket was read, the expression ended.
628628
// Comparing with `0` and not `false`, because `false` means

src/Token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function extract()
300300
// in PHP 5.3- the `null` parameter isn't handled correctly.
301301
$str = mb_substr(
302302
$str,
303-
(! empty($str[1]) && ($str[1] === '@')) ? 2 : 1,
303+
! empty($str[1]) && ($str[1] === '@') ? 2 : 1,
304304
mb_strlen($str),
305305
'UTF-8'
306306
);

0 commit comments

Comments
 (0)