Skip to content

Commit

Permalink
Merge pull request #638 from pelican-dev/lance/pint-fixes
Browse files Browse the repository at this point in the history
Reenable Disabled Pint Rules
  • Loading branch information
lancepioch authored Oct 20, 2024
2 parents 020e41c + c621d2d commit e9f6fba
Show file tree
Hide file tree
Showing 87 changed files with 165 additions and 73 deletions.
3 changes: 3 additions & 0 deletions app/Exceptions/DisplayException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
class DisplayException extends PanelException implements HttpExceptionInterface
{
public const LEVEL_DEBUG = 'debug';

public const LEVEL_INFO = 'info';

public const LEVEL_WARNING = 'warning';

public const LEVEL_ERROR = 'error';

/**
Expand Down
6 changes: 3 additions & 3 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class_basename($exception),
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @throws \Throwable
*/
Expand All @@ -140,7 +140,7 @@ public function render($request, \Throwable $e): Response
* Transform a validation exception into a consistent format to be returned for
* calls to the API.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*/
public function invalidJson($request, ValidationException $exception): JsonResponse
{
Expand Down Expand Up @@ -236,7 +236,7 @@ public static function isReportable(\Exception $exception): bool
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*/
protected function unauthenticated($request, AuthenticationException $exception): JsonResponse|RedirectResponse
{
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Http/HttpForbiddenException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class HttpForbiddenException extends HttpException
/**
* HttpForbiddenException constructor.
*/
public function __construct(string $message = null, \Throwable $previous = null)
public function __construct(?string $message = null, ?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_FORBIDDEN, $message, $previous);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ServerStateConflictException extends ConflictHttpException
* Exception thrown when the server is in an unsupported state for API access or
* certain operations within the codebase.
*/
public function __construct(Server $server, \Throwable $previous = null)
public function __construct(Server $server, ?\Throwable $previous = null)
{
$message = 'This server is currently in an unsupported state, please try again later.';
if ($server->isSuspended()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Http/TwoFactorAuthRequiredException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TwoFactorAuthRequiredException extends HttpException implements HttpExcept
/**
* TwoFactorAuthRequiredException constructor.
*/
public function __construct(\Throwable $previous = null)
public function __construct(?\Throwable $previous = null)
{
parent::__construct(Response::HTTP_BAD_REQUEST, 'Two-factor authentication is required on this account in order to access this endpoint.', $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Service/ServiceLimitExceededException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ServiceLimitExceededException extends DisplayException
* Exception thrown when something goes over a defined limit, such as allocated
* ports, tasks, databases, etc.
*/
public function __construct(string $message, \Throwable $previous = null)
public function __construct(string $message, ?\Throwable $previous = null)
{
parent::__construct($message, $previous, self::LEVEL_WARNING);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class TwoFactorAuthenticationTokenInvalid extends DisplayException
{
public string $title = 'Invalid 2FA Code';

public string $icon = 'tabler-2fa';

public function __construct()
Expand Down
4 changes: 2 additions & 2 deletions app/Extensions/Backups/BackupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(protected Application $app)
/**
* Returns a backup adapter instance.
*/
public function adapter(string $name = null): FilesystemAdapter
public function adapter(?string $name = null): FilesystemAdapter
{
return $this->get($name ?: $this->getDefaultAdapter());
}
Expand Down Expand Up @@ -145,7 +145,7 @@ public function setDefaultAdapter(string $name): void
/**
* Unset the given adapter instances.
*
* @param string|string[] $adapter
* @param string|string[] $adapter
*/
public function forget(array|string $adapter): self
{
Expand Down
2 changes: 2 additions & 0 deletions app/Extensions/DynamicDatabaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
class DynamicDatabaseConnection
{
public const DB_CHARSET = 'utf8';

public const DB_COLLATION = 'utf8_unicode_ci';

public const DB_DRIVER = 'mysql';

/**
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Pages/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Settings extends Page implements HasForms
use InteractsWithHeaderActions;

protected static ?string $navigationIcon = 'tabler-settings';

protected static ?string $navigationGroup = 'Advanced';

protected static string $view = 'filament.pages.settings';
Expand Down
3 changes: 3 additions & 0 deletions app/Filament/Resources/ApiKeyResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
class ApiKeyResource extends Resource
{
protected static ?string $model = ApiKey::class;

protected static ?string $label = 'API Key';

protected static ?string $navigationIcon = 'tabler-key';

protected static ?string $navigationGroup = 'Advanced';

public static function getNavigationBadge(): ?string
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Resources/DatabaseHostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class DatabaseHostResource extends Resource
protected static ?string $label = 'Database Host';

protected static ?string $navigationIcon = 'tabler-database';

protected static ?string $navigationGroup = 'Advanced';

public static function getNavigationBadge(): ?string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function form(Form $form): Form
->formatStateUsing(fn (Get $get, Database $database) => 'jdbc:mysql://' . $get('username') . ':' . urlencode($database->password) . '@' . $database->host->host . ':' . $database->host->port . '/' . $get('database')),
]);
}

public function table(Table $table): Table
{
return $table
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Resources/DatabaseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class DatabaseResource extends Resource
protected static ?string $navigationIcon = 'tabler-database';

protected static bool $shouldRegisterNavigation = false;

protected static ?string $navigationGroup = 'Advanced';

public static function getNavigationBadge(): ?string
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Resources/EggResource/Pages/CreateEgg.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CreateEgg extends CreateRecord
protected static string $resource = EggResource::class;

protected static bool $canCreateAnother = false;

public function form(Form $form): Form
{
return $form
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Resources/EggResource/Pages/ListEggs.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function table(Table $table): Table
]),
]);
}

protected function getHeaderActions(): array
{
return [
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Resources/MountResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class MountResource extends Resource
protected static ?string $model = Mount::class;

protected static ?string $navigationIcon = 'tabler-layers-linked';

protected static ?string $navigationGroup = 'Advanced';

public static function getNavigationBadge(): ?string
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Resources/MountResource/Pages/EditMount.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function form(Form $form): Form
'lg' => 2,
]);
}

protected function getHeaderActions(): array
{
return [
Expand Down
2 changes: 2 additions & 0 deletions app/Filament/Resources/MountResource/Pages/ListMounts.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
class ListMounts extends ListRecords
{
protected static string $resource = MountResource::class;

public function table(Table $table): Table
{
return $table
Expand Down Expand Up @@ -56,6 +57,7 @@ public function table(Table $table): Table
->button(),
]);
}

protected function getHeaderActions(): array
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class NodeCpuChart extends ChartWidget
{
protected static ?string $pollingInterval = '5s';

protected static ?string $maxHeight = '300px';

public ?Model $record = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class NodeMemoryChart extends ChartWidget
{
protected static ?string $pollingInterval = '5s';

protected static ?string $maxHeight = '300px';

public ?Model $record = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
class NodeStorageChart extends ChartWidget
{
protected static ?string $heading = 'Storage';

protected static ?string $pollingInterval = '60s';

protected static ?string $maxHeight = '300px';

public ?Model $record = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
class CreateServer extends CreateRecord
{
protected static string $resource = ServerResource::class;

protected static bool $canCreateAnother = false;

public ?Node $node = null;
Expand Down
2 changes: 2 additions & 0 deletions app/Filament/Resources/ServerResource/Pages/EditServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ protected function transferServer(Form $form): Form
]);

}

protected function getHeaderActions(): array
{
return [
Expand All @@ -763,6 +764,7 @@ protected function getHeaderActions(): array
];

}

protected function getFormActions(): array
{
return [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function table(Table $table): Table
->button(),
]);
}

protected function getHeaderActions(): array
{
return [
Expand Down
2 changes: 2 additions & 0 deletions app/Filament/Resources/UserResource/Pages/EditUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;

public function form(Form $form): Form
{
return $form
Expand Down Expand Up @@ -46,6 +47,7 @@ public function form(Form $form): Form
])->columns(),
]);
}

protected function getHeaderActions(): array
{
return [
Expand Down
1 change: 1 addition & 0 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function table(Table $table): Table
]),
]);
}

protected function getHeaderActions(): array
{
return [
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/Eggs/EggController.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function destroy(Egg $egg): RedirectResponse
/**
* Normalizes a string of docker image data into the expected egg format.
*/
protected function normalizeDockerImages(string $input = null): array
protected function normalizeDockerImages(?string $input = null): array
{
$data = array_map(fn ($value) => trim($value), explode("\n", $input ?? ''));

Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/Admin/Nodes/NodeViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class NodeViewController extends Controller
use JavascriptInjection;

public const THRESHOLD_PERCENTAGE_LOW = 75;

public const THRESHOLD_PERCENTAGE_MEDIUM = 90;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public function loadDependencies(Fractal $fractal, Request $request): void
*
* @template T of \App\Transformers\Api\Application\BaseTransformer
*
* @param class-string<T> $abstract
*
* @param class-string<T> $abstract
* @return T
*
* @noinspection PhpDocSignatureInspection
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Api/Client/ClientApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ protected function parseIncludes(): array
*
* @template T of \App\Transformers\Api\Client\BaseClientTransformer
*
* @param class-string<T> $abstract
*
* @param class-string<T> $abstract
* @return T
*
* @noinspection PhpDocSignatureInspection
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Auth/AbstractLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct()
*
* @throws \App\Exceptions\DisplayException
*/
protected function sendFailedLoginResponse(Request $request, Authenticatable $user = null, string $message = null): never
protected function sendFailedLoginResponse(Request $request, ?Authenticatable $user = null, ?string $message = null): never
{
$this->incrementLoginAttempts($request);
$this->fireFailedLoginEvent($user, [
Expand Down Expand Up @@ -91,15 +91,15 @@ protected function sendLoginResponse(User $user, Request $request): JsonResponse
/**
* Determine if the user is logging in using an email or username.
*/
protected function getField(string $input = null): string
protected function getField(?string $input = null): string
{
return ($input && str_contains($input, '@')) ? 'email' : 'username';
}

/**
* Fire a failed login event.
*/
protected function fireFailedLoginEvent(Authenticatable $user = null, array $credentials = []): void
protected function fireFailedLoginEvent(?Authenticatable $user = null, array $credentials = []): void
{
Event::dispatch(new Failed('auth', $user, $credentials));
}
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ function ($user, $password) {
* account do not automatically log them in. In those cases, send the user back to the login
* form with a note telling them their password was changed and to log back in.
*
* @param \Illuminate\Contracts\Auth\CanResetPassword|\App\Models\User $user
* @param string $password
* @param \Illuminate\Contracts\Auth\CanResetPassword|\App\Models\User $user
* @param string $password
*
* @throws \App\Exceptions\Model\DataValidationException
*/
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(private AuthManager $authManager)
/**
* Handle an incoming request.
*/
public function handle(Request $request, \Closure $next, string $guard = null): mixed
public function handle(Request $request, \Closure $next, ?string $guard = null): mixed
{
if ($this->authManager->guard($guard)->check()) {
return redirect()->route('index');
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Middleware/RequireTwoFactorAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
class RequireTwoFactorAuthentication
{
public const LEVEL_NONE = 0;

public const LEVEL_ADMIN = 1;

public const LEVEL_ALL = 2;

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/Admin/AdminFormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function authorize(): bool
* Return only the fields that we are interested in from the request.
* This will include empty fields as a null value.
*/
public function normalize(array $only = null): array
public function normalize(?array $only = null): array
{
return $this->only($only ?? array_keys($this->rules()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function rules(): array
* Override the default normalization function for this type of request
* as we need to accept empty values on the keys.
*/
public function normalize(array $only = null): array
public function normalize(?array $only = null): array
{
$keys = array_flip(array_keys($this->rules()));

Expand Down
Loading

0 comments on commit e9f6fba

Please sign in to comment.