Merge pull request #6954 from pixelfed/add-psalm-report-script

Add psalm report script
pull/6956/head
Shlee 4 weeks ago committed by GitHub
commit 1f85fc8da2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

2
.gitignore vendored

@ -1,3 +1,5 @@
/redis-data
/mysql-9-data
.DS_Store
/.bash_history
/.bash_profile

@ -4,7 +4,7 @@ namespace App\Auth;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
class BearerTokenResponse extends \League\OAuth2\Server\ResponseTypes\BearerTokenResponse
final class BearerTokenResponse extends \League\OAuth2\Server\ResponseTypes\BearerTokenResponse
{
/**
* Add custom fields to your Bearer Token response here, then override

@ -8,7 +8,7 @@ use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Validator;
class AdminInviteCommand extends Command
final class AdminInviteCommand extends Command
{
/**
* The name and signature of the console command.
@ -62,7 +62,7 @@ class AdminInviteCommand extends Command
};
}
protected function handleExpiredInvites()
protected function handleExpiredInvites(): void
{
AdminInvite::whereNotNull('expires_at')->where('expires_at', '<', now())->delete();
}
@ -81,7 +81,7 @@ class AdminInviteCommand extends Command
$message = $this->ask('Invite Message (optional)', 'You\'ve been invited to join');
$this->info('Set maximum # of invite uses, use 0 for unlimited');
$max_uses = $this->ask('Max uses', 1);
$max_uses = $this->ask('Max uses', '1');
$expires = match ($this->choice(
'Set an invite expiry date?',
@ -95,7 +95,7 @@ class AdminInviteCommand extends Command
'Yes - expire after 24 hours' => now()->addHours(24),
'No - invite never expires' => null,
'Custom - let me pick an expiry date' => now()->addDays(
(int) $this->ask('Custom expiry date in days', 14)
(int) $this->ask('Custom expiry date in days', '14')
),
};
@ -145,7 +145,9 @@ class AdminInviteCommand extends Command
AdminInvite::all(['invite_code', 'max_uses', 'uses', 'expires_at'])->map(function ($invite) {
return [
'invite_code' => $invite->invite_code,
'uses_left' => $invite->max_uses ? ($invite->max_uses - $invite->uses) : '∞',
'uses_left' => $invite->max_uses !== null && $invite->max_uses > 0
? ($invite->max_uses - $invite->uses)
: '∞',
'expires_at' => $invite->expires_at ? $invite->expires_at->diffForHumans() : 'never',
];
})->toArray()
@ -156,7 +158,7 @@ class AdminInviteCommand extends Command
protected function expire(): int
{
$token = $this->anticipate('Enter invite code to expire', function ($val) {
$token = $this->anticipate('Enter invite code to expire', function (string $val) {
return AdminInvite::query()
->where('invite_code', 'like', "%$val%")
->pluck('invite_code')

@ -7,7 +7,7 @@ use Illuminate\Http\File;
use Illuminate\Support\Facades\Storage;
use Spatie\Backup\BackupDestination\BackupDestination;
class BackupToCloud extends Command
final class BackupToCloud extends Command
{
/**
* The name and signature of the console command.
@ -58,12 +58,26 @@ class BackupToCloud extends Command
}
$newest = $backupDestination->newestBackup();
if ($newest === null) {
$this->error('No backup found to upload.');
return Command::FAILURE;
}
$name = $newest->path();
$parts = explode('/', $name);
$fileName = array_pop($parts);
$storagePath = 'backups';
$path = storage_path('app/'.$name);
$file = $cloudDisk->putFileAs($storagePath, new File($path), $fileName, 'private');
if ($file === false) {
$this->error('Failed to upload the backup to cloud storage.');
return Command::FAILURE;
}
$this->info('Backup file successfully saved!');
$url = $cloudDisk->url($file);
$this->table(

@ -6,7 +6,7 @@ use App\Models\User;
use App\Services\EmailService;
use Illuminate\Console\Command;
class BannedEmailCheck extends Command
final class BannedEmailCheck extends Command
{
/**
* The name and signature of the console command.
@ -34,10 +34,8 @@ class BannedEmailCheck extends Command
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
public function handle(): void
{
$users = User::whereNull('status')->get()->filter(function ($u) {
return EmailService::isBanned($u->email) == true;

@ -8,7 +8,7 @@ use Illuminate\Console\Command;
use function Laravel\Prompts\confirm;
use function Laravel\Prompts\info;
class CaptchaToggleCommand extends Command
final class CaptchaToggleCommand extends Command
{
/**
* The name and signature of the console command.
@ -27,7 +27,7 @@ class CaptchaToggleCommand extends Command
/**
* Execute the console command.
*/
public function handle()
public function handle(): void
{
$captchaEnabled = (bool) config_cache('captcha.enabled');

@ -2,9 +2,13 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
/**
* @method static Builder|AdminInvite whereInviteCode(string $value)
*/
class AdminInvite extends Model
{
protected $guarded = [];
@ -20,7 +24,7 @@ class AdminInvite extends Model
protected static function booted(): void
{
static::creating(function (AdminInvite $invite) {
$invite->invite_code = Str::uuid().Str::random(random_int(1, 6));
$invite->invite_code = (string) Str::uuid().Str::random(random_int(1, 6));
});
}

@ -4,6 +4,7 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorLevel="8"
phpVersion="8.4"
findUnusedCode="false"
ensureOverrideAttribute="false"
errorBaseline="psalm-baseline.xml"

Loading…
Cancel
Save