Add phpstan level 7(#544)

This commit is contained in:
Saeed Vaziry
2025-03-12 13:31:10 +01:00
committed by GitHub
parent c22bb1fa80
commit 493cbb0849
437 changed files with 4505 additions and 2193 deletions

View File

@ -14,16 +14,22 @@
class ServersList extends Widget
{
/**
* @return Builder<Server>
*/
protected function getTableQuery(): Builder
{
return Server::query()->where('project_id', auth()->user()->current_project_id);
/** @var \App\Models\User $user */
$user = auth()->user();
return Server::query()->where('project_id', $user->current_project_id);
}
protected function getTableColumns(): array
{
return [
IconColumn::make('provider')
->icon(fn (Server $record) => 'icon-'.$record->provider)
->icon(fn (Server $record): string => 'icon-'.$record->provider)
->tooltip(fn (Server $record) => $record->provider)
->width(24),
TextColumn::make('name')
@ -53,17 +59,20 @@ protected function getTableColumns(): array
public function table(Table $table): Table
{
/** @var \App\Models\User $user */
$user = auth()->user();
return $table
->heading(null)
->query($this->getTableQuery())
->columns($this->getTableColumns())
->recordUrl(fn (Server $record) => View::getUrl(parameters: ['server' => $record]))
->recordUrl(fn (Server $record): string => View::getUrl(parameters: ['server' => $record]))
->actions([
Action::make('settings')
->label('Settings')
->icon('heroicon-o-cog-6-tooth')
->authorize(fn ($record) => auth()->user()->can('update', $record))
->url(fn (Server $record) => Settings::getUrl(parameters: ['server' => $record])),
->authorize(fn ($record) => $user->can('update', $record))
->url(fn (Server $record): string => Settings::getUrl(parameters: ['server' => $record])),
]);
}
}