ExplicitReturnNullRector

pull/7361/head
Your Name 5 days ago
parent 0435d08568
commit a5d413a594

1
.gitignore vendored

@ -38,4 +38,3 @@
/storage/psalm-reports /storage/psalm-reports
/psalm.sarif.json /psalm.sarif.json
/.psalm-cache /.psalm-cache
.kiro/

@ -57,13 +57,13 @@ class SendUpdateActor extends Command
return Instance::where('domain', 'like', '%'.$input.'%')->pluck('domain')->toArray(); return Instance::where('domain', 'like', '%'.$input.'%')->pluck('domain')->toArray();
}); });
if (! $this->confirm('Are you sure you want to send actor updates to '.$domain.'?')) { if (! $this->confirm('Are you sure you want to send actor updates to '.$domain.'?')) {
return; return null;
} }
if ($cur = Instance::whereDomain($domain)->whereNotNull('actors_last_synced_at')->first()) { if ($cur = Instance::whereDomain($domain)->whereNotNull('actors_last_synced_at')->first()) {
if (! $this->option('force')) { if (! $this->option('force')) {
$this->error('ERROR: Cannot re-sync this instance, it was already synced on '.$cur->actors_last_synced_at); $this->error('ERROR: Cannot re-sync this instance, it was already synced on '.$cur->actors_last_synced_at);
return; return null;
} }
} }
$this->touchStorageCache($domain); $this->touchStorageCache($domain);
@ -73,7 +73,7 @@ class SendUpdateActor extends Command
if (! $sharedInbox) { if (! $sharedInbox) {
$this->error('ERROR: Cannot find the sharedInbox of '.$domain); $this->error('ERROR: Cannot find the sharedInbox of '.$domain);
return; return null;
} }
$url = $sharedInbox->sharedInbox; $url = $sharedInbox->sharedInbox;
$this->line(' '); $this->line(' ');

@ -306,7 +306,7 @@ trait AdminDirectoryController
$bannerImage = ConfigCache::whereK('app.banner_image')->first(); $bannerImage = ConfigCache::whereK('app.banner_image')->first();
$directory = ConfigCache::whereK('pixelfed.directory')->first(); $directory = ConfigCache::whereK('pixelfed.directory')->first();
if (! $bannerImage && ! $directory || empty($directory->v)) { if (! $bannerImage && ! $directory || empty($directory->v)) {
return; return null;
} }
$directoryArr = json_decode($directory->v, true); $directoryArr = json_decode($directory->v, true);
$path = isset($directoryArr['banner_image']) ? $directoryArr['banner_image'] : false; $path = isset($directoryArr['banner_image']) ? $directoryArr['banner_image'] : false;
@ -316,7 +316,7 @@ trait AdminDirectoryController
'public/headers/missing.png', 'public/headers/missing.png',
]; ];
if (! $path || in_array($path, $protected)) { if (! $path || in_array($path, $protected)) {
return; return null;
} }
if (Storage::exists($directoryArr['banner_image'])) { if (Storage::exists($directoryArr['banner_image'])) {
Storage::delete($directoryArr['banner_image']); Storage::delete($directoryArr['banner_image']);

@ -308,7 +308,7 @@ trait AdminReportController
Cache::forget('profiles:private'); Cache::forget('profiles:private');
DeleteAccountPipeline::dispatch($user); DeleteAccountPipeline::dispatch($user);
return; return null;
} }
if ($action == 'dismiss') { if ($action == 'dismiss') {
@ -792,6 +792,7 @@ trait AdminReportController
return [200]; return [200];
} }
return null;
} }
protected function reportsHandleProfileAction($report, $action) protected function reportsHandleProfileAction($report, $action)
@ -819,7 +820,7 @@ trait AdminReportController
} }
if (! $profile) { if (! $profile) {
return; return null;
} }
abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot moderate an admin account.'); abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot moderate an admin account.');
@ -879,7 +880,7 @@ trait AdminReportController
} }
if (! $profile) { if (! $profile) {
return; return null;
} }
abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot moderate an admin account.'); abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot moderate an admin account.');
@ -939,7 +940,7 @@ trait AdminReportController
} }
if (! $profile) { if (! $profile) {
return; return null;
} }
abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot moderate an admin account.'); abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot moderate an admin account.');
@ -1003,7 +1004,7 @@ trait AdminReportController
} }
if (! $profile) { if (! $profile) {
return; return null;
} }
abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot delete an admin account.'); abort_if($profile->user && $profile->user->is_admin, 400, 'Cannot delete an admin account.');
@ -1069,6 +1070,7 @@ trait AdminReportController
return [200]; return [200];
} }
return null;
} }
protected function reportsHandleStatusAction($report, $action) protected function reportsHandleStatusAction($report, $action)
@ -1220,6 +1222,7 @@ trait AdminReportController
return [200]; return [200];
} }
return null;
} }
public function reportsApiSpamAll(Request $request) public function reportsApiSpamAll(Request $request)

@ -53,14 +53,14 @@ class DeleteWorker implements ShouldQueue
if (! $headers) { if (! $headers) {
Log::info('DeleteWorker: Headers not provided, skipping job'); Log::info('DeleteWorker: Headers not provided, skipping job');
return; return null;
} }
// Verify payload exists // Verify payload exists
if (! $payload) { if (! $payload) {
Log::info('DeleteWorker: Payload not provided, skipping job'); Log::info('DeleteWorker: Payload not provided, skipping job');
return; return null;
} }
$payload = json_decode($payload, true, 8); $payload = json_decode($payload, true, 8);
@ -68,13 +68,13 @@ class DeleteWorker implements ShouldQueue
if (! isset($headers['signature']) || ! isset($headers['date'])) { if (! isset($headers['signature']) || ! isset($headers['date'])) {
Log::info('DeleteWorker: Missing signature or date in headers, skipping job'); Log::info('DeleteWorker: Missing signature or date in headers, skipping job');
return; return null;
} }
if (! $headers || ! $payload) { if (! $headers || ! $payload) {
Log::info('DeleteWorker: Empty headers or payload, skipping job'); Log::info('DeleteWorker: Empty headers or payload, skipping job');
return; return null;
} }
if ($payload['type'] === 'Delete' && if ($payload['type'] === 'Delete' &&

@ -119,7 +119,8 @@ class NotificationAppGatewayService
$response->throw(); $response->throw();
} catch (RequestException|Exception) { } catch (RequestException|Exception) {
return; return null;
} }
return null;
} }
} }

@ -1102,7 +1102,7 @@ class Helpers
public static function storePoll($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id) public static function storePoll($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id)
{ {
if (! isset($res['endTime']) || ! isset($res['oneOf']) || ! is_array($res['oneOf']) || count($res['oneOf']) > 4) { if (! isset($res['endTime']) || ! isset($res['oneOf']) || ! is_array($res['oneOf']) || count($res['oneOf']) > 4) {
return; return null;
} }
$options = collect($res['oneOf'])->map(function ($option) { $options = collect($res['oneOf'])->map(function ($option) {

Loading…
Cancel
Save