Basic fixes from phpstan

This commit is contained in:
Lance Pioch 2024-03-16 14:19:40 -04:00
parent 6b5e990a1c
commit 095bc89aee
8 changed files with 9 additions and 9 deletions

View File

@ -11,7 +11,7 @@ class NodeListCommand extends Command
public function handle(): int
{
$nodes = Node::query()->with('location')->get()->map(function (Node $node) {
$nodes = Node::query()->get()->map(function (Node $node) {
return [
'id' => $node->id,
'uuid' => $node->uuid,

View File

@ -32,7 +32,9 @@ class MakeUserCommand extends Command
try {
DB::select('select 1 where 1');
} catch (Exception $exception) {
return $this->error($exception->getMessage()) ?? 0;
$this->error($exception->getMessage());
return 1;
}
$root_admin = $this->option('admin') ?? $this->confirm(trans('command/messages.user.ask_admin'));

View File

@ -233,7 +233,7 @@ class Handler extends ExceptionHandler
*/
public static function isReportable(\Exception $exception): bool
{
return (new static(Container::getInstance()))->shouldReport($exception);
return (new self(Container::getInstance()))->shouldReport($exception);
}
/**

View File

@ -79,7 +79,7 @@ class LoginCheckpointController extends AbstractLoginController
}
}
$this->sendFailedLoginResponse($request, $user, !empty($recoveryToken) ? 'The recovery token provided is not valid.' : null);
return $this->sendFailedLoginResponse($request, $user, !empty($recoveryToken) ? 'The recovery token provided is not valid.' : null);
}
/**

View File

@ -143,8 +143,6 @@ class ApiKey extends Model
'r_' . AdminAcl::RESOURCE_DATABASE_HOSTS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_SERVER_DATABASES => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_EGGS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_LOCATIONS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_EGGS => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_NODES => 'integer|min:0|max:3',
'r_' . AdminAcl::RESOURCE_SERVERS => 'integer|min:0|max:3',
];

View File

@ -73,7 +73,7 @@ class Fqdn implements DataAwareRule, Rule
*/
public static function make(string $schemeField = null): self
{
return tap(new static(), function ($fqdn) use ($schemeField) {
return tap(new self(), function ($fqdn) use ($schemeField) {
$fqdn->schemeField = $schemeField;
});
}

View File

@ -95,7 +95,7 @@ class BuildModificationService
// Keep track of all the allocations we're just now adding so that we can use the first
// one to reset the default allocation to.
$freshlyAllocated = $query->pluck('id')->first();
$freshlyAllocated = $query->first()?->id;
$query->update(['server_id' => $server->id, 'notes' => null]);
}

View File

@ -19,7 +19,7 @@ class ServerVariableTransformer extends BaseTransformer
*/
public function getResourceName(): string
{
return ServerVariable::RESOURCE_NAME;
return EggVariable::RESOURCE_NAME;
}
/**