Skip to content

Commit

Permalink
Merge pull request #14864 from Tithugues/feature/remove-useless-paren…
Browse files Browse the repository at this point in the history
…theses

Remove useless parentheses
  • Loading branch information
MauricioFauth committed Jan 21, 2019
2 parents b9023dc + 4321120 commit 1303def
Show file tree
Hide file tree
Showing 45 changed files with 153 additions and 147 deletions.
2 changes: 1 addition & 1 deletion db_central_columns.php
Expand Up @@ -147,7 +147,7 @@

$num_cols = $centralColumns->getColumnsCount($db, $pos, $max_rows);
$message = Message::success(
sprintf(__('Showing rows %1$s - %2$s.'), ($pos + 1), ($pos + $num_cols))
sprintf(__('Showing rows %1$s - %2$s.'), $pos + 1, $pos + $num_cols)
);
if (isset($tmp_msg) && $tmp_msg !== true) {
$message = $tmp_msg;
Expand Down
4 changes: 2 additions & 2 deletions error_report.php
Expand Up @@ -51,9 +51,9 @@
} else {
$_SESSION['prev_error_subm_time'] = time();
$_SESSION['error_subm_count'] = (
(isset($_SESSION['error_subm_count']))
isset($_SESSION['error_subm_count'])
? ($_SESSION['error_subm_count'] + 1)
: (0)
: 0
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion export.php
Expand Up @@ -304,7 +304,7 @@
// preference over SQL Query aliases.
$parser = new \PhpMyAdmin\SqlParser\Parser($sql_query);
$aliases = [];
if ((! empty($parser->statements[0]))
if (! empty($parser->statements[0])
&& ($parser->statements[0] instanceof \PhpMyAdmin\SqlParser\Statements\SelectStatement)
) {
$aliases = \PhpMyAdmin\SqlParser\Utils\Misc::getAliases($parser->statements[0], $db);
Expand Down
4 changes: 2 additions & 2 deletions gis_data_editor.php
Expand Up @@ -56,7 +56,7 @@
mb_strpos($_POST['value'], "(") - $start
);
}
if ((! isset($gis_data['gis_type']))
if (! isset($gis_data['gis_type'])
|| (! in_array($gis_data['gis_type'], $gis_types))
) {
$gis_data['gis_type'] = $gis_types[0];
Expand Down Expand Up @@ -111,7 +111,7 @@

$geom_count = 1;
if ($geom_type == 'GEOMETRYCOLLECTION') {
$geom_count = (isset($gis_data[$geom_type]['geom_count']))
$geom_count = isset($gis_data[$geom_type]['geom_count'])
? intval($gis_data[$geom_type]['geom_count']) : 1;
if (isset($gis_data[$geom_type]['add_geom'])) {
$geom_count++;
Expand Down
4 changes: 2 additions & 2 deletions js/messages.php
Expand Up @@ -724,7 +724,7 @@ function () {
)
. '<br>'
. '<img src="'
. ($GLOBALS['PMA_Theme']->getImgPath('ajax_clock_small.gif'))
. $GLOBALS['PMA_Theme']->getImgPath('ajax_clock_small.gif')
. '" width="16" height="16" alt="ajax clock">'
. '</div>';
$js_messages['strCopyQueryButtonSuccess'] = __('Successfully copied!');
Expand Down Expand Up @@ -900,7 +900,7 @@ function () {
/* l10n: Month-year order for calendar, use either "calendar-month-year"
* or "calendar-year-month".
*/
(__('calendar-month-year') == 'calendar-year-month')
__('calendar-month-year') == 'calendar-year-month'
);
/* l10n: Year suffix for calendar, "none" is empty. */
$year_suffix = _pgettext('Year suffix', 'none');
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/CheckUserPrivileges.php
Expand Up @@ -69,7 +69,7 @@ public function getItemsFromShowGrantsRow(string $row): array
$show_grants_str = mb_substr(
$row,
6,
(mb_strpos($row, ' ON ') - 6)
mb_strpos($row, ' ON ') - 6
);

$show_grants_tblname = mb_substr(
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Config/FormDisplay.php
Expand Up @@ -893,8 +893,8 @@ private function _setComments($systemPath, array &$opts)
$opts['comment_warning'] = true;
}
if (! $GLOBALS['PMA_Config']->get('is_setup')) {
if (($systemPath == 'MaxDbList' || $systemPath == 'MaxTableList'
|| $systemPath == 'QueryHistoryMax')
if ($systemPath == 'MaxDbList' || $systemPath == 'MaxTableList'
|| $systemPath == 'QueryHistoryMax'
) {
$opts['comment'] = sprintf(
__('maximum %s'),
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Config/Validator.php
Expand Up @@ -570,7 +570,7 @@ public static function validateByRegex($path, array $values, $regex)
return '';
}
$result = preg_match($regex, Util::requestString($values[$path]));
return [$path => ($result ? '' : __('Incorrect value!'))];
return [$path => $result ? '' : __('Incorrect value!')];
}

/**
Expand Down
Expand Up @@ -309,7 +309,7 @@ public function addRemoveFavoriteTablesAction()
'db' => $this->db,
'ajax_request' => true,
'favorite_table' => $favorite_table,
(($already_favorite ? 'remove' : 'add') . '_favorite') => true,
($already_favorite ? 'remove' : 'add') . '_favorite' => true,
];
$this->response->addJSON([
'user' => $user,
Expand Down Expand Up @@ -644,12 +644,12 @@ protected function displayTableList()
'formatted_size' => $formatted_size,
'unit' => $unit,
'overhead' => $overhead,
'create_time' => (isset($create_time) && $create_time
? Util::localisedDate(strtotime($create_time)) : '-'),
'update_time' => (isset($update_time) && $update_time
? Util::localisedDate(strtotime($update_time)) : '-'),
'check_time' => (isset($check_time) && $check_time
? Util::localisedDate(strtotime($check_time)) : '-'),
'create_time' => isset($create_time) && $create_time
? Util::localisedDate(strtotime($create_time)) : '-',
'update_time' => isset($update_time) && $update_time
? Util::localisedDate(strtotime($update_time)) : '-',
'check_time' => isset($check_time) && $check_time
? Util::localisedDate(strtotime($check_time)) : '-',
'charset' => isset($charset)
? $charset : '',
'is_show_stats' => $this->_is_show_stats,
Expand Down Expand Up @@ -691,9 +691,9 @@ protected function displayTableList()
'db_charset' => $db_charset,
'sum_size' => $sum_size,
'overhead_size' => $overhead_size,
'create_time_all' => ($create_time_all ? Util::localisedDate(strtotime($create_time_all)) : '-'),
'update_time_all' => ($update_time_all ? Util::localisedDate(strtotime($update_time_all)) : '-'),
'check_time_all' => ($check_time_all ? Util::localisedDate(strtotime($check_time_all)) : '-'),
'create_time_all' => $create_time_all ? Util::localisedDate(strtotime($create_time_all)) : '-',
'update_time_all' => $update_time_all ? Util::localisedDate(strtotime($update_time_all)) : '-',
'check_time_all' => $check_time_all ? Util::localisedDate(strtotime($check_time_all)) : '-',
'approx_rows' => $overall_approx_rows,
'num_favorite_tables' => $GLOBALS['cfg']['NumFavoriteTables'],
'db' => $GLOBALS['db'],
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Controllers/Table/TableSearchController.php
Expand Up @@ -570,9 +570,9 @@ public function displaySelectionFormAction($dataLabel = null)
'criteria_column_types' => isset($_POST['criteriaColumnTypes']) ? $_POST['criteriaColumnTypes'] : null,
'sql_types' => $this->dbi->types,
'max_rows' => intval($GLOBALS['cfg']['MaxRows']),
'max_plot_limit' => (! empty($_POST['maxPlotLimit'])
'max_plot_limit' => ! empty($_POST['maxPlotLimit'])
? intval($_POST['maxPlotLimit'])
: intval($GLOBALS['cfg']['maxRowPlotLimit'])),
: intval($GLOBALS['cfg']['maxRowPlotLimit']),
])
);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Database/Qbe.php
Expand Up @@ -923,7 +923,7 @@ private function _getModifyColumnsRow()
$html_output .= $this->_getAndOrColCell(
$new_column_count,
$checked_options,
($column_index + 1 == $this->_criteria_column_count)
$column_index + 1 == $this->_criteria_column_count
);
$new_column_count++;
} // end for
Expand Down
12 changes: 6 additions & 6 deletions libraries/classes/Display/Results.php
Expand Up @@ -1423,7 +1423,7 @@ private function _getFieldVisibilityParams(
&& ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE) ? 4 : 0;

$button_html .= '<td ' . $colspan . '></td>';
} elseif (($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_NONE)) {
} elseif ($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_NONE) {
// ... elseif display an empty column if the actions links are
// disabled to match the rest of the table
$button_html .= '<th class="column_action"></th>';
Expand Down Expand Up @@ -1451,7 +1451,7 @@ private function _getFieldVisibilityParams(
private function _getTableCommentsArray(array $analyzed_sql_results)
{
if (! $GLOBALS['cfg']['ShowBrowseComments']
|| (empty($analyzed_sql_results['statement']->from))
|| empty($analyzed_sql_results['statement']->from)
) {
return [];
}
Expand Down Expand Up @@ -2883,7 +2883,7 @@ private function _getRowValues(
include_once ROOT_PATH . 'libraries/special_schema_links.inc.php';

if (isset($GLOBALS['special_schema_links'])
&& (! empty($GLOBALS['special_schema_links'][$dbLower][$tblLower][$nameLower]))
&& ! empty($GLOBALS['special_schema_links'][$dbLower][$tblLower][$nameLower])
) {
$linking_url = $this->_getSpecialLinkUrl(
$row[$i],
Expand Down Expand Up @@ -3305,7 +3305,7 @@ private function _getDeleteAndKillLinks(
'table' => $this->__get('table'),
'sql_query' => $url_sql_query,
'message_to_show' => __('The row has been deleted.'),
'goto' => (empty($goto) ? 'tbl_sql.php' : $goto),
'goto' => empty($goto) ? 'tbl_sql.php' : $goto,
];

$lnk_goto = 'sql.php' . Url::getCommonRaw($_url_params);
Expand Down Expand Up @@ -4240,7 +4240,7 @@ public function getTable(
}

$navigation = '';
if (($displayParts['nav_bar'] == '1') && ! is_null($statement) && (empty($statement->limit))) {
if ($displayParts['nav_bar'] == '1' && ! is_null($statement) && empty($statement->limit)) {
$navigation = $this->_getTableNavigation(
$pos_next,
$pos_prev,
Expand Down Expand Up @@ -5262,7 +5262,7 @@ private function _getRowData(

if (! empty($analyzed_sql_results['statement']->expr)) {
foreach ($analyzed_sql_results['statement']->expr as $expr) {
if (empty($expr->alias) || (empty($expr->column))) {
if (empty($expr->alias) || empty($expr->column)) {
continue;
}
if (strcasecmp($meta->name, $expr->alias) == 0) {
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Gis/GisGeometryCollection.php
Expand Up @@ -322,7 +322,7 @@ private function _explodeGeomCol($geom_col)
= mb_substr(
$geom_col,
$start,
($count + 1 - $start)
$count + 1 - $start
);
$start = $count + 2;
}
Expand All @@ -345,7 +345,7 @@ private function _explodeGeomCol($geom_col)
*/
public function generateWkt(array $gis_data, $index, $empty = '')
{
$geom_count = (isset($gis_data['GEOMETRYCOLLECTION']['geom_count']))
$geom_count = isset($gis_data['GEOMETRYCOLLECTION']['geom_count'])
? $gis_data['GEOMETRYCOLLECTION']['geom_count'] : 1;
$wkt = 'GEOMETRYCOLLECTION(';
for ($i = 0; $i < $geom_count; $i++) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Gis/GisPolygon.php
Expand Up @@ -537,7 +537,7 @@ public static function getPointOnSurface(array $ring)

// Always keep $epsilon < 1 to go with the reduction logic down here
$epsilon = 0.1;
$denominator = sqrt(pow(($y1 - $y0), 2) + pow(($x0 - $x1), 2));
$denominator = sqrt(pow($y1 - $y0, 2) + pow($x0 - $x1, 2));
$pointA = [];
$pointB = [];

Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Header.php
Expand Up @@ -256,7 +256,7 @@ public function getJsParams(): array
'confirm' => $GLOBALS['cfg']['Confirm'],
'LoginCookieValidity' => $GLOBALS['cfg']['LoginCookieValidity'],
'session_gc_maxlifetime' => (int) ini_get('session.gc_maxlifetime'),
'logged_in' => (isset($GLOBALS['dbi']) ? $GLOBALS['dbi']->isUserType('logged') : false),
'logged_in' => isset($GLOBALS['dbi']) ? $GLOBALS['dbi']->isUserType('logged') : false,
'is_https' => $GLOBALS['PMA_Config']->isHttps(),
'rootPath' => $GLOBALS['PMA_Config']->getRootPath(),
'arg_separator' => Url::getArgSeparator(),
Expand Down
12 changes: 6 additions & 6 deletions libraries/classes/Import.php
Expand Up @@ -560,8 +560,8 @@ public function getDecimalScale(string $last_cumulative_size): int
{
return (int) substr(
$last_cumulative_size,
(strpos($last_cumulative_size, ",") + 1),
(strlen($last_cumulative_size) - strpos($last_cumulative_size, ","))
strpos($last_cumulative_size, ",") + 1,
strlen($last_cumulative_size) - strpos($last_cumulative_size, ",")
);
}

Expand All @@ -586,7 +586,7 @@ public function getDecimalSize(string $cell): array
return [
$m,
$d,
($m . "," . $d),
$m . "," . $d,
];
}

Expand Down Expand Up @@ -1145,11 +1145,11 @@ public function buildSql(
$is_varchar = false;
}

$tempSQLStr .= (($is_varchar) ? "'" : "");
$tempSQLStr .= $is_varchar ? "'" : "";
$tempSQLStr .= $GLOBALS['dbi']->escapeString(
(string) $tables[$i][self::ROWS][$j][$k]
);
$tempSQLStr .= (($is_varchar) ? "'" : "");
$tempSQLStr .= $is_varchar ? "'" : "";
}

if ($k != ($num_cols - 1)) {
Expand Down Expand Up @@ -1398,7 +1398,7 @@ public function handleSimulateDmlRequest(): void

if ((! (($statement instanceof UpdateStatement)
|| ($statement instanceof DeleteStatement)))
|| (! empty($statement->join))
|| ! empty($statement->join)
) {
$error = $error_msg;
break;
Expand Down
3 changes: 2 additions & 1 deletion libraries/classes/Linter.php
Expand Up @@ -31,7 +31,8 @@ class Linter
public static function getLines($str)
{
if ((! ($str instanceof UtfString))
&& (defined('USE_UTF_STRINGS')) && (USE_UTF_STRINGS)
&& defined('USE_UTF_STRINGS')
&& USE_UTF_STRINGS
) {
// If the lexer uses UtfString for processing then the position will
// represent the position of the character and not the position of
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Menu.php
Expand Up @@ -512,7 +512,7 @@ private function _getDbTabs()
$tabs['operation']['text'] = __('Operations');
$tabs['operation']['icon'] = 'b_tblops';

if (($is_superuser || $isCreateOrGrantUser)) {
if ($is_superuser || $isCreateOrGrantUser) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
// stay on database view
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/MultSubmits.php
Expand Up @@ -72,7 +72,7 @@ public function getUrlParams(
) {
$urlParams = [
'query_type' => $what,
'reload' => (! empty($reload) ? 1 : 0),
'reload' => ! empty($reload) ? 1 : 0,
];
if (mb_strpos(' ' . $action, 'db_') == 1) {
$urlParams['db'] = $db;
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/NavigationTree.php
Expand Up @@ -254,7 +254,7 @@ private function _getNavigationDbPos()
}

$navItems = (int) $GLOBALS['cfg']['FirstLevelNavigationItems'];
$retval = floor((count($prefixMap) / $navItems)) * $navItems;
$retval = floor(count($prefixMap) / $navItems) * $navItems;

return $retval;
}
Expand Down Expand Up @@ -1071,7 +1071,7 @@ private function _renderNode($node, $recursive, $class = '')
// if node name itself is in sterile, then allow
if ($node->is_group
|| (! in_array($parentName, $sterile) && ! $node->isNew)
|| (in_array($node->real_name, $sterile))
|| in_array($node->real_name, $sterile)
) {
$retval .= "<div class='block'>";
$iClass = '';
Expand Down
Expand Up @@ -27,9 +27,7 @@ public function __construct($name, $type = Node::OBJECT)
parent::__construct($name, $type);
if ($GLOBALS['cfg']['NavigationTreeEnableGrouping']) {
$this->separator = $GLOBALS['cfg']['NavigationTreeTableSeparator'];
$this->separator_depth = (int) (
$GLOBALS['cfg']['NavigationTreeTableLevel']
);
$this->separator_depth = (int) $GLOBALS['cfg']['NavigationTreeTableLevel'];
}
}

Expand Down
14 changes: 7 additions & 7 deletions libraries/classes/Plugins/Export/ExportSql.php
Expand Up @@ -749,8 +749,8 @@ public function exportHeader()

// We want exported AUTO_INCREMENT columns to have still same value,
// do this only for recent MySQL exports
if ((! isset($GLOBALS['sql_compatibility'])
|| $GLOBALS['sql_compatibility'] == 'NONE')
if (! isset($GLOBALS['sql_compatibility'])
|| $GLOBALS['sql_compatibility'] == 'NONE'
) {
$head .= 'SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";' . $crlf;
}
Expand Down Expand Up @@ -1794,7 +1794,7 @@ public function getTableDef(
) . $alter_footer;
}

if (! empty($indexes) || (! empty($indexes_fulltext))) {
if (! empty($indexes) || ! empty($indexes_fulltext)) {
$sql_indexes = $this->generateComment(
$crlf,
$sql_indexes,
Expand All @@ -1813,7 +1813,7 @@ public function getTableDef(
}

// Generating auto-increment-related query.
if (! empty($auto_increment) && ($update_indexes_increments)) {
if (! empty($auto_increment) && $update_indexes_increments) {
$sql_auto_increments_query = $alter_header . $crlf . ' MODIFY '
. implode(',' . $crlf . ' MODIFY ', $auto_increment);
if (isset($GLOBALS['sql_auto_increment'])
Expand Down Expand Up @@ -2827,9 +2827,9 @@ public function replaceWithAliases(
}

if ($statement->options->has('TRIGGER')
|| ($statement->options->has('PROCEDURE'))
|| ($statement->options->has('FUNCTION'))
|| ($statement->options->has('VIEW'))
|| $statement->options->has('PROCEDURE')
|| $statement->options->has('FUNCTION')
|| $statement->options->has('VIEW')
) {
// Repalcing the body.
for ($i = 0, $count = count($statement->body); $i < $count; ++$i) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Plugins/Export/ExportXml.php
Expand Up @@ -253,7 +253,7 @@ public function exportHeader()
. '-->' . $crlf . $crlf;

$head .= '<pma_xml_export version="1.0"'
. (($export_struct)
. ($export_struct
? ' xmlns:pma="https://www.phpmyadmin.net/some_doc_url/"'
: '')
. '>' . $crlf;
Expand Down

0 comments on commit 1303def

Please sign in to comment.