add type to function

pull/7361/head
Your Name 6 days ago
parent 9fde74082a
commit 32d1c0e7cc

@ -29,7 +29,7 @@ final class AdminInviteCommand extends Command
*
* @return int
*/
public function handle()
public function handle(): int
{
$this->info(' ____ _ ______ __ ');
$this->info(' / __ \(_) _____ / / __/__ ____/ / ');

@ -39,7 +39,7 @@ final class BackupToCloud extends Command
*
* @return int
*/
public function handle()
public function handle(): int
{
$localDisk = Storage::disk('local');
$cloudDisk = Storage::disk('backup');

@ -33,7 +33,7 @@ class ImportEmojis extends Command
*
* @return int
*/
public function handle()
public function handle(): int
{
$path = $this->argument('path');

@ -42,7 +42,7 @@ class MediaUpdateS3CDNUrl extends Command
*/
protected ?string $oldHost = null;
public function handle()
public function handle(): int
{
// This command only makes sense for instances serving media from a
// cloud/object-storage backend. Local-storage instances (PF_ENABLE_CLOUD

@ -24,7 +24,7 @@ class ComposerPostInstallCommand extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): int
{
try {
SoftwareUpdateService::get(true);

@ -35,7 +35,7 @@ class ExportLanguages extends Command
*
* @return int
*/
public function handle()
public function handle(): int
{
if (config('app.env') !== 'local') {
$this->error('This command is meant for development purposes and should only be run in a local environment');

@ -30,7 +30,7 @@ class FixMediaDriver extends Command
*
* @return int
*/
public function handle()
public function handle(): int
{
if (config('filesystems.default') !== 'local') {
$this->error('Invalid default filesystem, set FILESYSTEM_DRIVER=local to proceed');

@ -36,7 +36,7 @@ class GarbageCollectorDatabaseSession extends Command
*
* @return int
*/
public function handle()
public function handle(): int
{
if (config('session.driver') !== 'database') {
return Command::SUCCESS;

@ -28,7 +28,7 @@ class ReclaimUsername extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): int
{
$username = search(
label: 'What username would you like to reclaim?',

@ -27,7 +27,7 @@ class UserCheckPassword extends Command
*
* @return int
*/
public function handle()
public function handle(): int
{
$id = $this->argument('id');

@ -233,7 +233,7 @@ class CustomFilterController extends Controller
* @param string $filterAction
* @return int
*/
private function filterActionToAction($filterAction)
private function filterActionToAction($filterAction): int
{
switch ($filterAction) {
case 'warn':

@ -238,7 +238,7 @@ class ImportService
}, 3);
}
public static function getPostCount($profileId, $refresh = false)
public static function getPostCount($profileId, $refresh = false): int
{
$key = self::CACHE_KEY.'totalPostCountByProfileId:'.$profileId;
if ($refresh) {
@ -250,7 +250,7 @@ class ImportService
}));
}
public static function getAttempts($profileId)
public static function getAttempts($profileId): int
{
$key = self::CACHE_KEY.'attemptsByProfileId:'.$profileId;

@ -58,7 +58,7 @@ class SoftwareUpdateService
];
}
public static function compareVersions($current, $latest)
public static function compareVersions($current, $latest): int
{
return version_compare(
self::normalizeVersion($current),

@ -431,7 +431,7 @@ class NotificationService
return self::del($id, $val);
}
public static function count($id)
public static function count($id): int
{
return (int) Redis::zcard(self::CACHE_KEY.$id);
}

@ -24,7 +24,7 @@ class SnowflakeService
| 0;
}
public static function next()
public static function next(): int
{
/*
* Atomically obtain the next sequence value. Cache::increment()

@ -187,7 +187,7 @@ class StoryService
return Redis::srem('pf:stories:rotate-queue', $id);
}
public static function reactIncrement($storyId, $profileId)
public static function reactIncrement($storyId, $profileId): int
{
$key = 'pf:stories:react-counter:storyid-'.$storyId.':profileid-'.$profileId;
@ -199,7 +199,7 @@ class StoryService
return $count;
}
public static function reactCounter($storyId, $profileId)
public static function reactCounter($storyId, $profileId): int
{
$key = 'pf:stories:react-counter:storyid-'.$storyId.':profileid-'.$profileId;

@ -157,12 +157,12 @@ class UserFilterService
return $exists;
}
public static function blockCount(int $profile_id)
public static function blockCount(int $profile_id): int
{
return count(self::blocks($profile_id));
}
public static function muteCount(int $profile_id)
public static function muteCount(int $profile_id): int
{
return count(self::mutes($profile_id));
}

@ -38,7 +38,7 @@ class UserStorageService
return $updatedAt->lt(now()->subHours(self::STALE_AFTER_HOURS));
}
public static function get($id)
public static function get($id): int
{
$user = User::find($id);
if (! $user || $user->status) {
@ -58,7 +58,7 @@ class UserStorageService
return (int) $user->storage_used;
}
public static function calculateStorageUsed($id)
public static function calculateStorageUsed($id): int
{
return (int) floor(Media::whereUserId($id)->sum('size') / 1000);
}

@ -551,7 +551,7 @@ class Extractor extends Regex
* @param array $b
* @return int
*/
protected function sortEntites($a, $b)
protected function sortEntites($a, $b): int
{
if ($a['indices'][0] == $b['indices'][0]) {
return 0;

@ -43,7 +43,7 @@ class StringUtils
* @param string $encoding
* @return int
*/
public static function strlen($str, $encoding = 'UTF-8')
public static function strlen($str, $encoding = 'UTF-8'): int
{
return mb_strlen($str, $encoding);
}

@ -29,12 +29,12 @@ trait User
return 500;
}
public function getMaxLikesPerHourAttribute()
public function getMaxLikesPerHourAttribute(): int
{
return $this->isTrustedAccount() ? 120 : 10;
}
public function getMaxLikesPerDayAttribute()
public function getMaxLikesPerDayAttribute(): int
{
return $this->isTrustedAccount() ? 200 : 20;
}

Loading…
Cancel
Save