diff --git a/app/Console/Commands/Admin/AdminInviteCommand.php b/app/Console/Commands/Admin/AdminInviteCommand.php index 96c759f1a..5989ba6de 100644 --- a/app/Console/Commands/Admin/AdminInviteCommand.php +++ b/app/Console/Commands/Admin/AdminInviteCommand.php @@ -26,8 +26,6 @@ final class AdminInviteCommand extends Command /** * Execute the console command. - * - * @return int */ public function handle(): int { diff --git a/app/Console/Commands/Admin/BackupToCloud.php b/app/Console/Commands/Admin/BackupToCloud.php index 08b0a3afa..6afe3f0e3 100644 --- a/app/Console/Commands/Admin/BackupToCloud.php +++ b/app/Console/Commands/Admin/BackupToCloud.php @@ -36,8 +36,6 @@ final class BackupToCloud extends Command /** * Execute the console command. - * - * @return int */ public function handle(): int { diff --git a/app/Console/Commands/Admin/ImportEmojis.php b/app/Console/Commands/Admin/ImportEmojis.php index e86185242..1285c5d52 100644 --- a/app/Console/Commands/Admin/ImportEmojis.php +++ b/app/Console/Commands/Admin/ImportEmojis.php @@ -30,8 +30,6 @@ class ImportEmojis extends Command /** * Execute the console command. - * - * @return int */ public function handle(): int { diff --git a/app/Console/Commands/Admin/SendUpdateActor.php b/app/Console/Commands/Admin/SendUpdateActor.php index 5c2b0fd5d..816485ef6 100644 --- a/app/Console/Commands/Admin/SendUpdateActor.php +++ b/app/Console/Commands/Admin/SendUpdateActor.php @@ -110,6 +110,7 @@ class SendUpdateActor extends Command $instance->actors_last_synced_at = now(); $instance->save(); $this->info('Finished!'); + return Command::SUCCESS; return Command::SUCCESS; diff --git a/app/Console/Commands/Dev/ExportLanguages.php b/app/Console/Commands/Dev/ExportLanguages.php index 9618dc990..5ce3de663 100644 --- a/app/Console/Commands/Dev/ExportLanguages.php +++ b/app/Console/Commands/Dev/ExportLanguages.php @@ -32,8 +32,6 @@ class ExportLanguages extends Command /** * Execute the console command. - * - * @return int */ public function handle(): int { diff --git a/app/Console/Commands/FixBugs/FixMediaDriver.php b/app/Console/Commands/FixBugs/FixMediaDriver.php index 345b0ee0b..2b0866188 100644 --- a/app/Console/Commands/FixBugs/FixMediaDriver.php +++ b/app/Console/Commands/FixBugs/FixMediaDriver.php @@ -27,8 +27,6 @@ class FixMediaDriver extends Command /** * Execute the console command. - * - * @return int */ public function handle(): int { diff --git a/app/Console/Commands/Internal/GarbageCollectorDatabaseSession.php b/app/Console/Commands/Internal/GarbageCollectorDatabaseSession.php index c6899c6e0..a4fee4fdc 100644 --- a/app/Console/Commands/Internal/GarbageCollectorDatabaseSession.php +++ b/app/Console/Commands/Internal/GarbageCollectorDatabaseSession.php @@ -33,8 +33,6 @@ class GarbageCollectorDatabaseSession extends Command /** * Execute the console command. - * - * @return int */ public function handle(): int { diff --git a/app/Console/Commands/Internal/PushGatewayRefresh.php b/app/Console/Commands/Internal/PushGatewayRefresh.php index a0fce3d59..3f51fcc63 100644 --- a/app/Console/Commands/Internal/PushGatewayRefresh.php +++ b/app/Console/Commands/Internal/PushGatewayRefresh.php @@ -55,11 +55,12 @@ class PushGatewayRefresh extends Command $this->line(' '); $this->line('For more info, visit https://docs.pixelfed.org/running-pixelfed/push-notifications.html'); $this->line(' '); + return; return; } exit; - return; + } } diff --git a/app/Console/Commands/User/UserCheckPassword.php b/app/Console/Commands/User/UserCheckPassword.php index 4a5fe6abf..5156c3887 100644 --- a/app/Console/Commands/User/UserCheckPassword.php +++ b/app/Console/Commands/User/UserCheckPassword.php @@ -24,8 +24,6 @@ class UserCheckPassword extends Command /** * Execute the console command. - * - * @return int */ public function handle(): int { diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index ed6ada947..c63855591 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -134,6 +134,7 @@ class AccountController extends Controller if ($request->wantsJson()) { return response()->json($res); } + return redirect()->back(); } @@ -185,6 +186,7 @@ class AccountController extends Controller if ($request->wantsJson()) { return response()->json($res); } + return redirect()->back(); } @@ -270,6 +272,7 @@ class AccountController extends Controller if ($request->wantsJson()) { return response()->json($res); } + return redirect()->back(); } @@ -320,6 +323,7 @@ class AccountController extends Controller if ($request->wantsJson()) { return response()->json($res); } + return redirect()->back(); } diff --git a/app/Http/Controllers/Admin/AdminReportController.php b/app/Http/Controllers/Admin/AdminReportController.php index 245b64cfc..d9b7031e5 100644 --- a/app/Http/Controllers/Admin/AdminReportController.php +++ b/app/Http/Controllers/Admin/AdminReportController.php @@ -792,6 +792,7 @@ trait AdminReportController return [200]; } + return null; } @@ -1070,6 +1071,7 @@ trait AdminReportController return [200]; } + return null; } @@ -1222,6 +1224,7 @@ trait AdminReportController return [200]; } + return null; } diff --git a/app/Http/Controllers/Admin/AdminSettingsController.php b/app/Http/Controllers/Admin/AdminSettingsController.php index d3b3d59b3..e50671609 100644 --- a/app/Http/Controllers/Admin/AdminSettingsController.php +++ b/app/Http/Controllers/Admin/AdminSettingsController.php @@ -865,12 +865,12 @@ trait AdminSettingsController $visibility = $request->input('disk_config.visibility'); $url = $request->input('disk_config.url'); $endpoint = $request->input('disk_config.endpoint'); - if (!str_contains($key, '*') && $key != config_cache($dkey.'key')) { + if (! str_contains($key, '*') && $key != config_cache($dkey.'key')) { array_push($changes, 'key'); } else { $ckey = config_cache($dkey.'key'); } - if (!str_contains($secret, '*') && $secret != config_cache($dkey.'secret')) { + if (! str_contains($secret, '*') && $secret != config_cache($dkey.'secret')) { array_push($changes, 'secret'); } else { $csecret = config_cache($dkey.'secret'); diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index d2f081e0c..2c4016ce6 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -560,6 +560,7 @@ class AdminController extends Controller if ($pg) { return $query->latest(); } + return $query->groupBy('shortcode')->latest(); } if ($sort == 'local') { @@ -584,6 +585,7 @@ class AdminController extends Controller $q = $q->groupBy('shortcode'); } } + return $q; } }) @@ -711,6 +713,7 @@ class AdminController extends Controller if ($filter === 'newest') { return $q->orderByDesc('id'); } + return $q; }) ->cursorPaginate(10) diff --git a/app/Http/Controllers/AdminShadowFilterController.php b/app/Http/Controllers/AdminShadowFilterController.php index c2e05e641..09a9b71b8 100644 --- a/app/Http/Controllers/AdminShadowFilterController.php +++ b/app/Http/Controllers/AdminShadowFilterController.php @@ -27,6 +27,7 @@ class AdminShadowFilterController extends Controller if ($filter == 'inactive') { return $q->whereActive(false); } + return $q; }, function ($q, $filter) { return $q->whereActive(true); diff --git a/app/Http/Controllers/Api/AdminApiController.php b/app/Http/Controllers/Api/AdminApiController.php index 4c4c675bf..6e5cf042e 100644 --- a/app/Http/Controllers/Api/AdminApiController.php +++ b/app/Http/Controllers/Api/AdminApiController.php @@ -601,6 +601,7 @@ class AdminApiController extends Controller AccountService::del($profile->id); DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('high'); } + return [ 'status' => 200, 'msg' => 'deleted', @@ -678,8 +679,7 @@ class AdminApiController extends Controller ->save(); $profile->no_autolink = ! $profile->no_autolink; $profile->save(); - } - else { + } else { $profile->{$action} = filter_var($request->input('value'), FILTER_VALIDATE_BOOLEAN); $profile->save(); @@ -736,6 +736,7 @@ class AdminApiController extends Controller if ($filter === 'all') { return $query; } + return $query->where($filter, true); }) ->when($sortBy, function ($query, $sortBy) use ($sort) { diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index 610fb4170..c4d5166e3 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -1580,6 +1580,7 @@ class ApiV1Controller extends Controller return $this->json($res, 200, ['Link' => $link]); } + return $this->json($res); } @@ -2739,6 +2740,7 @@ class ApiV1Controller extends Controller return response()->json([], 206); } Cache::set('pf:services:apiv1:home:cached:coldbootcheck:'.$pid, 1, 86400); + return response()->json([], 206); } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 9bc5f7c0e..4c1edf2e8 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -156,6 +156,7 @@ class RegisterController extends Controller return view('auth.register'); } + return view('auth.register'); } if ((bool) config_cache('instance.curated_registration.enabled') && config('instance.curated_registration.state.fallback_on_closed_reg')) { diff --git a/app/Http/Controllers/CustomFilterController.php b/app/Http/Controllers/CustomFilterController.php index 253c1add1..f50282653 100644 --- a/app/Http/Controllers/CustomFilterController.php +++ b/app/Http/Controllers/CustomFilterController.php @@ -231,7 +231,6 @@ class CustomFilterController extends Controller * Convert Mastodon filter_action string to internal action value * * @param string $filterAction - * @return int */ private function filterActionToAction($filterAction): int { diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php index beb9e7e92..619bd7679 100644 --- a/app/Http/Controllers/FederationController.php +++ b/app/Http/Controllers/FederationController.php @@ -105,6 +105,7 @@ class FederationController extends Controller return response()->json($webfinger, 200, [], JSON_UNESCAPED_SLASHES) ->header('Access-Control-Allow-Origin', '*'); } + return response('', 400); } $hash = hash('sha256', $resource); @@ -112,7 +113,7 @@ class FederationController extends Controller if ($cached = Cache::get($key)) { return response()->json($cached, 200, [], JSON_UNESCAPED_SLASHES); } - if (!str_contains($resource, $domain)) { + if (! str_contains($resource, $domain)) { return response('', 400); } $parsed = Nickname::normalizeProfileUrl($resource); @@ -205,13 +206,13 @@ class FederationController extends Controller return; } } + return; } if (isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) { dispatch(new InboxValidator($username, $headers, $payload))->onQueue('follow'); - } - else { + } else { dispatch(new InboxValidator($username, $headers, $payload))->onQueue('high'); } } @@ -261,13 +262,13 @@ class FederationController extends Controller return; } } + return; } if (isset($obj['type']) && in_array($obj['type'], ['Follow', 'Accept'])) { dispatch(new InboxWorker($headers, $payload))->onQueue('follow'); - } - else { + } else { dispatch(new InboxWorker($headers, $payload))->onQueue('shared'); } } diff --git a/app/Http/Controllers/Groups/GroupsPostController.php b/app/Http/Controllers/Groups/GroupsPostController.php index 2a6cb113c..40705757f 100644 --- a/app/Http/Controllers/Groups/GroupsPostController.php +++ b/app/Http/Controllers/Groups/GroupsPostController.php @@ -254,6 +254,7 @@ class GroupsPostController extends Controller if ($request->wantsJson()) { return response()->json(['Status successfully deleted.']); } + return redirect($user->url()); } diff --git a/app/Http/Controllers/ImportPostController.php b/app/Http/Controllers/ImportPostController.php index 9acef16ec..2aebcb9fa 100644 --- a/app/Http/Controllers/ImportPostController.php +++ b/app/Http/Controllers/ImportPostController.php @@ -276,8 +276,10 @@ class ImportPostController extends Controller if ($exts->contains('jpg', 'png', 'webp')) { return 'photo:video:album'; } + return 'video:album'; } + return 'photo:album'; } if ($exts->isEmpty()) { @@ -290,6 +292,7 @@ class ImportPostController extends Controller if (in_array($ext, ['mp4'])) { return 'video'; } + return 'photo'; } @@ -316,6 +319,7 @@ class ImportPostController extends Controller if (! $abortOnFail) { return true; } + return true; } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index fbef31907..3a3c22766 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -143,6 +143,7 @@ class ProfileController extends Controller if ($carousel) { return view('profile.show_carousel', ['profile' => $profile, 'settings' => $settings]); } + return view('profile.show', ['profile' => $profile, 'settings' => $settings]); } @@ -160,6 +161,7 @@ class ProfileController extends Controller ->whereUsername($username) ->first(); } + return Profile::withTrashed() ->whereNull(['domain', 'status']) ->whereUsername($username) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 2984234ec..ceec6566f 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -45,6 +45,7 @@ class PublicApiController extends Controller if (! $user) { return []; } + return AccountService::get($user->profile_id); } @@ -482,6 +483,7 @@ class PublicApiController extends Controller ->values() ->toArray(); } + return Status::select( 'id', 'uri', @@ -858,6 +860,7 @@ class PublicApiController extends Controller return $isFollowing ? ['public', 'unlisted', 'private'] : ['public', 'unlisted']; } + return ['public', 'unlisted']; } diff --git a/app/Http/Controllers/RemoteAuthController.php b/app/Http/Controllers/RemoteAuthController.php index dcda8e343..9e4384946 100644 --- a/app/Http/Controllers/RemoteAuthController.php +++ b/app/Http/Controllers/RemoteAuthController.php @@ -556,6 +556,7 @@ class RemoteAuthController extends Controller if ($user) { return ['id' => (string) $user->profile_id]; } + return []; } try { @@ -563,6 +564,7 @@ class RemoteAuthController extends Controller if ($profile) { return ['id' => (string) $profile->id]; } + return []; } catch (RequestException|\Exception) { return []; diff --git a/app/Http/Controllers/SiteController.php b/app/Http/Controllers/SiteController.php index c9e72edd4..c9e3a7f77 100644 --- a/app/Http/Controllers/SiteController.php +++ b/app/Http/Controllers/SiteController.php @@ -25,6 +25,7 @@ class SiteController extends Controller if ($request->user() !== null) { return $this->homeTimeline($request); } + return $this->homeGuest(); } diff --git a/app/Http/Middleware/AccountInterstitial.php b/app/Http/Middleware/AccountInterstitial.php index b7e13dbcd..fed73a5ee 100644 --- a/app/Http/Middleware/AccountInterstitial.php +++ b/app/Http/Middleware/AccountInterstitial.php @@ -35,10 +35,13 @@ class AccountInterstitial return response()->json($res, 403); } + return redirect('/i/warning'); } + return $next($request); } + return $next($request); } } diff --git a/app/Jobs/InboxPipeline/DeleteWorker.php b/app/Jobs/InboxPipeline/DeleteWorker.php index 3c54dbac3..142dc447a 100644 --- a/app/Jobs/InboxPipeline/DeleteWorker.php +++ b/app/Jobs/InboxPipeline/DeleteWorker.php @@ -101,14 +101,17 @@ class DeleteWorker implements ShouldQueue return 1; } + // Signature verification failed, exit. return 1; } + // Remote user doesn't exist, exit early. return 1; return 1; } + return 1; } $profile = null; @@ -117,6 +120,7 @@ class DeleteWorker implements ShouldQueue return 1; } + return 1; } @@ -195,6 +199,7 @@ class DeleteWorker implements ShouldQueue if ($verified == 1) { return true; } + return false; } } diff --git a/app/Jobs/InboxPipeline/InboxWorker.php b/app/Jobs/InboxPipeline/InboxWorker.php index edb3e3f34..4d62120c1 100644 --- a/app/Jobs/InboxPipeline/InboxWorker.php +++ b/app/Jobs/InboxPipeline/InboxWorker.php @@ -160,6 +160,7 @@ class InboxWorker implements ShouldQueue if ($verified == 1) { return true; } + return false; } diff --git a/app/Mail/AdminNewAutospam.php b/app/Mail/AdminNewAutospam.php index 225a949b2..e4d5e8acc 100644 --- a/app/Mail/AdminNewAutospam.php +++ b/app/Mail/AdminNewAutospam.php @@ -69,8 +69,6 @@ class AdminNewAutospam extends Mailable /** * Get the attachments for the message. - * - * @return array */ public function attachments(): array { diff --git a/app/Mail/AdminNewReport.php b/app/Mail/AdminNewReport.php index 5c8d3ca62..701ea4c5f 100644 --- a/app/Mail/AdminNewReport.php +++ b/app/Mail/AdminNewReport.php @@ -90,8 +90,6 @@ class AdminNewReport extends Mailable /** * Get the attachments for the message. - * - * @return array */ public function attachments(): array { diff --git a/app/Mail/ConfirmAppEmail.php b/app/Mail/ConfirmAppEmail.php index e87ae92af..1324563f1 100644 --- a/app/Mail/ConfirmAppEmail.php +++ b/app/Mail/ConfirmAppEmail.php @@ -57,8 +57,6 @@ class ConfirmAppEmail extends Mailable /** * Get the attachments for the message. - * - * @return array */ public function attachments(): array { diff --git a/app/Models/Profile.php b/app/Models/Profile.php index fe9a8b7fd..58e7285bf 100644 --- a/app/Models/Profile.php +++ b/app/Models/Profile.php @@ -225,7 +225,7 @@ class Profile extends Model return url('/storage/avatars/default.jpg'); } - if (!str_starts_with($path, 'public')) { + if (! str_starts_with($path, 'public')) { return url('/storage/avatars/default.jpg'); } diff --git a/app/Policies/CustomFilterPolicy.php b/app/Policies/CustomFilterPolicy.php index bcf9489a3..867aa6be7 100644 --- a/app/Policies/CustomFilterPolicy.php +++ b/app/Policies/CustomFilterPolicy.php @@ -17,8 +17,6 @@ class CustomFilterPolicy /** * Determine whether the user can view the custom filter. - * - * @return bool */ public function view(User $user, CustomFilter $filter): bool { @@ -35,8 +33,6 @@ class CustomFilterPolicy /** * Determine whether the user can update the custom filter. - * - * @return bool */ public function update(User $user, CustomFilter $filter): bool { @@ -45,8 +41,6 @@ class CustomFilterPolicy /** * Determine whether the user can delete the custom filter. - * - * @return bool */ public function delete(User $user, CustomFilter $filter): bool { diff --git a/app/Providers/CaptchaServiceProvider.php b/app/Providers/CaptchaServiceProvider.php index ab1cc44a2..56d98b423 100644 --- a/app/Providers/CaptchaServiceProvider.php +++ b/app/Providers/CaptchaServiceProvider.php @@ -11,7 +11,7 @@ class CaptchaServiceProvider extends ServiceProvider { public function register(): void { - $this->app->singleton('captcha.manager', fn ($app): \App\Services\Captcha\CaptchaManager => new CaptchaManager($app)); + $this->app->singleton('captcha.manager', fn ($app): CaptchaManager => new CaptchaManager($app)); $this->app->alias('captcha.manager', CaptchaManager::class); } diff --git a/app/Services/Federation/ActiveSharedInboxService.php b/app/Services/Federation/ActiveSharedInboxService.php index 9383c262d..8b1a3e5d7 100644 --- a/app/Services/Federation/ActiveSharedInboxService.php +++ b/app/Services/Federation/ActiveSharedInboxService.php @@ -148,8 +148,10 @@ class ActiveSharedInboxService if ($res['version'] === self::CACHE_FILE_VERSION) { return $res; } + return false; } + return false; } diff --git a/app/Services/FollowerService.php b/app/Services/FollowerService.php index ae9780167..8e024815d 100644 --- a/app/Services/FollowerService.php +++ b/app/Services/FollowerService.php @@ -292,7 +292,6 @@ class FollowerService * @param int $profileId * @param int $limit * @param int|null $cursor - * @return array */ public static function getMutualsForDM($profileId, $limit = 20, $cursor = null): array { diff --git a/app/Services/NotificationAppGatewayService.php b/app/Services/NotificationAppGatewayService.php index df3441179..5d4da9ac0 100644 --- a/app/Services/NotificationAppGatewayService.php +++ b/app/Services/NotificationAppGatewayService.php @@ -121,6 +121,7 @@ class NotificationAppGatewayService } catch (RequestException|Exception) { return null; } + return null; } } diff --git a/app/Services/SearchApiV2Service.php b/app/Services/SearchApiV2Service.php index ce1e24488..c79156f52 100644 --- a/app/Services/SearchApiV2Service.php +++ b/app/Services/SearchApiV2Service.php @@ -84,10 +84,10 @@ class SearchApiV2Service $rawQuery = $initalQuery ? $initalQuery : $this->query->input('q'); $query = $rawQuery.'%'; $webfingerQuery = $query; - if (Str::substrCount($rawQuery, '@') == 1 && !str_starts_with($rawQuery, '@')) { + if (Str::substrCount($rawQuery, '@') == 1 && ! str_starts_with($rawQuery, '@')) { $query = '@'.$query; } - if (!str_starts_with($webfingerQuery, '@')) { + if (! str_starts_with($webfingerQuery, '@')) { $webfingerQuery = '@'.$webfingerQuery; } $banned = InstanceService::getBannedDomains() ?? []; @@ -234,16 +234,17 @@ class SearchApiV2Service if (Str::contains($query, 'i/web/profile/')) { return $this->resolveLocalProfileId(); } + return $this->resolveLocalProfile(); } - if (! Helpers::validateUrl($query) && !str_contains($query, '@')) { + if (! Helpers::validateUrl($query) && ! str_contains($query, '@')) { return $default; } if ( ! Str::startsWith($query, 'http') && Str::substrCount($query, '@') == 1 && str_contains($query, '@') && - !str_starts_with($query, '@') + ! str_starts_with($query, '@') ) { try { $res = WebfingerService::lookup('@'.$query, $mastodonMode); @@ -264,6 +265,7 @@ class SearchApiV2Service return $default; } + return $default; } if (Str::substrCount($query, '@') == 2) { @@ -286,6 +288,7 @@ class SearchApiV2Service return $default; } + return $default; } if ($sid = Status::whereUri($query)->first()) { @@ -361,6 +364,7 @@ class SearchApiV2Service 'statuses' => [], ]; } + return $default; } diff --git a/app/Util/ActivityPub/Helpers.php b/app/Util/ActivityPub/Helpers.php index dc8a9f59e..73be46628 100644 --- a/app/Util/ActivityPub/Helpers.php +++ b/app/Util/ActivityPub/Helpers.php @@ -541,6 +541,7 @@ class Helpers if (json_last_error() === JSON_ERROR_NONE) { return $res; } + return false; }); } diff --git a/app/Util/Lexer/Autolink.php b/app/Util/Lexer/Autolink.php index 73f8153ec..06434b2b1 100755 --- a/app/Util/Lexer/Autolink.php +++ b/app/Util/Lexer/Autolink.php @@ -425,7 +425,6 @@ class Autolink extends Regex * * @param string $tweet * @param array $entities - * @return string * * @since 1.1.0 */ @@ -502,7 +501,6 @@ class Autolink extends Regex * convert Object to Array. * * @param mixed $obj - * @return array */ protected function object2array($obj): array { @@ -693,7 +691,6 @@ class Autolink extends Regex } /** - * @param array $entity * @param string $tweet * @return string * @@ -726,7 +723,6 @@ class Autolink extends Regex } /** - * @param array $entity * @return string * * @since 1.1.0 @@ -762,7 +758,6 @@ class Autolink extends Regex } /** - * @param array $entity * @param string $tweet * @return string * @@ -787,8 +782,6 @@ class Autolink extends Regex /** * @param string $text - * @param array $attributes - * @return string * * @since 1.1.0 */ @@ -823,7 +816,6 @@ class Autolink extends Regex * html escape. * * @param string $text - * @return string */ protected function escapeHTML($text): string { diff --git a/app/Util/Lexer/Extractor.php b/app/Util/Lexer/Extractor.php index 28e0c1dba..7453bf416 100755 --- a/app/Util/Lexer/Extractor.php +++ b/app/Util/Lexer/Extractor.php @@ -332,7 +332,7 @@ class Extractor extends Regex } $needle = $this->extractURLWithoutProtocol() ? '.' : ':'; - if (!str_contains($tweet, $needle)) { + if (! str_contains($tweet, $needle)) { return []; } @@ -525,7 +525,6 @@ class Extractor extends Regex * This returns a new array with no overlapping entities. * * @param array $entities - * @return array */ public function removeOverlappingEntities($entities): array { @@ -546,10 +545,6 @@ class Extractor extends Regex /** * sort by entity start index. - * - * @param array $a - * @param array $b - * @return int */ protected function sortEntites(array $a, array $b): int { diff --git a/app/Util/Lexer/HitHighlighter.php b/app/Util/Lexer/HitHighlighter.php index 27d748904..820e61ee7 100755 --- a/app/Util/Lexer/HitHighlighter.php +++ b/app/Util/Lexer/HitHighlighter.php @@ -114,7 +114,7 @@ class HitHighlighter extends Regex $highlightTweet = ''; $tags = ['<'.$this->tag.'>', 'tag.'>']; // Check whether we can simply replace or whether we need to chunk... - if (!str_contains($tweet, '<')) { + if (! str_contains($tweet, '<')) { $ti = 0; // tag increment (for added tags) $highlightTweet = $tweet; foreach ($hits as $hit) { diff --git a/app/Util/Lexer/StringUtils.php b/app/Util/Lexer/StringUtils.php index b0a557514..5d0036788 100755 --- a/app/Util/Lexer/StringUtils.php +++ b/app/Util/Lexer/StringUtils.php @@ -24,7 +24,6 @@ class StringUtils * @param int $start * @param int $length * @param string $encoding - * @return string */ public static function substr($str, $start, $length = null, $encoding = 'UTF-8'): string { @@ -41,7 +40,6 @@ class StringUtils * * @param string $str * @param string $encoding - * @return int */ public static function strlen($str, $encoding = 'UTF-8'): int { diff --git a/app/Util/Lexer/Validator.php b/app/Util/Lexer/Validator.php index 1562eaa94..669284c03 100755 --- a/app/Util/Lexer/Validator.php +++ b/app/Util/Lexer/Validator.php @@ -385,6 +385,7 @@ class Validator extends Regex if (! $optional) { return ($string || $string === '') && $found && $matches[0] === $string; } + return ! (($string || $string === '') && (! $found || $matches[0] !== $string)); } }