Larastan Level 6

This commit is contained in:
Refringe 2025-01-30 20:49:56 -05:00
parent a5dcaed179
commit 1c6a749d71
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k
52 changed files with 262 additions and 28 deletions

View File

@ -10,6 +10,8 @@ trait PasswordValidationRules
{ {
/** /**
* Get the validation rules used to validate passwords. * Get the validation rules used to validate passwords.
*
* @return array<int, Password|string>
*/ */
protected function passwordRules(): array protected function passwordRules(): array
{ {

View File

@ -15,6 +15,8 @@ class ResetUserPassword implements ResetsUserPasswords
/** /**
* Validate and reset the user's forgotten password. * Validate and reset the user's forgotten password.
*
* @param array<string, string> $input
*/ */
public function reset(User $user, array $input): void public function reset(User $user, array $input): void
{ {

View File

@ -15,6 +15,8 @@ class UpdateUserPassword implements UpdatesUserPasswords
/** /**
* Validate and update the user's password. * Validate and update the user's password.
*
* @param array<string, mixed> $input
*/ */
public function update(User $user, array $input): void public function update(User $user, array $input): void
{ {

View File

@ -13,6 +13,8 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{ {
/** /**
* Validate and update the given user's profile information. * Validate and update the given user's profile information.
*
* @param array<string, mixed> $input
*/ */
public function update(User $user, array $input): void public function update(User $user, array $input): void
{ {

View File

@ -14,6 +14,8 @@ class ApiController extends Controller
/** /**
* Determine if the given relationship should be included in the request. If more than one relationship is provided, * Determine if the given relationship should be included in the request. If more than one relationship is provided,
* only one needs to be present in the request for this method to return true. * only one needs to be present in the request for this method to return true.
*
* @param string|array<int, string> $relationships
*/ */
public static function shouldInclude(string|array $relationships): bool public static function shouldInclude(string|array $relationships): bool
{ {

View File

@ -21,6 +21,8 @@ class SocialiteController extends Controller
{ {
/** /**
* The providers that are supported. * The providers that are supported.
*
* @var array<int, string>
*/ */
protected array $providers = ['discord']; protected array $providers = ['discord'];

View File

@ -12,22 +12,29 @@ class ModFilter
{ {
/** /**
* The query builder instance for the mod model. * The query builder instance for the mod model.
*
* @var Builder<Mod>
*/ */
protected Builder $builder; protected Builder $builder;
/** /**
* Create a new ModFilter instance. * Create a new ModFilter instance.
*/ */
public function __construct(/** public function __construct(
* The filters to apply. /**
*/ * The filters to apply to the query.
protected array $filters) *
{ * @var array<string, mixed>
*/
protected array $filters
) {
$this->builder = $this->baseQuery(); $this->builder = $this->baseQuery();
} }
/** /**
* The base query for the mod listing. * The base query for the mod listing.
*
* @return Builder<Mod>
*/ */
private function baseQuery(): Builder private function baseQuery(): Builder
{ {
@ -50,6 +57,8 @@ class ModFilter
/** /**
* Filter the results by the given search term. * Filter the results by the given search term.
*
* @return Builder<Mod>
*/ */
private function query(string $term): Builder private function query(string $term): Builder
{ {
@ -58,6 +67,8 @@ class ModFilter
/** /**
* Apply the filters to the query. * Apply the filters to the query.
*
* @return Builder<Mod>
*/ */
public function apply(): Builder public function apply(): Builder
{ {
@ -72,6 +83,8 @@ class ModFilter
/** /**
* Order the query by the given type. * Order the query by the given type.
*
* @return Builder<Mod>
*/ */
private function order(string $type): Builder private function order(string $type): Builder
{ {
@ -84,6 +97,8 @@ class ModFilter
/** /**
* Filter the results by the featured status. * Filter the results by the featured status.
*
* @return Builder<Mod>
*/ */
private function featured(string $option): Builder private function featured(string $option): Builder
{ {
@ -96,6 +111,9 @@ class ModFilter
/** /**
* Filter the results to specific SPT versions. * Filter the results to specific SPT versions.
*
* @param array<int, string> $versions
* @return Builder<Mod>
*/ */
private function sptVersions(array $versions): Builder private function sptVersions(array $versions): Builder
{ {

View File

@ -5,11 +5,14 @@ declare(strict_types=1);
namespace App\Http\Filters\V1; namespace App\Http\Filters\V1;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class ModFilter extends QueryFilter class ModFilter extends QueryFilter
{ {
/** /**
* The sortable fields. * The sortable fields.
*
* @var array<int, string>
*/ */
protected array $sortable = [ protected array $sortable = [
'name', 'name',
@ -26,6 +29,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by ID. * Filter by ID.
*
* @return Builder<Model>
*/ */
public function id(string $value): Builder public function id(string $value): Builder
{ {
@ -34,6 +39,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by hub ID. * Filter by hub ID.
*
* @return Builder<Model>
*/ */
public function hub_id(string $value): Builder public function hub_id(string $value): Builder
{ {
@ -42,6 +49,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by name. * Filter by name.
*
* @return Builder<Model>
*/ */
public function name(string $value): Builder public function name(string $value): Builder
{ {
@ -50,6 +59,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by slug. * Filter by slug.
*
* @return Builder<Model>
*/ */
public function slug(string $value): Builder public function slug(string $value): Builder
{ {
@ -58,6 +69,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by teaser. * Filter by teaser.
*
* @return Builder<Model>
*/ */
public function teaser(string $value): Builder public function teaser(string $value): Builder
{ {
@ -66,6 +79,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by source code link. * Filter by source code link.
*
* @return Builder<Model>
*/ */
public function source_code_link(string $value): Builder public function source_code_link(string $value): Builder
{ {
@ -74,6 +89,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by created at date. * Filter by created at date.
*
* @return Builder<Model>
*/ */
public function created_at(string $value): Builder public function created_at(string $value): Builder
{ {
@ -82,6 +99,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by updated at date. * Filter by updated at date.
*
* @return Builder<Model>
*/ */
public function updated_at(string $value): Builder public function updated_at(string $value): Builder
{ {
@ -90,6 +109,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by published at date. * Filter by published at date.
*
* @return Builder<Model>
*/ */
public function published_at(string $value): Builder public function published_at(string $value): Builder
{ {
@ -98,6 +119,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by featured. * Filter by featured.
*
* @return Builder<Model>
*/ */
public function featured(string $value): Builder public function featured(string $value): Builder
{ {
@ -106,6 +129,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by contains ads. * Filter by contains ads.
*
* @return Builder<Model>
*/ */
public function contains_ads(string $value): Builder public function contains_ads(string $value): Builder
{ {
@ -114,6 +139,8 @@ class ModFilter extends QueryFilter
/** /**
* Filter by contains AI content. * Filter by contains AI content.
*
* @return Builder<Model>
*/ */
public function contains_ai_content(string $value): Builder public function contains_ai_content(string $value): Builder
{ {

View File

@ -6,6 +6,7 @@ namespace App\Http\Filters\V1;
use App\Traits\V1\FilterMethods; use App\Traits\V1\FilterMethods;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request; use Illuminate\Http\Request;
abstract class QueryFilter abstract class QueryFilter
@ -17,11 +18,15 @@ abstract class QueryFilter
/** /**
* The query builder instance. * The query builder instance.
*
* @var Builder<Model>
*/ */
protected Builder $builder; protected Builder $builder;
/** /**
* The sortable fields. * The sortable fields.
*
* @var array<int, string>
*/ */
protected array $sortable = []; protected array $sortable = [];
@ -37,6 +42,9 @@ abstract class QueryFilter
/** /**
* Iterate over each of the filter options and call the appropriate method if it exists. * Iterate over each of the filter options and call the appropriate method if it exists.
*
* @param array<string, mixed> $filters
* @return Builder<Model>
*/ */
public function filter(array $filters): Builder public function filter(array $filters): Builder
{ {
@ -51,6 +59,9 @@ abstract class QueryFilter
/** /**
* Iterate over all request data and call the appropriate method if it exists. * Iterate over all request data and call the appropriate method if it exists.
*
* @param Builder<Model> $builder
* @return Builder<Model>
*/ */
public function apply(Builder $builder): Builder public function apply(Builder $builder): Builder
{ {

View File

@ -5,11 +5,14 @@ declare(strict_types=1);
namespace App\Http\Filters\V1; namespace App\Http\Filters\V1;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class UserFilter extends QueryFilter class UserFilter extends QueryFilter
{ {
/** /**
* The sortable fields. * The sortable fields.
*
* @var array<int, string>
*/ */
protected array $sortable = [ protected array $sortable = [
'name', 'name',
@ -19,6 +22,8 @@ class UserFilter extends QueryFilter
/** /**
* Filter by ID. * Filter by ID.
*
* @return Builder<Model>
*/ */
public function id(string $value): Builder public function id(string $value): Builder
{ {
@ -27,6 +32,8 @@ class UserFilter extends QueryFilter
/** /**
* Filter by name. * Filter by name.
*
* @return Builder<Model>
*/ */
public function name(string $value): Builder public function name(string $value): Builder
{ {
@ -35,6 +42,8 @@ class UserFilter extends QueryFilter
/** /**
* Filter by created at date. * Filter by created at date.
*
* @return Builder<Model>
*/ */
public function created_at(string $value): Builder public function created_at(string $value): Builder
{ {
@ -43,6 +52,8 @@ class UserFilter extends QueryFilter
/** /**
* Filter by updated at date. * Filter by updated at date.
*
* @return Builder<Model>
*/ */
public function updated_at(string $value): Builder public function updated_at(string $value): Builder
{ {

View File

@ -18,6 +18,8 @@ class LoginUserRequest extends FormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
*
* @return array<string, array<string>>
*/ */
public function rules(): array public function rules(): array
{ {

View File

@ -18,6 +18,8 @@ class StoreModRequest extends FormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
*
* @return array<string, array<string>>
*/ */
public function rules(): array public function rules(): array
{ {

View File

@ -18,6 +18,8 @@ class StoreUserRequest extends FormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
*
* @return array<string, array<string>>
*/ */
public function rules(): array public function rules(): array
{ {

View File

@ -18,6 +18,8 @@ class UpdateModRequest extends FormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
*
* @return array<string, array<string>>
*/ */
public function rules(): array public function rules(): array
{ {

View File

@ -18,6 +18,8 @@ class UpdateUserRequest extends FormRequest
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
*
* @return array<string, array<string>>
*/ */
public function rules(): array public function rules(): array
{ {

View File

@ -10,6 +10,8 @@ class ModRequest extends FormRequest
{ {
/** /**
* Get the validation rules that apply to the request. * Get the validation rules that apply to the request.
*
* @return array<string, array<string>>
*/ */
public function rules(): array public function rules(): array
{ {

View File

@ -14,6 +14,8 @@ class LicenseResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -17,6 +17,8 @@ class ModResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -14,6 +14,8 @@ class ModVersionResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -15,6 +15,8 @@ class UserResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -14,6 +14,8 @@ class UserRoleResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -14,6 +14,8 @@ class LicenseResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -14,6 +14,8 @@ class ModResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -14,6 +14,8 @@ class ModVersionResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -14,6 +14,8 @@ class SptVersionResource extends JsonResource
{ {
/** /**
* Transform the resource into an array. * Transform the resource into an array.
*
* @return array<string, mixed>
*/ */
#[Override] #[Override]
public function toArray(Request $request): array public function toArray(Request $request): array

View File

@ -389,6 +389,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Build an array of user data ready to be inserted into the local database. * Build an array of user data ready to be inserted into the local database.
*
* @return array<string, mixed>
*/ */
protected function collectUserData(CurlHandle $curlHandle, HubUser $hubUser): array protected function collectUserData(CurlHandle $curlHandle, HubUser $hubUser): array
{ {
@ -530,6 +532,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Build an array of banned user data ready to be inserted into the local database. * Build an array of banned user data ready to be inserted into the local database.
*
* @return array<string, mixed>|null
*/ */
protected function collectBannedUserData(HubUser $hubUser): ?array protected function collectBannedUserData(HubUser $hubUser): ?array
{ {
@ -586,6 +590,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Build an array of user rank data ready to be inserted into the local database. * Build an array of user rank data ready to be inserted into the local database.
*
* @return array<string, mixed>|null
*/ */
protected function collectUserRankData(HubUser $hubUser): ?array protected function collectUserRankData(HubUser $hubUser): ?array
{ {
@ -601,6 +607,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Insert or update the users in the local database. * Insert or update the users in the local database.
*
* @param array<array<string, mixed>> $usersData
*/ */
protected function upsertUsers(array $usersData): void protected function upsertUsers(array $usersData): void
{ {
@ -617,6 +625,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Fetch the hub-banned users from the local database and ban them locally. * Fetch the hub-banned users from the local database and ban them locally.
*
* @param array<array<string, mixed>> $bannedUsers
*/ */
protected function handleBannedUsers(array $bannedUsers): void protected function handleBannedUsers(array $bannedUsers): void
{ {
@ -631,6 +641,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Fetch or create the user ranks in the local database and assign them to the users. * Fetch or create the user ranks in the local database and assign them to the users.
*
* @param array<array<string, mixed>> $userRanks
*/ */
protected function handleUserRoles(array $userRanks): void protected function handleUserRoles(array $userRanks): void
{ {
@ -647,6 +659,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Build the user role data based on the role name. * Build the user role data based on the role name.
*
* @return array<string, string>
*/ */
protected function buildUserRoleData(string $name): array protected function buildUserRoleData(string $name): array
{ {
@ -813,6 +827,8 @@ class ImportHubDataJob implements ShouldBeUnique, ShouldQueue
/** /**
* Get the latest current version from the response data. * Get the latest current version from the response data.
*
* @param array<array<string, mixed>> $versions
*/ */
protected function getLatestVersion(array $versions): string protected function getLatestVersion(array $versions): string
{ {

View File

@ -21,6 +21,8 @@ class GlobalSearch extends Component
/** /**
* The search results. * The search results.
*
* @var array<string, Collection<int, mixed>>
*/ */
#[Locked] #[Locked]
public array $result = []; public array $result = [];
@ -44,6 +46,8 @@ class GlobalSearch extends Component
/** /**
* Execute the search against each of the searchable models. * Execute the search against each of the searchable models.
*
* @return array<string, Collection<int, mixed>>
*/ */
protected function executeSearch(string $query): array protected function executeSearch(string $query): array
{ {
@ -61,25 +65,37 @@ class GlobalSearch extends Component
/** /**
* Fetch the user search results. * Fetch the user search results.
*
* @return Collection<int, mixed>
*/ */
protected function fetchUserResults(string $query): Collection protected function fetchUserResults(string $query): Collection
{ {
return collect(User::search($query)->raw()['hits']); /** @var Collection<int, mixed> $searchHits */
$searchHits = User::search($query)->raw()['hits'];
return collect($searchHits);
} }
/** /**
* Fetch the mod search results. * Fetch the mod search results.
*
* @return Collection<int, mixed>
*/ */
protected function fetchModResults(string $query): Collection protected function fetchModResults(string $query): Collection
{ {
return collect(Mod::search($query)->raw()['hits']); /** @var Collection<int, mixed> $searchHits */
$searchHits = Mod::search($query)->raw()['hits'];
return collect($searchHits);
} }
/** /**
* Count the total number of results across all models. * Count the total number of results across all models.
*
* @param array<string, Collection<int, mixed>> $results
*/ */
protected function countTotalResults(array $results): int protected function countTotalResults(array $results): int
{ {
return collect($results)->reduce(fn (int $carry, Collection $result): int => $carry + $result->count(), 0); return (int) collect($results)->reduce(fn (int $carry, Collection $result): int => $carry + $result->count(), 0);
} }
} }

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Livewire\Mod; namespace App\Livewire\Mod;
use App\Http\Filters\ModFilter; use App\Http\Filters\ModFilter;
use App\Models\Mod;
use App\Models\SptVersion; use App\Models\SptVersion;
use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
@ -44,12 +45,16 @@ class Listing extends Component
/** /**
* The options that are available for the per page setting. * The options that are available for the per page setting.
*
* @var array<int>
*/ */
#[Locked] #[Locked]
public array $perPageOptions = [6, 12, 24, 50]; public array $perPageOptions = [6, 12, 24, 50];
/** /**
* The SPT versions filter value. * The SPT versions filter value.
*
* @var array<int, string>
*/ */
#[Session] #[Session]
#[Url] #[Url]
@ -81,6 +86,8 @@ class Listing extends Component
/** /**
* Get the default values for the SPT Versions filter. * Get the default values for the SPT Versions filter.
*
* @return array<int, string>
*/ */
protected function getDefaultSptVersions(): array protected function getDefaultSptVersions(): array
{ {
@ -89,6 +96,8 @@ class Listing extends Component
/** /**
* Get all patch versions of the latest minor SPT version. * Get all patch versions of the latest minor SPT version.
*
* @return Collection<int, SptVersion>
*/ */
public function getLatestMinorVersions(): Collection public function getLatestMinorVersions(): Collection
{ {
@ -137,6 +146,8 @@ class Listing extends Component
/** /**
* Check if the current page is greater than the last page. Redirect if it is. * Check if the current page is greater than the last page. Redirect if it is.
*
* @param LengthAwarePaginator<Mod> $lengthAwarePaginator
*/ */
private function redirectOutOfBoundsPage(LengthAwarePaginator $lengthAwarePaginator): void private function redirectOutOfBoundsPage(LengthAwarePaginator $lengthAwarePaginator): void
{ {

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Livewire\Profile; namespace App\Livewire\Profile;
use App\Models\User;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\View\View; use Illuminate\View\View;
use Livewire\Attributes\Locked; use Livewire\Attributes\Locked;
@ -18,18 +19,18 @@ class ManageOAuthConnections extends Component
* Store the current user. * Store the current user.
*/ */
#[Locked] #[Locked]
public $user; public User $user;
/** /**
* Controls the confirmation modal visibility. * Controls the confirmation modal visibility.
*/ */
public $confirmingConnectionDeletion = false; public bool $confirmingConnectionDeletion = false;
/** /**
* Stores the ID of the connection to be deleted. * Stores the ID of the connection to be deleted.
*/ */
#[Locked] #[Locked]
public $selectedConnectionId; public ?string $selectedConnectionId = null;
/** /**
* Initializes the component by loading the user's OAuth connections. * Initializes the component by loading the user's OAuth connections.
@ -44,7 +45,7 @@ class ManageOAuthConnections extends Component
/** /**
* Sets up the deletion confirmation. * Sets up the deletion confirmation.
*/ */
public function confirmConnectionDeletion($connectionId): void public function confirmConnectionDeletion(string $connectionId): void
{ {
$this->confirmingConnectionDeletion = true; $this->confirmingConnectionDeletion = true;
$this->selectedConnectionId = $connectionId; $this->selectedConnectionId = $connectionId;

View File

@ -15,6 +15,8 @@ class UpdateProfileForm extends UpdateProfileInformationForm
{ {
/** /**
* The new cover photo for the user. * The new cover photo for the user.
*
* @var string|null
*/ */
public $cover; public $cover;
@ -42,11 +44,11 @@ class UpdateProfileForm extends UpdateProfileInformationForm
* Update the user's profile information. * Update the user's profile information.
*/ */
#[Override] #[Override]
public function updateProfileInformation(UpdatesUserProfileInformation $updatesUserProfileInformation): RedirectResponse|Redirector|null public function updateProfileInformation(UpdatesUserProfileInformation $updater): RedirectResponse|Redirector|null
{ {
$this->resetErrorBag(); $this->resetErrorBag();
$updatesUserProfileInformation->update( $updater->update(
Auth::user(), Auth::user(),
$this->photo || $this->cover $this->photo || $this->cover
? array_merge($this->state, array_filter([ ? array_merge($this->state, array_filter([

View File

@ -36,18 +36,6 @@ class FollowCard extends Component
*/ */
public string $dialogTitle; public string $dialogTitle;
/**
* The user data to display in the card.
*/
#[Locked]
public array $display = [];
/**
* The limited user data to display in the card.
*/
#[Locked]
public array $displayLimit = [];
/** /**
* The maximum number of users to display on the card. * The maximum number of users to display on the card.
*/ */
@ -67,18 +55,24 @@ class FollowCard extends Component
/** /**
* A collection of user IDs that the auth user follows. * A collection of user IDs that the auth user follows.
*
* @var Collection<int, int>
*/ */
#[Locked] #[Locked]
public Collection $authFollowIds; public Collection $authFollowIds;
/** /**
* The profile user's followers (or following). * The profile user's followers (or following).
*
* @var Collection<int, User>
*/ */
#[Locked] #[Locked]
public Collection $followUsers; public Collection $followUsers;
/** /**
* The events the component should listen for. * The events the component should listen for.
*
* @var array<string, string>
*/ */
protected $listeners = ['refreshComponent' => '$refresh']; protected $listeners = ['refreshComponent' => '$refresh'];

View File

@ -21,6 +21,8 @@ class FollowCards extends Component
/** /**
* A collection of user IDs that the auth user follows. * A collection of user IDs that the auth user follows.
*
* @var Collection<int, int>
*/ */
#[Locked] #[Locked]
public Collection $authFollowIds; public Collection $authFollowIds;

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Models; namespace App\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Database\Factories\LicenseFactory;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -25,7 +26,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/ */
class License extends Model class License extends Model
{ {
/** @use HasFactory<LicenseFactory> */
use HasFactory; use HasFactory;
use SoftDeletes; use SoftDeletes;
/** /**

View File

@ -7,6 +7,7 @@ namespace App\Models;
use App\Http\Filters\V1\QueryFilter; use App\Http\Filters\V1\QueryFilter;
use App\Models\Scopes\DisabledScope; use App\Models\Scopes\DisabledScope;
use App\Models\Scopes\PublishedScope; use App\Models\Scopes\PublishedScope;
use Database\Factories\ModFactory;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
@ -53,7 +54,9 @@ use Override;
*/ */
class Mod extends Model class Mod extends Model
{ {
/** @use HasFactory<ModFactory> */
use HasFactory; use HasFactory;
use Searchable; use Searchable;
use SoftDeletes; use SoftDeletes;
@ -140,6 +143,8 @@ class Mod extends Model
/** /**
* The data that is searchable by Scout. * The data that is searchable by Scout.
*
* @return array<string, mixed>
*/ */
public function toSearchableArray(): array public function toSearchableArray(): array
{ {
@ -221,6 +226,8 @@ class Mod extends Model
/** /**
* Build the URL to the mod's thumbnail. * Build the URL to the mod's thumbnail.
*
* @return Attribute<string, never>
*/ */
public function thumbnailUrl(): Attribute public function thumbnailUrl(): Attribute
{ {
@ -242,6 +249,9 @@ class Mod extends Model
/** /**
* Scope a query by applying QueryFilter filters. * Scope a query by applying QueryFilter filters.
*
* @param Builder<Model> $builder
* @return Builder<Model>
*/ */
public function scopeFilter(Builder $builder, QueryFilter $queryFilter): Builder public function scopeFilter(Builder $builder, QueryFilter $queryFilter): Builder
{ {

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Models; namespace App\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Database\Factories\ModDependencyFactory;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -26,6 +27,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
*/ */
class ModDependency extends Model class ModDependency extends Model
{ {
/** @use HasFactory<ModDependencyFactory> */
use HasFactory; use HasFactory;
/** /**

View File

@ -8,6 +8,7 @@ use App\Exceptions\InvalidVersionNumberException;
use App\Models\Scopes\DisabledScope; use App\Models\Scopes\DisabledScope;
use App\Models\Scopes\PublishedScope; use App\Models\Scopes\PublishedScope;
use App\Support\Version; use App\Support\Version;
use Database\Factories\ModVersionFactory;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -49,11 +50,15 @@ use Override;
*/ */
class ModVersion extends Model class ModVersion extends Model
{ {
/** @use HasFactory<ModVersionFactory> */
use HasFactory; use HasFactory;
use SoftDeletes; use SoftDeletes;
/** /**
* Update the parent mod's updated_at timestamp when the mod version is updated. * Update the parent mod's updated_at timestamp when the mod version is updated.
*
* @var string[]
*/ */
protected $touches = ['mod']; protected $touches = ['mod'];

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Models; namespace App\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Database\Factories\OAuthConnectionFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -28,6 +29,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/ */
class OAuthConnection extends Model class OAuthConnection extends Model
{ {
/** @use HasFactory<OAuthConnectionFactory> */
use HasFactory; use HasFactory;
protected $table = 'oauth_connections'; protected $table = 'oauth_connections';

View File

@ -12,6 +12,8 @@ class DisabledScope implements Scope
{ {
/** /**
* Apply the scope to a given Eloquent query builder. * Apply the scope to a given Eloquent query builder.
*
* @param Builder<Model> $builder
*/ */
public function apply(Builder $builder, Model $model): void public function apply(Builder $builder, Model $model): void
{ {

View File

@ -12,6 +12,8 @@ class PublishedScope implements Scope
{ {
/** /**
* Apply the scope to a given Eloquent query builder. * Apply the scope to a given Eloquent query builder.
*
* @param Builder<Model> $builder
*/ */
public function apply(Builder $builder, Model $model): void public function apply(Builder $builder, Model $model): void
{ {

View File

@ -7,6 +7,7 @@ namespace App\Models;
use App\Exceptions\InvalidVersionNumberException; use App\Exceptions\InvalidVersionNumberException;
use App\Support\Version; use App\Support\Version;
use Carbon\Carbon; use Carbon\Carbon;
use Database\Factories\SptVersionFactory;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -37,11 +38,15 @@ use Throwable;
*/ */
class SptVersion extends Model class SptVersion extends Model
{ {
/** @use HasFactory<SptVersionFactory> */
use HasFactory; use HasFactory;
use SoftDeletes; use SoftDeletes;
/** /**
* Get all versions for the last three minor versions. * Get all versions for the last three minor versions.
*
* @return Collection<int, $this>
*/ */
public static function getVersionsForLastThreeMinors(): Collection public static function getVersionsForLastThreeMinors(): Collection
{ {
@ -70,6 +75,8 @@ class SptVersion extends Model
/** /**
* Get the last three minor versions (major.minor format). * Get the last three minor versions (major.minor format).
*
* @return array<int, array{major: int, minor: int}>
*/ */
public static function getLastThreeMinorVersions(): array public static function getLastThreeMinorVersions(): array
{ {
@ -90,6 +97,8 @@ class SptVersion extends Model
/** /**
* Extract the version sections from the version string. * Extract the version sections from the version string.
* *
* @return array{major: int, minor: int, patch: int, pre_release: string}
*
* @throws InvalidVersionNumberException|Throwable * @throws InvalidVersionNumberException|Throwable
*/ */
public static function extractVersionSections(string $version): array public static function extractVersionSections(string $version): array

View File

@ -9,11 +9,13 @@ use App\Notifications\ResetPassword;
use App\Notifications\VerifyEmail; use App\Notifications\VerifyEmail;
use App\Traits\HasCoverPhoto; use App\Traits\HasCoverPhoto;
use Carbon\Carbon; use Carbon\Carbon;
use Database\Factories\UserFactory;
use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
@ -54,7 +56,10 @@ class User extends Authenticatable implements MustVerifyEmail
use Bannable; use Bannable;
use HasApiTokens; use HasApiTokens;
use HasCoverPhoto; use HasCoverPhoto;
/** @use HasFactory<UserFactory> */
use HasFactory; use HasFactory;
use HasProfilePhoto; use HasProfilePhoto;
use Notifiable; use Notifiable;
use Searchable; use Searchable;
@ -150,6 +155,8 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* The data that is searchable by Scout. * The data that is searchable by Scout.
*
* @return array<string, mixed>
*/ */
public function toSearchableArray(): array public function toSearchableArray(): array
{ {
@ -242,6 +249,9 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* Scope a query by applying QueryFilter filters. * Scope a query by applying QueryFilter filters.
*
* @param Builder<Model> $builder
* @return Builder<Model>
*/ */
public function scopeFilter(Builder $builder, QueryFilter $queryFilter): Builder public function scopeFilter(Builder $builder, QueryFilter $queryFilter): Builder
{ {
@ -260,6 +270,8 @@ class User extends Authenticatable implements MustVerifyEmail
/** /**
* Handle the about default value if empty. Thanks, MySQL! * Handle the about default value if empty. Thanks, MySQL!
*
* @return Attribute<string[], never>
*/ */
protected function about(): Attribute protected function about(): Attribute
{ {

View File

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Models; namespace App\Models;
use Carbon\Carbon; use Carbon\Carbon;
use Database\Factories\UserRoleFactory;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@ -24,6 +25,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
*/ */
class UserRole extends Model class UserRole extends Model
{ {
/** @use HasFactory<UserRoleFactory> */
use HasFactory; use HasFactory;
/** /**

View File

@ -22,6 +22,8 @@ class ResetPassword extends OriginalResetPassword implements ShouldQueue
/** /**
* Get the array representation of the notification. * Get the array representation of the notification.
*
* @return array<int, mixed>
*/ */
public function toArray(object $notifiable): array public function toArray(object $notifiable): array
{ {

View File

@ -17,6 +17,8 @@ class VerifyEmail extends OriginalVerifyEmail implements ShouldQueue
/** /**
* Get the array representation of the notification. * Get the array representation of the notification.
*
* @return array<int, mixed>
*/ */
public function toArray(object $notifiable): array public function toArray(object $notifiable): array
{ {

View File

@ -20,6 +20,8 @@ class DependencyVersionService
/** /**
* Satisfies all dependency constraints of a ModVersion. * Satisfies all dependency constraints of a ModVersion.
*
* @return array<int, array<string, int>>
*/ */
private function satisfyConstraint(ModVersion $modVersion): array private function satisfyConstraint(ModVersion $modVersion): array
{ {

View File

@ -21,6 +21,8 @@ class SptVersionService
/** /**
* Satisfies the version constraint of a given ModVersion. Returns the ID of the satisfying SptVersion. * Satisfies the version constraint of a given ModVersion. Returns the ID of the satisfying SptVersion.
*
* @return array<int>
*/ */
private function satisfyConstraint(ModVersion $modVersion): array private function satisfyConstraint(ModVersion $modVersion): array
{ {

View File

@ -10,6 +10,8 @@ trait ApiResponses
{ {
/** /**
* Return a success JSON response. * Return a success JSON response.
*
* @param array<string, string> $data
*/ */
protected function success(string $message, ?array $data = []): JsonResponse protected function success(string $message, ?array $data = []): JsonResponse
{ {
@ -18,6 +20,8 @@ trait ApiResponses
/** /**
* The base response. * The base response.
*
* @param array<string, string> $data
*/ */
private function baseResponse(?string $message = '', ?array $data = [], ?int $code = 200): JsonResponse private function baseResponse(?string $message = '', ?array $data = [], ?int $code = 200): JsonResponse
{ {

View File

@ -54,8 +54,10 @@ trait HasCoverPhoto
/** /**
* Get the cover photo URL for the user. * Get the cover photo URL for the user.
*
* @return Attribute<string[], never>
*/ */
public function coverPhotoUrl(): Attribute protected function coverPhotoUrl(): Attribute
{ {
return new Attribute( return new Attribute(
get: fn (): string => $this->cover_photo_path get: fn (): string => $this->cover_photo_path

View File

@ -5,12 +5,15 @@ declare(strict_types=1);
namespace App\Traits\V1; namespace App\Traits\V1;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str; use Illuminate\Support\Str;
trait FilterMethods trait FilterMethods
{ {
/** /**
* Filter using a whereIn clause. * Filter using a whereIn clause.
*
* @return Builder<Model>
*/ */
public function filterWhereIn(string $column, string $value): Builder public function filterWhereIn(string $column, string $value): Builder
{ {
@ -21,6 +24,8 @@ trait FilterMethods
/** /**
* Filter using a LIKE clause with a wildcard characters. * Filter using a LIKE clause with a wildcard characters.
*
* @return Builder<Model>
*/ */
public function filterByWildcardLike(string $column, string $value): Builder public function filterByWildcardLike(string $column, string $value): Builder
{ {
@ -31,6 +36,8 @@ trait FilterMethods
/** /**
* Filter by date range or specific date. * Filter by date range or specific date.
*
* @return Builder<Model>
*/ */
public function filterByDate(string $column, string $value): Builder public function filterByDate(string $column, string $value): Builder
{ {
@ -45,6 +52,8 @@ trait FilterMethods
/** /**
* Filter by boolean value. * Filter by boolean value.
*
* @return Builder<Model>
*/ */
public function filterByBoolean(string $column, string $value): Builder public function filterByBoolean(string $column, string $value): Builder
{ {
@ -58,6 +67,8 @@ trait FilterMethods
/** /**
* Apply the sort type to the query. * Apply the sort type to the query.
*
* @return Builder<Model>
*/ */
protected function sort(string $values): Builder protected function sort(string $values): Builder
{ {

View File

@ -35,6 +35,8 @@ class HomepageMods extends Component
/** /**
* Fetches the featured mods homepage listing. * Fetches the featured mods homepage listing.
*
* @return Collection<int, Mod>
*/ */
private function fetchFeaturedMods(): Collection private function fetchFeaturedMods(): Collection
{ {
@ -52,6 +54,8 @@ class HomepageMods extends Component
/** /**
* Fetches the latest mods homepage listing. * Fetches the latest mods homepage listing.
*
* @return Collection<int, Mod>
*/ */
private function fetchLatestMods(): Collection private function fetchLatestMods(): Collection
{ {
@ -68,6 +72,8 @@ class HomepageMods extends Component
/** /**
* Fetches the recently updated mods homepage listing. * Fetches the recently updated mods homepage listing.
*
* @return Collection<int, Mod>
*/ */
private function fetchUpdatedMods(): Collection private function fetchUpdatedMods(): Collection
{ {

View File

@ -7,6 +7,9 @@ use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str; use Illuminate\Support\Str;
/**
* @extends Factory<OAuthConnection>
*/
class OAuthConnectionFactory extends Factory class OAuthConnectionFactory extends Factory
{ {
protected $model = OAuthConnection::class; protected $model = OAuthConnection::class;

View File

@ -2,7 +2,7 @@ includes:
- vendor/larastan/larastan/extension.neon - vendor/larastan/larastan/extension.neon
- vendor/nesbot/carbon/extension.neon - vendor/nesbot/carbon/extension.neon
parameters: parameters:
level: 5 level: 6
paths: paths:
- app - app
- bootstrap - bootstrap