RemoveUnusedVariableInCatchRector

pull/7361/head
Your Name 5 days ago
parent 4547b1fc11
commit 8dcdd93e2b

@ -612,7 +612,7 @@ class MediaMoveStorageLocalToCloud extends Command
try {
return $cloudDisk->url($path);
} catch (\Throwable $e) {
} catch (\Throwable) {
return $cloud.':'.$path;
}
}

@ -347,7 +347,7 @@ class MediaUpdateS3CDNUrl extends Command
{
try {
return (string) Storage::disk(config('filesystems.cloud'))->url($path);
} catch (\Throwable $e) {
} catch (\Throwable) {
return null;
}
}
@ -359,7 +359,7 @@ class MediaUpdateS3CDNUrl extends Command
$host = parse_url($url, PHP_URL_HOST);
return $host ?: null;
} catch (\Throwable $e) {
} catch (\Throwable) {
return null;
}
}

@ -96,7 +96,7 @@ class SendUpdateActor extends Command
$body = $this->updateObject($profile);
try {
Helpers::sendSignedObject($profile, $url, $body);
} catch (\Throwable $e) {
} catch (\Throwable) {
// Best-effort per user: a single bad host (transport
// failure, invalid destination, etc.) must not abort the
// fleet-wide actor update.

@ -260,7 +260,7 @@ class MediaMoveStorageCloudToCloud extends Command
$host = parse_url($url, PHP_URL_HOST);
return $host ?: null;
} catch (\Throwable $e) {
} catch (\Throwable) {
return null;
}
}

@ -75,7 +75,7 @@ trait ManagesMediaStorageEnv
$host = parse_url($url, PHP_URL_HOST);
return $host ?: null;
} catch (\Throwable $e) {
} catch (\Throwable) {
return null;
}
}

@ -59,7 +59,7 @@ class SeedFollows extends Command
if ($follow->wasRecentlyCreated == true) {
FollowPipeline::dispatch($follow);
}
} catch (Exception $e) {
} catch (Exception) {
continue;
}
}

@ -166,7 +166,7 @@ class StatusAvatar extends Command
return Storage::disk('local')->exists('public/'.$mediaPath)
|| Storage::disk('local')->exists($mediaPath);
} catch (\Throwable $e) {
} catch (\Throwable) {
return false;
}
}

@ -155,7 +155,7 @@ class StatusEmoji extends Command
return Storage::disk('local')->exists('public/'.$mediaPath)
|| Storage::disk('local')->exists($mediaPath);
} catch (\Throwable $e) {
} catch (\Throwable) {
return false;
}
}

@ -288,7 +288,7 @@ class StatusMedia extends Command
return Storage::disk('local')->exists('public/'.$mediaPath)
|| Storage::disk('local')->exists($mediaPath);
} catch (\Throwable $e) {
} catch (\Throwable) {
return false;
}
}
@ -301,7 +301,7 @@ class StatusMedia extends Command
try {
return (string) Storage::disk(config('filesystems.cloud'))->url($mediaPath);
} catch (\Throwable $e) {
} catch (\Throwable) {
return '(cloud disk not resolvable in this environment)';
}
}

@ -311,7 +311,7 @@ class StatusProfile extends Command
$avatar = $profile->avatar;
return $avatar ? 'present (media_path='.($avatar->media_path ?? 'null').')' : 'MISSING';
} catch (\Throwable $e) {
} catch (\Throwable) {
return 'error';
}
}
@ -325,7 +325,7 @@ class StatusProfile extends Command
{
try {
return (string) ($fn() ?? 'null');
} catch (\Throwable $e) {
} catch (\Throwable) {
return 'error';
}
}
@ -334,7 +334,7 @@ class StatusProfile extends Command
{
try {
return (string) $fn();
} catch (\Throwable $e) {
} catch (\Throwable) {
return 'error';
}
}

@ -270,7 +270,7 @@ class StatusStatuses extends Command
try {
return (string) Storage::disk(config('filesystems.cloud'))->url($mediaPath);
} catch (\Throwable $e) {
} catch (\Throwable) {
return '(cloud disk not resolvable in this environment)';
}
}
@ -285,7 +285,7 @@ class StatusStatuses extends Command
$host = parse_url($url, PHP_URL_HOST);
return $host ?: null;
} catch (\Throwable $e) {
} catch (\Throwable) {
return null;
}
}

@ -306,7 +306,7 @@ class StatusUser extends Command
}
return 'present (media_path='.($avatar->media_path ?? 'null').')';
} catch (\Throwable $e) {
} catch (\Throwable) {
return 'error';
}
}
@ -320,7 +320,7 @@ class StatusUser extends Command
{
try {
return (string) ($fn() ?? 'null');
} catch (\Throwable $e) {
} catch (\Throwable) {
return 'error';
}
}
@ -425,7 +425,7 @@ class StatusUser extends Command
}
return (int) DB::table('oauth_access_tokens')->where('user_id', $user->id)->count();
} catch (\Throwable $e) {
} catch (\Throwable) {
return 0;
}
}
@ -434,7 +434,7 @@ class StatusUser extends Command
{
try {
return (string) $fn();
} catch (\Throwable $e) {
} catch (\Throwable) {
return 'error';
}
}

@ -959,7 +959,7 @@ class ApiV1Controller extends Controller
$status = $napi
? StatusService::get($row->id, false)
: StatusService::getMastodon($row->id, false);
} catch (\Throwable $e) {
} catch (\Throwable) {
continue;
}
@ -982,7 +982,7 @@ class ApiV1Controller extends Controller
$reblog = $napi
? StatusService::get($reblogId, false)
: StatusService::getMastodon($reblogId, false);
} catch (\Throwable $e) {
} catch (\Throwable) {
continue;
}
@ -2850,7 +2850,7 @@ class ApiV1Controller extends Controller
if (! $status || ! isset($status['account']) || ! isset($status['account']['id'])) {
return false;
}
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
@ -2921,7 +2921,7 @@ class ApiV1Controller extends Controller
if (! $status || ! isset($status['account']) || ! isset($status['account']['id'])) {
return false;
}
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
@ -3191,7 +3191,7 @@ class ApiV1Controller extends Controller
if (! $status || ! isset($status['account']) || ! isset($status['account']['id'])) {
return false;
}
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}

@ -111,7 +111,7 @@ class AppRegisterController extends Controller
try {
Mail::to($email)->send(new InAppRegisterEmailVerify($code));
} catch (\Exception $e) {
} catch (\Exception) {
DB::rollBack();
return $this->appRedirect($redirectUri, [
@ -221,7 +221,7 @@ class AppRegisterController extends Controller
try {
Mail::to($email)->send(new InAppRegisterEmailVerify($code));
} catch (\Exception $e) {
} catch (\Exception) {
DB::rollBack();
return $this->appRedirect($redirectUri, [
@ -327,7 +327,7 @@ class AppRegisterController extends Controller
try {
$tokens = $tokenFactory->issue($user, (string) $clientId, (string) $clientSecret, $scopes);
} catch (OAuthServerException $e) {
} catch (OAuthServerException) {
return response()->json([
'status' => 'error',
'code' => 'account_created_token_failed',

@ -43,7 +43,7 @@ class ApiTokenController extends AccessTokenController
$payload = json_decode(base64_decode(strtr($parts[1], '-_', '+/')), true);
return $payload['jti'] ?? null;
} catch (\Exception $e) {
} catch (\Exception) {
return null;
}
}

@ -79,7 +79,7 @@ class PersonalAccessTokenController extends Controller
$validated['name'],
$scopes
);
} catch (\RuntimeException $e) {
} catch (\RuntimeException) {
return response()->json([
'error' => 'Unable to create personal access token. The server may not have a personal access client configured. Please contact your administrator.',
], 500);

@ -468,7 +468,7 @@ class PublicApiController extends Controller
if (! $status) {
return false;
}
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
@ -517,7 +517,7 @@ class PublicApiController extends Controller
if (! $status) {
return false;
}
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
$status['favourited'] = (bool) LikeService::liked($user->profile_id, $s->id);
@ -881,7 +881,7 @@ class PublicApiController extends Controller
}
return $mastodonStatus;
} catch (\Exception $e) {
} catch (\Exception) {
return null;
}
})

@ -566,9 +566,9 @@ class RemoteAuthController extends Controller
} else {
return [];
}
} catch (RequestException $e) {
} catch (RequestException) {
return [];
} catch (\Exception $e) {
} catch (\Exception) {
return [];
}
}

@ -80,7 +80,7 @@ class LikePipeline implements ShouldQueue
try {
NotificationService::createNotification($status->profile_id, $actor->id, 'group:like', $status->id, Status::class);
} catch (\Exception $e) {
} catch (\Exception) {
}
}

@ -87,7 +87,7 @@ class ImportInstagram implements ShouldQueue
if (! $min->lt($taken_at)) {
$taken_at = now();
}
} catch (\Exception $e) {
} catch (\Exception) {
}
$filename = last(explode('/', $import['path']));

@ -134,7 +134,7 @@ class MoveSendUndoFollowPipeline implements ShouldQueue
->timeout(config('federation.activitypub.delivery.timeout'))
->withBody($payload, 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"')
->post($targetInbox);
} catch (ConnectionException $e) {
} catch (ConnectionException) {
}
}

@ -134,7 +134,7 @@ class VideoThumbnailToCloudPipeline implements ShouldBeUniqueUntilProcessing, Sh
if (str_starts_with($media->media_path, 'public/m/_v2/') && str_ends_with($media->media_path, '.mp4')) {
Storage::disk('local')->delete($media->media_path);
}
} catch (\Exception $e) {
} catch (\Exception) {
}
if ($media->status_id) {

@ -38,11 +38,11 @@ class RemoteAuthService
if (! $res->ok()) {
return false;
}
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
@ -81,11 +81,11 @@ class RemoteAuthService
'redirect_uri' => $raw->redirect_uri,
'scope' => 'read',
]);
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
@ -106,11 +106,11 @@ class RemoteAuthService
if (! $res->ok()) {
return false;
}
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
@ -133,11 +133,11 @@ class RemoteAuthService
if (! $res->ok()) {
return false;
}
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
@ -168,11 +168,11 @@ class RemoteAuthService
}
return $json['compatible'];
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
});
@ -185,11 +185,11 @@ class RemoteAuthService
if (! $res->ok()) {
return false;
}
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
$json = $res->json();
@ -214,11 +214,11 @@ class RemoteAuthService
if (! $res->ok()) {
return;
}
} catch (RequestException $e) {
} catch (RequestException) {
return;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return;
} catch (\Exception $e) {
} catch (\Exception) {
return;
}

@ -167,7 +167,7 @@ class ActivityPubFetchService
64,
JSON_THROW_ON_ERROR
);
} catch (\JsonException $e) {
} catch (\JsonException) {
return;
}
}
@ -234,7 +234,7 @@ class ActivityPubFetchService
return Helpers::validateUrl($url)
? $url
: null;
} catch (\Throwable $e) {
} catch (\Throwable) {
return null;
}
}

@ -96,7 +96,7 @@ class AvatarService
} catch (
UnableToRetrieveMetadata|
UnableToCheckDirectoryExistence|
Exception $e
Exception
) {
return;
}

@ -190,7 +190,7 @@ class ConfigCacheService
return $v;
});
} catch (Exception|QueryException $e) {
} catch (Exception|QueryException) {
return config($key);
}
}

@ -77,9 +77,9 @@ class CustomEmojiService
->timeout(15)
->connectTimeout(5)
->get($url);
} catch (RequestException $e) {
} catch (RequestException) {
return;
} catch (\Exception $e) {
} catch (\Exception) {
return;
}
@ -140,7 +140,7 @@ class CustomEmojiService
$emoji->media_path = $mediaPath;
$emoji->save();
} catch (\Exception $e) {
} catch (\Exception) {
// Download failed
return;
}
@ -231,7 +231,7 @@ class CustomEmojiService
$emoji->media_path = $mediaPath;
$emoji->save();
}
} catch (\Throwable $e) {
} catch (\Throwable) {
return 'failed';
}

@ -72,15 +72,15 @@ class FetchCacheService
->withHeaders($headers)
->timeout(40)
->get($url);
} catch (RequestException $e) {
} catch (RequestException) {
Cache::put($key, 1, $ttl);
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
Cache::put($key, 1, $ttl);
return false;
} catch (\Exception $e) {
} catch (\Exception) {
Cache::put($key, 1, $ttl);
return false;

@ -55,14 +55,14 @@ class FilesystemService
} else {
$writable = false;
}
} catch (FilesystemException|UnableToReadFile $exception) {
} catch (FilesystemException|UnableToReadFile) {
$writable = false;
}
if (in_array(self::VERIFY_FILE_NAME, $res)) {
try {
$filesystem->delete(self::VERIFY_FILE_NAME);
} catch (FilesystemException|UnableToDeleteFile $exception) {
} catch (FilesystemException|UnableToDeleteFile) {
$writable = false;
}
}

@ -314,7 +314,7 @@ class ImportService
$nextDay->month,
$nextDay->day,
];
} catch (\Exception $e) {
} catch (\Exception) {
return [null, null, null];
}
}

@ -28,11 +28,11 @@ class BeagleService
->connectTimeout(5)
->retry(2, 500)
->get('https://beagle.pixelfed.net/api/v1/common/suggestions/rules');
} catch (RequestException $e) {
} catch (RequestException) {
return;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return;
} catch (\Exception $e) {
} catch (\Exception) {
return;
}
@ -69,11 +69,11 @@ class BeagleService
->connectTimeout(5)
->retry(2, 500)
->get('https://beagle.pixelfed.net/api/v1/discover');
} catch (RequestException $e) {
} catch (RequestException) {
return;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return;
} catch (\Exception $e) {
} catch (\Exception) {
return;
}

@ -79,11 +79,11 @@ class SoftwareUpdateService
->connectTimeout(5)
->retry(2, 500)
->get('https://versions.pixelfed.org/versions.json');
} catch (RequestException $e) {
} catch (RequestException) {
return;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return;
} catch (\Exception $e) {
} catch (\Exception) {
return;
}

@ -77,11 +77,11 @@ class NodeinfoService
->withHeaders($headers)
->timeout(5)
->get($href);
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}

@ -44,9 +44,9 @@ class NotificationAppGatewayService
->get($endpoint);
$data = $res->json();
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (Exception $e) {
} catch (Exception) {
return false;
}
@ -120,9 +120,9 @@ class NotificationAppGatewayService
]);
$response->throw();
} catch (RequestException $e) {
} catch (RequestException) {
return;
} catch (Exception $e) {
} catch (Exception) {
return;
}
}

@ -248,7 +248,7 @@ class SearchApiV2Service
) {
try {
$res = WebfingerService::lookup('@'.$query, $mastodonMode);
} catch (\Exception $e) {
} catch (\Exception) {
return $default;
}
if ($res && isset($res['id'], $res['url'])) {
@ -272,7 +272,7 @@ class SearchApiV2Service
if (Str::substrCount($query, '@') == 2) {
try {
$res = WebfingerService::lookup($query, $mastodonMode);
} catch (\Exception $e) {
} catch (\Exception) {
return $default;
}
if ($res && isset($res['id'])) {
@ -360,7 +360,7 @@ class SearchApiV2Service
];
}
}
} catch (\Exception $e) {
} catch (\Exception) {
return [
'accounts' => [],
'hashtags' => [],

@ -134,11 +134,11 @@ class SecureMediaFetchService
->timeout(self::TIMEOUT)
->connectTimeout(self::CONNECT_TIMEOUT)
->{$method}($currentUrl);
} catch (RequestException $e) {
} catch (RequestException) {
return false;
} catch (ConnectionException $e) {
} catch (ConnectionException) {
return false;
} catch (\Throwable $e) {
} catch (\Throwable) {
return false;
}
@ -227,7 +227,7 @@ class SecureMediaFetchService
$resolved = (string) BaseUri::from($baseUrl)->resolve($location);
return Helpers::validateUrl($resolved) ? $resolved : null;
} catch (\Throwable $e) {
} catch (\Throwable) {
return null;
}
}

@ -204,7 +204,7 @@ class Helpers
try {
$uri = $uri->withHost($host);
} catch (\Throwable $e) {
} catch (\Throwable) {
return false;
}
@ -575,7 +575,7 @@ class Helpers
$isMoreThanOneDayFuture = $date->gt($tomorrow);
return ! ($isMoreThanTenYearsOld || $isMoreThanOneDayFuture);
} catch (\Exception $e) {
} catch (\Exception) {
return false;
}
}
@ -1251,7 +1251,7 @@ class Helpers
try {
$mediaModel->save();
} catch (UniqueConstraintViolationException $e) {
} catch (UniqueConstraintViolationException) {
// Lost a race with a concurrent inbox job that inserted the same
// (status_id, media_path). Treat as already-imported.
return null;

Loading…
Cancel
Save