Skip to content

Commit 80f5b09

Browse files
[5.3] Remove unused exception variable in try catch block for libraries (joomla#44922)
--------- Co-authored-by: Martina Scholz <[email protected]>
1 parent e95d87b commit 80f5b09

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+104
-104
lines changed

libraries/src/Access/Access.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ public static function getActionsFromData($data, $xpath = "/access/section[@name
10441044
if (\is_string($data)) {
10451045
try {
10461046
$data = new \SimpleXMLElement($data);
1047-
} catch (\Exception $e) {
1047+
} catch (\Exception) {
10481048
return false;
10491049
}
10501050

libraries/src/Application/CMSApplication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public function getCfg($varname, $default = null)
498498
Log::WARNING,
499499
'deprecated'
500500
);
501-
} catch (\RuntimeException $exception) {
501+
} catch (\RuntimeException) {
502502
// Informational log only
503503
}
504504

libraries/src/Application/ConsoleApplication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ protected function populateHttpHost()
525525
*/
526526
try {
527527
$uri = Uri::getInstance($liveSite);
528-
} catch (\RuntimeException $e) {
528+
} catch (\RuntimeException) {
529529
$uri = Uri::getInstance('https://joomla.invalid/set/by/console/application');
530530
}
531531

libraries/src/Application/DaemonApplication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ protected function daemonize()
517517
$this->processId = (int) posix_getpid();
518518
$this->parentId = $this->processId;
519519
}
520-
} catch (\RuntimeException $e) {
520+
} catch (\RuntimeException) {
521521
Log::add('Unable to fork.', Log::EMERGENCY);
522522

523523
return false;

libraries/src/Application/EventAware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function registerEvent($event, callable $handler)
6060
{
6161
try {
6262
$this->getDispatcher()->addListener($event, $handler);
63-
} catch (\UnexpectedValueException $e) {
63+
} catch (\UnexpectedValueException) {
6464
// No dispatcher is registered, don't throw an error (mimics old behavior)
6565
}
6666

@@ -93,7 +93,7 @@ public function triggerEvent($eventName, $args = [])
9393
{
9494
try {
9595
$dispatcher = $this->getDispatcher();
96-
} catch (\UnexpectedValueException $exception) {
96+
} catch (\UnexpectedValueException) {
9797
$this->getLogger()->error(\sprintf('Dispatcher not set in %s, cannot trigger events.', \get_class($this)));
9898

9999
return [];

libraries/src/Application/MultiFactorAuthenticationHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function isHandlingMultiFactorAuthentication(): bool
5959
// Multi-factor Authentication checks take place only for logged in users.
6060
try {
6161
$user = $this->getIdentity();
62-
} catch (\Exception $e) {
62+
} catch (\Exception) {
6363
return false;
6464
}
6565

@@ -255,7 +255,7 @@ private function needsMultiFactorAuthenticationRedirection(): bool
255255
// Make sure we are logged in
256256
try {
257257
$user = $this->getIdentity();
258-
} catch (\Exception $e) {
258+
} catch (\Exception) {
259259
// This would happen if we are in CLI or under an old Joomla! version. Either case is not supported.
260260
return false;
261261
}
@@ -356,7 +356,7 @@ private function hasRejectedMultiFactorAuthenticationSetup(): bool
356356

357357
try {
358358
$result = $db->setQuery($query)->loadResult();
359-
} catch (\Exception $e) {
359+
} catch (\Exception) {
360360
$result = 1;
361361
}
362362

@@ -491,7 +491,7 @@ private function decryptLegacyTFAString(string $secret, string $stringToDecrypt)
491491
// Is this already decrypted?
492492
try {
493493
$decrypted = @json_decode($stringToDecrypt, true);
494-
} catch (\Exception $e) {
494+
} catch (\Exception) {
495495
$decrypted = null;
496496
}
497497

libraries/src/Cache/CacheController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static function getInstance($type = 'output', $options = [])
103103

104104
try {
105105
return Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController($type, $options);
106-
} catch (\RuntimeException $e) {
106+
} catch (\RuntimeException) {
107107
$type = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $type));
108108
$class = 'JCacheController' . ucfirst($type);
109109

libraries/src/Cache/Storage/RedisStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ protected function getConnection()
129129

130130
try {
131131
static::$_redis->ping();
132-
} catch (\RedisException $e) {
132+
} catch (\RedisException) {
133133
static::$_redis = null;
134134

135135
throw new CacheConnectingException('Redis ping failed', 500);

libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function submit(RequestParameters $params)
6969
$response = $this->http->post(self::SITE_VERIFY_URL, $params->toArray());
7070

7171
return (string) $response->getBody();
72-
} catch (InvalidResponseCodeException $exception) {
72+
} catch (InvalidResponseCodeException) {
7373
return '';
7474
}
7575
}

libraries/src/Categories/Categories.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public static function getInstance($extension, $options = [])
157157
if ($component instanceof CategoryServiceInterface) {
158158
$categories = $component->getCategory($options, \count($parts) > 1 ? $parts[1] : '');
159159
}
160-
} catch (SectionNotFoundException $e) {
160+
} catch (SectionNotFoundException) {
161161
$categories = null;
162162
}
163163

@@ -236,7 +236,7 @@ protected function _load($id)
236236
{
237237
try {
238238
$db = $this->getDatabase();
239-
} catch (DatabaseNotFoundException $e) {
239+
} catch (DatabaseNotFoundException) {
240240
@trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED);
241241
$db = Factory::getContainer()->get(DatabaseInterface::class);
242242
}

0 commit comments

Comments
 (0)