diff --git a/app/Console/Commands/Admin/ImportEmojis.php b/app/Console/Commands/Admin/ImportEmojis.php index 43500fbf2..3d982b7e3 100644 --- a/app/Console/Commands/Admin/ImportEmojis.php +++ b/app/Console/Commands/Admin/ImportEmojis.php @@ -104,14 +104,14 @@ class ImportEmojis extends Command return Command::SUCCESS; } - private function isImage($file) + private function isImage($file): bool { $image = getimagesize($file->getPathname()); return $image !== false; } - private function isEmoji($filename) + private function isEmoji($filename): bool { $allowedMimeTypes = ['image/png', 'image/jpeg', 'image/webp', 'image/jpg']; $mimeType = mime_content_type($filename); diff --git a/app/Console/Commands/FixBugs/AvatarStorageDeepClean.php b/app/Console/Commands/FixBugs/AvatarStorageDeepClean.php index c2d60561a..2c1b59cc6 100644 --- a/app/Console/Commands/FixBugs/AvatarStorageDeepClean.php +++ b/app/Console/Commands/FixBugs/AvatarStorageDeepClean.php @@ -95,7 +95,7 @@ class AvatarStorageDeepClean extends Command } } - protected function activeCheck() + protected function activeCheck(): bool { return ! Storage::exists('avatar-deep-clean.json') && ! Cache::has('cmd:asdp'); } diff --git a/app/Jobs/InboxPipeline/InboxWorker.php b/app/Jobs/InboxPipeline/InboxWorker.php index be268afbb..87f0f8636 100644 --- a/app/Jobs/InboxPipeline/InboxWorker.php +++ b/app/Jobs/InboxPipeline/InboxWorker.php @@ -182,7 +182,7 @@ class InboxWorker implements ShouldQueue * path is not, a single trailing slash is ignored. Query and fragment * are part of the comparison so they cannot be used to alias an actor. */ - protected static function sameActorUrl($a, $b) + protected static function sameActorUrl($a, $b): bool { $a = self::normalizeUrl($a); $b = self::normalizeUrl($b); diff --git a/app/Models/CustomFilter.php b/app/Models/CustomFilter.php index d6f3404ca..5d8ae1c5f 100644 --- a/app/Models/CustomFilter.php +++ b/app/Models/CustomFilter.php @@ -124,7 +124,7 @@ class CustomFilter extends Model $this->attributes['action'] = $value ? self::ACTION_HIDE : self::ACTION_WARN; } - public function getIrreversibleAttribute() + public function getIrreversibleAttribute(): bool { return $this->action === self::ACTION_HIDE; } @@ -153,7 +153,7 @@ class CustomFilter extends Model }); } - public function isExpired() + public function isExpired(): bool { return $this->expires_at !== null && $this->expires_at->isPast(); } diff --git a/app/Models/DirectMessage.php b/app/Models/DirectMessage.php index f7eaf2525..92bec7c53 100644 --- a/app/Models/DirectMessage.php +++ b/app/Models/DirectMessage.php @@ -28,7 +28,7 @@ class DirectMessage extends Model return $this->belongsTo(Profile::class, 'to_id', 'id'); } - public function me() + public function me(): bool { return Auth::user()->profile->id === $this->from_id; } diff --git a/app/Policies/CustomFilterPolicy.php b/app/Policies/CustomFilterPolicy.php index 456f74308..bcf9489a3 100644 --- a/app/Policies/CustomFilterPolicy.php +++ b/app/Policies/CustomFilterPolicy.php @@ -20,7 +20,7 @@ class CustomFilterPolicy * * @return bool */ - public function view(User $user, CustomFilter $filter) + public function view(User $user, CustomFilter $filter): bool { return $user->profile_id === $filter->profile_id; } @@ -38,7 +38,7 @@ class CustomFilterPolicy * * @return bool */ - public function update(User $user, CustomFilter $filter) + public function update(User $user, CustomFilter $filter): bool { return $user->profile_id === $filter->profile_id; } @@ -48,7 +48,7 @@ class CustomFilterPolicy * * @return bool */ - public function delete(User $user, CustomFilter $filter) + public function delete(User $user, CustomFilter $filter): bool { return $user->profile_id === $filter->profile_id; } diff --git a/app/Services/AdminShadowFilterService.php b/app/Services/AdminShadowFilterService.php index 34ed7cdff..76601f43b 100644 --- a/app/Services/AdminShadowFilterService.php +++ b/app/Services/AdminShadowFilterService.php @@ -35,7 +35,7 @@ class AdminShadowFilterService }); } - public static function canAddToPublicFeedByProfileId($profileId) + public static function canAddToPublicFeedByProfileId($profileId): bool { return ! in_array($profileId, self::getHideFromPublicFeedsList()); } diff --git a/app/Services/AutospamService.php b/app/Services/AutospamService.php index f0acbcd92..f8cc09569 100644 --- a/app/Services/AutospamService.php +++ b/app/Services/AutospamService.php @@ -60,7 +60,7 @@ class AutospamService }); } - public static function active() + public static function active(): bool { return config_cache('autospam.nlp.enabled') && self::eligible(); } diff --git a/app/Util/Lexer/Validator.php b/app/Util/Lexer/Validator.php index b3b0f949c..01b132a58 100755 --- a/app/Util/Lexer/Validator.php +++ b/app/Util/Lexer/Validator.php @@ -379,7 +379,7 @@ class Validator extends Regex * @param bool $optional Whether a match is compulsory or not. * @return bool Whether an exact match was found. */ - protected static function isValidMatch($string, $pattern, $optional = false) + protected static function isValidMatch($string, $pattern, $optional = false): bool { $found = preg_match($pattern, $string, $matches); if (! $optional) {