From 3f8feaa5893e30509fa21edafbdcdb478f3fabd0 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 30 Oct 2024 16:41:24 +0700 Subject: [PATCH] refactor: clean up parentheses on assign and ternary --- system/Database/BaseConnection.php | 2 +- system/Database/MySQLi/Connection.php | 2 +- system/Helpers/form_helper.php | 6 +++--- system/Pager/Pager.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 487f01df4ccb..65bf6fcdbdac 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -848,7 +848,7 @@ public function transBegin(bool $testMode = false): bool // Reset the transaction failure flag. // If the $test_mode flag is set to TRUE transactions will be rolled back // even if the queries produce a successful result. - $this->transFailure = ($testMode); + $this->transFailure = $testMode; if ($this->_transBegin()) { $this->transDepth++; diff --git a/system/Database/MySQLi/Connection.php b/system/Database/MySQLi/Connection.php index 6524d95b41f1..b1095003e286 100644 --- a/system/Database/MySQLi/Connection.php +++ b/system/Database/MySQLi/Connection.php @@ -96,7 +96,7 @@ public function connect(bool $persistent = false) $port = null; $socket = $this->hostname; } else { - $hostname = ($persistent) ? 'p:' . $this->hostname : $this->hostname; + $hostname = $persistent ? 'p:' . $this->hostname : $this->hostname; $port = empty($this->port) ? null : $this->port; $socket = ''; } diff --git a/system/Helpers/form_helper.php b/system/Helpers/form_helper.php index 422c5f1adbb2..58cd828e3faa 100644 --- a/system/Helpers/form_helper.php +++ b/system/Helpers/form_helper.php @@ -582,7 +582,7 @@ function set_select(string $field, string $value = '', bool $default = false): s } if ($input === null) { - return ($default) ? ' selected="selected"' : ''; + return $default ? ' selected="selected"' : ''; } if (is_array($input)) { @@ -636,7 +636,7 @@ function set_checkbox(string $field, string $value = '', bool $default = false): return ($input === $value) ? ' checked="checked"' : ''; } - return ($default) ? ' checked="checked"' : ''; + return $default ? ' checked="checked"' : ''; } } @@ -673,7 +673,7 @@ function set_radio(string $field, string $value = '', bool $default = false): st return ((string) $input === $value) ? ' checked="checked"' : ''; } - return ($default) ? ' checked="checked"' : ''; + return $default ? ' checked="checked"' : ''; } } diff --git a/system/Pager/Pager.php b/system/Pager/Pager.php index e5fbb9df5b34..3bdc85388c18 100644 --- a/system/Pager/Pager.php +++ b/system/Pager/Pager.php @@ -288,7 +288,7 @@ public function getPageURI(?int $page = null, string $group = 'default', bool $r $uri->setQueryArray($query); } - return ($returnObject) + return $returnObject ? $uri : URI::createURIString( $uri->getScheme(),