diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php index 385936d8ecfaa..c6fd3a9d5f587 100644 --- a/libraries/src/Application/CMSApplication.php +++ b/libraries/src/Application/CMSApplication.php @@ -829,7 +829,7 @@ protected function initialiseApp($options = []) */ public function isHttpsForced($clientId = null) { - $clientId = (int) ($clientId !== null ? $clientId : $this->getClientId()); + $clientId = (int) ($clientId ?? $this->getClientId()); $forceSsl = (int) $this->get('force_ssl'); if ($clientId === 0 && $forceSsl === 2) { diff --git a/libraries/src/HTML/Helpers/Access.php b/libraries/src/HTML/Helpers/Access.php index 9de65e389c1e3..027773d755c98 100644 --- a/libraries/src/HTML/Helpers/Access.php +++ b/libraries/src/HTML/Helpers/Access.php @@ -293,7 +293,7 @@ public static function assetgrouplist($name, $selected, $attribs = null, $config $name, [ 'id' => $config['id'] ?? 'assetgroups_' . (++$count), - 'list.attr' => $attribs === null ? 'class="inputbox" size="3"' : $attribs, + 'list.attr' => $attribs ?? 'class="inputbox" size="3"', 'list.select' => (int) $selected, ] ); diff --git a/libraries/src/HTML/Helpers/Bootstrap.php b/libraries/src/HTML/Helpers/Bootstrap.php index ad295309a45c8..2a603cdc6ec74 100644 --- a/libraries/src/HTML/Helpers/Bootstrap.php +++ b/libraries/src/HTML/Helpers/Bootstrap.php @@ -849,7 +849,7 @@ public static function addTab($selector, $id, $title): string { static $tabLayout = null; - $tabLayout = $tabLayout === null ? new FileLayout('libraries.html.bootstrap.tab.addtab') : $tabLayout; + $tabLayout = $tabLayout ?? new FileLayout('libraries.html.bootstrap.tab.addtab'); $active = (static::$loaded[__CLASS__ . '::startTabSet'][$selector]['active'] == $id) ? ' active' : ''; return $tabLayout->render(['id' => preg_replace('/^[\.#]/', '', $id), 'active' => $active, 'title' => $title]); diff --git a/libraries/src/Image/Image.php b/libraries/src/Image/Image.php index 4309ac0433651..ae75155449c30 100644 --- a/libraries/src/Image/Image.php +++ b/libraries/src/Image/Image.php @@ -1080,7 +1080,7 @@ protected function prepareDimensions($width, $height, $scaleMethod) protected function sanitizeHeight($height, $width) { // If no height was given we will assume it is a square and use the width. - $height = ($height === null) ? $width : $height; + $height = $height ?? $width; // If we were given a percentage, calculate the integer value. if (preg_match('/^[0-9]+(\.[0-9]+)?\%$/', $height)) { @@ -1119,7 +1119,7 @@ protected function sanitizeOffset($offset) protected function sanitizeWidth($width, $height) { // If no width was given we will assume it is a square and use the height. - $width = ($width === null) ? $height : $width; + $width = $width ?? $height; // If we were given a percentage, calculate the integer value. if (preg_match('/^[0-9]+(\.[0-9]+)?\%$/', $width)) { diff --git a/libraries/src/MVC/Model/AdminModel.php b/libraries/src/MVC/Model/AdminModel.php index 9d9f568c5f1a1..1c6881361f13e 100644 --- a/libraries/src/MVC/Model/AdminModel.php +++ b/libraries/src/MVC/Model/AdminModel.php @@ -1116,7 +1116,7 @@ public function publish(&$pks, $value = 1) */ $publishedColumnName = $table->getColumnAlias('published'); - if (property_exists($table, $publishedColumnName) && (isset($table->$publishedColumnName) ? $table->$publishedColumnName : $value) == $value) { + if (property_exists($table, $publishedColumnName) && ($table->$publishedColumnName ?? $value) == $value) { unset($pks[$i]); } } @@ -1252,7 +1252,7 @@ public function save($data) } $key = $table->getKeyName(); - $pk = (isset($data[$key])) ? $data[$key] : (int) $this->getState($this->getName() . '.id'); + $pk = $data[$key] ?? (int) $this->getState($this->getName() . '.id'); $isNew = true; // Include the plugins for the save events. diff --git a/libraries/src/Mail/Mail.php b/libraries/src/Mail/Mail.php index 4e20c60dda811..91a52379f3bc1 100644 --- a/libraries/src/Mail/Mail.php +++ b/libraries/src/Mail/Mail.php @@ -406,7 +406,7 @@ public function addAttachment($path, $name = '', $encoding = 'base64', $type = ' } foreach ($path as $key => $file) { - $result = parent::addAttachment($file, isset($name[$key]) ? $name[$key] : '', $encoding, $type, $disposition); + $result = parent::addAttachment($file, $name[$key] ?? '', $encoding, $type, $disposition); } // Check for boolean false return if exception handling is disabled diff --git a/libraries/src/Session/MetadataManager.php b/libraries/src/Session/MetadataManager.php index 0c58e944bffac..805c542b2159f 100644 --- a/libraries/src/Session/MetadataManager.php +++ b/libraries/src/Session/MetadataManager.php @@ -233,7 +233,7 @@ private function createSessionRecord(SessionInterface $session, User $user) $sessionId = $session->getId(); $userIsGuest = $user->guest; $userId = $user->id; - $username = $user->username === null ? '' : $user->username; + $username = $user->username ?? ''; $query->bind(':session_id', $sessionId) ->bind(':guest', $userIsGuest, ParameterType::INTEGER) @@ -290,7 +290,7 @@ private function updateSessionRecord(SessionInterface $session, User $user) $sessionId = $session->getId(); $userIsGuest = $user->guest; $userId = $user->id; - $username = $user->username === null ? '' : $user->username; + $username = $user->username ?? ''; $query->bind(':session_id', $sessionId) ->bind(':guest', $userIsGuest, ParameterType::INTEGER) diff --git a/libraries/src/Table/MenuType.php b/libraries/src/Table/MenuType.php index 175a46b1cdb1c..7463798abcbd6 100644 --- a/libraries/src/Table/MenuType.php +++ b/libraries/src/Table/MenuType.php @@ -197,7 +197,7 @@ public function store($updateNulls = false) public function delete($pk = null) { $k = $this->_tbl_key; - $pk = $pk === null ? $this->$k : $pk; + $pk = $pk ?? $this->$k; // If no primary key is given, return false. if ($pk !== null) { @@ -316,6 +316,6 @@ protected function _getAssetParentId(?Table $table = null, $id = null) $assetId = $asset->id; } - return $assetId === null ? parent::_getAssetParentId($table, $id) : $assetId; + return $assetId ?? parent::_getAssetParentId($table, $id); } } diff --git a/libraries/src/Updater/Updater.php b/libraries/src/Updater/Updater.php index a46a8309448e1..f218ca38dfe43 100644 --- a/libraries/src/Updater/Updater.php +++ b/libraries/src/Updater/Updater.php @@ -305,7 +305,7 @@ private function getUpdateObjectsForSite($updateSite, $minimumStability = self:: 'element' => $current_update->element, 'type' => $current_update->type, 'client_id' => $current_update->client_id, - 'folder' => isset($current_update->folder) ? $current_update->folder : '', + 'folder' => $current_update->folder ?? '', ] ); @@ -315,7 +315,7 @@ private function getUpdateObjectsForSite($updateSite, $minimumStability = self:: 'element' => $current_update->element, 'type' => $current_update->type, 'client_id' => $current_update->client_id, - 'folder' => isset($current_update->folder) ? $current_update->folder : '', + 'folder' => $current_update->folder ?? '', ] );