add type to return

pull/7361/head
Your Name 5 days ago
parent 0d999f5dda
commit d4e7948a2f

@ -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);

@ -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');
}

@ -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);

@ -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();
}

@ -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;
}

@ -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;
}

@ -35,7 +35,7 @@ class AdminShadowFilterService
});
}
public static function canAddToPublicFeedByProfileId($profileId)
public static function canAddToPublicFeedByProfileId($profileId): bool
{
return ! in_array($profileId, self::getHideFromPublicFeedsList());
}

@ -60,7 +60,7 @@ class AutospamService
});
}
public static function active()
public static function active(): bool
{
return config_cache('autospam.nlp.enabled') && self::eligible();
}

@ -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) {

Loading…
Cancel
Save