Fix pint issues

This commit is contained in:
Bubka 2024-11-09 10:18:45 +01:00
parent 6158c6940b
commit fee7a684b2
32 changed files with 126 additions and 120 deletions

View File

@ -34,8 +34,8 @@ public function upload(Request $request)
$name = Helpers::getRandomFilename($icon->extension());
$isStored = IconStore::store($name, $content);
}
} catch (Exception) {
}
catch (Exception) { }
}
return $isStored

View File

@ -17,6 +17,7 @@
* @property int|null $period
* @property int|null $counter
* @property string $legacy_uri
*
* @method string getURI()
*/
class TwoFAccountExportResource extends JsonResource

View File

@ -10,14 +10,12 @@ class ToggleIconReplicationToDatabase
/**
* Create the event listener.
*/
public function __construct()
{
}
public function __construct() {}
/**
* Handle the event.
*/
public function handle(storeIconsInDatabaseSettingChanged $event): void
public function handle(storeIconsInDatabaseSettingChanged $event) : void
{
IconStore::setDatabaseReplication($event->newValue);
}

View File

@ -43,7 +43,9 @@
* @property string|null $method
* @property string|null $login_method
* @property-read Model|\Eloquent $authenticatable
*
* @mixin \Eloquent
*
* @method static \Database\Factories\AuthLogFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|AuthLog newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|AuthLog newQuery()

View File

@ -20,6 +20,7 @@
* @property int|null $user_id
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TwoFAccount[] $twofaccounts
* @property-read \App\Models\User|null $user
*
* @method static \Database\Factories\GroupFactory factory(...$parameters)
* @method static \Illuminate\Database\Eloquent\Builder|Group newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Group newQuery()
@ -29,7 +30,9 @@
* @method static \Illuminate\Database\Eloquent\Builder|Group whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|Group whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Group whereUserId($value)
*
* @mixin \Eloquent
*
* @method static \Illuminate\Database\Eloquent\Builder|Group orphans()
*/
class Group extends Model

View File

@ -17,6 +17,7 @@
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\TwoFAccount|null $twofaccount
*
* @method static \Database\Factories\IconFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|Icon newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Icon newQuery()
@ -31,7 +32,7 @@ class Icon extends Model
/**
* @use HasFactory<IconFactory>
*/
use HasFactory, CanEncryptField;
use CanEncryptField, HasFactory;
/**
* The primary key for the model.
@ -40,7 +41,6 @@ class Icon extends Model
*/
protected $primaryKey = 'name';
/**
* The "type" of the primary key ID.
*

View File

@ -10,12 +10,14 @@
* @property int $id
* @property string $key
* @property string $value
*
* @method static \Illuminate\Database\Eloquent\Builder|Option newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Option newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Option query()
* @method static \Illuminate\Database\Eloquent\Builder|Option whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Option whereKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|Option whereValue($value)
*
* @mixin \Eloquent
*/
class Option extends Model

View File

@ -70,8 +70,11 @@
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereService($value)
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereUserId($value)
*
* @mixin \Eloquent
*
* @property-read \App\Models\Icon|null $iconResource
*
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount orphans()
*/
class TwoFAccount extends Model implements Sortable
@ -79,7 +82,7 @@ class TwoFAccount extends Model implements Sortable
/**
* @use HasFactory<TwoFAccountFactory>
*/
use HasFactory, SortableTrait, CanEncryptField;
use CanEncryptField, HasFactory, SortableTrait;
const TOTP = 'totp';
@ -236,7 +239,7 @@ public function user()
*
* @return HasOne<\App\Models\Icon>
*/
public function iconResource(): HasOne
public function iconResource() : HasOne
{
return $this->hasOne(Icon::class, 'name', 'icon');
}

View File

@ -47,6 +47,7 @@
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\AuthLog> $authentications
* @property-read int|null $authentications_count
* @property-read \App\Models\AuthLog|null $latestAuthentication
*
* @method static \Illuminate\Database\Eloquent\Builder|User admins()
* @method static \Database\Factories\UserFactory factory(...$parameters)
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
@ -63,7 +64,9 @@
* @method static \Illuminate\Database\Eloquent\Builder|User wherePreferences($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereRememberToken($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value)
*
* @mixin \Eloquent
*
* @method static \Illuminate\Database\Eloquent\Builder|User whereOauthId($value)
* @method static \Illuminate\Database\Eloquent\Builder|User whereOauthProvider($value)
*/

View File

@ -4,8 +4,8 @@
use App\Events\GroupDeleted;
use App\Events\GroupDeleting;
use App\Events\storeIconsInDatabaseSettingChanged;
use App\Events\ScanForNewReleaseCalled;
use App\Events\storeIconsInDatabaseSettingChanged;
use App\Events\TwoFAccountDeleted;
use App\Events\VisitedByProxyUser;
use App\Listeners\Authentication\FailedLoginListener;
@ -15,10 +15,10 @@
use App\Listeners\CleanIconStorage;
use App\Listeners\DissociateTwofaccountFromGroup;
use App\Listeners\LogNotificationListener;
use App\Listeners\ToggleIconReplicationToDatabase;
use App\Listeners\RegisterOpenId;
use App\Listeners\ReleaseRadar;
use App\Listeners\ResetUsersPreference;
use App\Listeners\ToggleIconReplicationToDatabase;
use App\Models\User;
use App\Observers\UserObserver;
use Illuminate\Auth\Events\Failed;

View File

@ -3,8 +3,8 @@
namespace App\Providers;
use App\Factories\MigratorFactoryInterface;
use App\Services\IconStoreService;
use App\Services\IconService;
use App\Services\IconStoreService;
use App\Services\LogoService;
use App\Services\ReleaseRadarService;
use App\Services\SettingService;

View File

@ -19,7 +19,7 @@ class IconStoreService
/**
* The storage disk to use
*/
protected string|null $disk;
protected ?string $disk;
/**
* Icon replication to database to ease backup
@ -73,8 +73,7 @@ public function setDatabaseReplication(bool $usesDatabase) : void
if ($usesDatabase) {
$this->clearDatabase();
$this->mirrorDiskToDatabase();
}
else {
} else {
$this->mirrorDatabaseToDisk();
$this->clearDatabase();
}

View File

@ -3,8 +3,8 @@
namespace App\Services\Migrators;
use App\Exceptions\InvalidMigrationDataException;
use App\Services\IconService;
use App\Models\TwoFAccount;
use App\Services\IconService;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\App;

View File

@ -3,8 +3,8 @@
namespace App\Services\Migrators;
use App\Exceptions\InvalidMigrationDataException;
use App\Services\IconService;
use App\Models\TwoFAccount;
use App\Services\IconService;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\App;

View File

@ -4,7 +4,6 @@
use App\Facades\IconStore;
use App\Models\AuthLog;
use App\Models\Dto\IconDto;
use App\Models\Group;
use App\Models\TwoFAccount;
use App\Models\User;

View File

@ -115,7 +115,7 @@ public static function supportedMimeTypesProvider()
'BPM' => [
OtpTestData::ICON_BMP,
OtpTestData::ICON_BMP_DATA,
'image/bmp|image/x-ms-bmp'
'image/bmp|image/x-ms-bmp',
],
'SVG' => [
OtpTestData::ICON_SVG,

View File

@ -8,13 +8,11 @@
use App\Facades\Settings;
use App\Models\Icon;
use App\Models\TwoFAccount;
use App\Services\IconStoreService;
use App\Services\SettingService;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Event;
use Mockery\MockInterface;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;

View File

@ -3,7 +3,6 @@
namespace Tests\Unit\Listeners;
use App\Events\TwoFAccountDeleted;
use App\Facades\Settings;
use App\Listeners\CleanIconStorage;
use App\Models\TwoFAccount;
use App\Services\IconStoreService;

View File

@ -6,7 +6,6 @@
use App\Exceptions\InvalidMigrationDataException;
use App\Exceptions\UnsupportedMigrationException;
use App\Facades\Icons;
use App\Facades\IconStore;
use App\Factories\MigratorFactory;
use App\Models\TwoFAccount;
use App\Providers\MigrationServiceProvider;

View File

@ -149,7 +149,7 @@ public function test_user_relation()
#[Test]
public function test_twofaccount_relation()
{
$model = new Icon();
$model = new Icon;
$relation = $model->twofaccount();
$this->assertInstanceOf(BelongsTo::class, $relation);