Fix phpstan issues

This commit is contained in:
Bubka 2024-11-23 14:29:31 +01:00
parent 4464105de8
commit c409d48bf8
8 changed files with 19 additions and 17 deletions

View File

@ -39,7 +39,7 @@ public function register(AttestedRequest $request) : Response
{ {
$request->save(); $request->save();
Log::info(sprintf('User ID #%s registered a new security device', $request->user()->id)); Log::info(sprintf('User ID #%s registered a new security device', $request->user()->id)); /** @phpstan-ignore property.notFound */
return response()->noContent(); return response()->noContent();
} }

View File

@ -21,15 +21,17 @@ public function handle(Request $request, Closure $next) : Response
$assetUrl = config('app.asset_url') != config('app.url') ? config('app.asset_url') : ''; $assetUrl = config('app.asset_url') != config('app.url') ? config('app.asset_url') : '';
$directives['script-src'] = "script-src 'nonce-" . Vite::cspNonce() . "' " . $assetUrl . ";"; $directives['script-src'] = "script-src 'nonce-" . Vite::cspNonce() . "' " . $assetUrl . ';';
$directives['script-src-elem'] = "script-src-elem 'nonce-" . Vite::cspNonce() . "' " . $assetUrl . " 'strict-dynamic';"; $directives['script-src-elem'] = "script-src-elem 'nonce-" . Vite::cspNonce() . "' " . $assetUrl . " 'strict-dynamic';";
$directives['style-src'] = "style-src 'self' " . $assetUrl . " 'unsafe-inline';"; $directives['style-src'] = "style-src 'self' " . $assetUrl . " 'unsafe-inline';";
$directives['connect-src'] = "connect-src 'self';"; $directives['connect-src'] = "connect-src 'self';";
$directives['img-src'] = "img-src 'self' data: " . $assetUrl . ";"; $directives['img-src'] = "img-src 'self' data: " . $assetUrl . ';';
$directives['object-src'] = "object-src 'none';"; $directives['object-src'] = "object-src 'none';";
$csp = implode(' ', $directives); $csp = implode(' ', $directives);
/** @disregard Undefined function */
/** @phpstan-ignore-next-line */
return $next($request)->withHeaders([ return $next($request)->withHeaders([
'Content-Security-Policy' => $csp, 'Content-Security-Policy' => $csp,
]); ]);

View File

@ -101,7 +101,7 @@ class AuthLog extends Model
/** /**
* MorphTo relation to get the associated authenticatable user * MorphTo relation to get the associated authenticatable user
* *
* @return MorphTo<\Illuminate\Database\Eloquent\Model, AuthLog> * @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model, $this>
*/ */
public function authenticatable() public function authenticatable()
{ {

View File

@ -106,7 +106,7 @@ protected static function boot()
/** /**
* Get the TwoFAccounts of the group. * Get the TwoFAccounts of the group.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany<TwoFAccount> * @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\TwoFAccount, $this>
*/ */
public function twofaccounts() public function twofaccounts()
{ {
@ -116,7 +116,7 @@ public function twofaccounts()
/** /**
* Get the user that owns the group. * Get the user that owns the group.
* *
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, \App\Models\Group> * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, $this>
*/ */
public function user() public function user()
{ {

View File

@ -58,7 +58,7 @@ class Icon extends Model
/** /**
* Get the twofaccount that owns the icon. * Get the twofaccount that owns the icon.
* *
* @return BelongsTo<\App\Models\TwoFAccount, \App\Models\Icon> * @return BelongsTo<\App\Models\TwoFAccount, $this>
*/ */
public function twofaccount() : BelongsTo public function twofaccount() : BelongsTo
{ {

View File

@ -32,7 +32,7 @@ trait HasAuthenticationLog
/** /**
* Get all user's authentications from the auth log * Get all user's authentications from the auth log
* *
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<AuthLog> * @return \Illuminate\Database\Eloquent\Relations\MorphMany<\App\Models\AuthLog, $this>
*/ */
public function authentications() public function authentications()
{ {
@ -56,7 +56,7 @@ public function authenticationsByPeriod(int $period = 1)
/** /**
* Get the user's latest authentication * Get the user's latest authentication
* *
* @return \Illuminate\Database\Eloquent\Relations\MorphOne<AuthLog> * @return \Illuminate\Database\Eloquent\Relations\MorphOne<\App\Models\AuthLog, $this>
*/ */
public function latestAuthentication() public function latestAuthentication()
{ {

View File

@ -227,7 +227,7 @@ protected static function boot()
/** /**
* Get the user that owns the twofaccount. * Get the user that owns the twofaccount.
* *
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, \App\Models\TwoFAccount> * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, $this>
*/ */
public function user() public function user()
{ {
@ -237,7 +237,7 @@ public function user()
/** /**
* Get the relation between the icon resource and the model. * Get the relation between the icon resource and the model.
* *
* @return HasOne<\App\Models\Icon> * @return HasOne<\App\Models\Icon, $this>
*/ */
public function iconResource() : HasOne public function iconResource() : HasOne
{ {
@ -658,7 +658,7 @@ private function initGenerator() : void
} }
/** /**
* @return \Illuminate\Database\Eloquent\Builder<TwoFAccount> * @return \Illuminate\Database\Eloquent\Builder<static>
*/ */
public function buildSortQuery() public function buildSortQuery()
{ {

View File

@ -242,7 +242,7 @@ static function ($query) use ($id) {
/** /**
* Get the TwoFAccounts of the user. * Get the TwoFAccounts of the user.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany<TwoFAccount> * @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\TwoFAccount, $this>
*/ */
public function twofaccounts() public function twofaccounts()
{ {
@ -252,7 +252,7 @@ public function twofaccounts()
/** /**
* Get the Groups of the user. * Get the Groups of the user.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany<Group> * @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\Group, $this>
*/ */
public function groups() public function groups()
{ {