Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Fix static analysis #379

Merged
merged 1 commit into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Livewire/Servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function render(): Renderable
'memory_current' => (int) $values->memory_used,
'memory_total' => (int) $values->memory_total,
'memory' => $graphs->get($slug)?->get('memory') ?? collect(),
'storage' => collect($values->storage), // @phpstan-ignore argument.templateType argument.templateType
'storage' => collect($values->storage), // @phpstan-ignore argument.templateType, argument.templateType
'updated_at' => $updatedAt = CarbonImmutable::createFromTimestamp($system->timestamp),
'recently_reported' => $updatedAt->isAfter(now()->subSeconds(30)),
];
Expand Down
2 changes: 1 addition & 1 deletion src/PulseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected function registerComponents(): void
});

$this->callAfterResolving('livewire', function (LivewireManager $livewire, Application $app) {
$middleware = collect($app->make('config')->get('pulse.middleware')) // @phpstan-ignore argument.templateType argument.templateType
$middleware = collect($app->make('config')->get('pulse.middleware')) // @phpstan-ignore argument.templateType, argument.templateType
->map(fn ($middleware) => is_string($middleware)
? Str::before($middleware, ':')
: $middleware)
Expand Down
2 changes: 1 addition & 1 deletion src/Recorders/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function resolveLocation(Throwable $e): string
{
return match (true) {
$e instanceof \Illuminate\View\ViewException => $this->resolveLocationFromViewException($e),
$e instanceof \Spatie\LaravelIgnition\Exceptions\ViewException => $this->formatLocation($e->getFile(), $e->getLine()), // @phpstan-ignore class.notFound class.notFound class.notFound
$e instanceof \Spatie\LaravelIgnition\Exceptions\ViewException => $this->formatLocation($e->getFile(), $e->getLine()), // @phpstan-ignore class.notFound, class.notFound, class.notFound
default => $this->resolveLocationFromTrace($e)
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/Recorders/Servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function record(SharedBeat $event): void
'cpu' => $cpu,
'memory_used' => $memoryUsed,
'memory_total' => $memoryTotal,
'storage' => collect($this->config->get('pulse.recorders.'.self::class.'.directories')) // @phpstan-ignore argument.templateType argument.templateType
'storage' => collect($this->config->get('pulse.recorders.'.self::class.'.directories')) // @phpstan-ignore argument.templateType, argument.templateType
->map(fn (string $directory) => [
'directory' => $directory,
'total' => $total = intval(round(disk_total_space($directory) / 1024 / 1024)), // MB
Expand Down
16 changes: 8 additions & 8 deletions src/Storage/DatabaseStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,22 @@ public function store(Collection $items): void
}, ['count' => [], 'min' => [], 'max' => [], 'sum' => [], 'avg' => []])
);

$countChunks = $this->preaggregateCounts(collect($counts)) // @phpstan-ignore argument.templateType argument.templateType
$countChunks = $this->preaggregateCounts(collect($counts)) // @phpstan-ignore argument.templateType, argument.templateType
->chunk($this->config->get('pulse.storage.database.chunk'));

$minimumChunks = $this->preaggregateMinimums(collect($minimums)) // @phpstan-ignore argument.templateType argument.templateType
$minimumChunks = $this->preaggregateMinimums(collect($minimums)) // @phpstan-ignore argument.templateType, argument.templateType
->chunk($this->config->get('pulse.storage.database.chunk'));

$maximumChunks = $this->preaggregateMaximums(collect($maximums)) // @phpstan-ignore argument.templateType argument.templateType
$maximumChunks = $this->preaggregateMaximums(collect($maximums)) // @phpstan-ignore argument.templateType, argument.templateType
->chunk($this->config->get('pulse.storage.database.chunk'));

$sumChunks = $this->preaggregateSums(collect($sums)) // @phpstan-ignore argument.templateType argument.templateType
$sumChunks = $this->preaggregateSums(collect($sums)) // @phpstan-ignore argument.templateType, argument.templateType
->chunk($this->config->get('pulse.storage.database.chunk'));

$averageChunks = $this->preaggregateAverages(collect($averages)) // @phpstan-ignore argument.templateType argument.templateType
$averageChunks = $this->preaggregateAverages(collect($averages)) // @phpstan-ignore argument.templateType, argument.templateType
->chunk($this->config->get('pulse.storage.database.chunk'));

$valueChunks = $this
$valueChunks = $this // @phpstan-ignore argument.templateType
->collapseValues($values)
->when(
$this->requiresManualKeyHash(),
Expand Down Expand Up @@ -464,7 +464,7 @@ public function graph(array $types, string $aggregate, CarbonInterval $interval)

$structure = collect($types)->mapWithKeys(fn ($type) => [$type => $padding]);

return $this->connection()->table('pulse_aggregates') // @phpstan-ignore return.type
return $this->connection()->table('pulse_aggregates')
->select(['bucket', 'type', 'key', 'value'])
->whereIn('type', $types)
->where('aggregate', $aggregate)
Expand Down Expand Up @@ -725,7 +725,7 @@ public function aggregateTotal(
$tailStart = $windowStart;
$tailEnd = $oldestBucket - 1;

return $this->connection()->query()
return $this->connection()->query() // @phpstan-ignore return.type
->when(is_array($types), fn ($query) => $query->addSelect('type'))
->selectRaw(match ($aggregate) {
'count' => "sum({$this->wrap('count')})",
Expand Down
4 changes: 2 additions & 2 deletions src/Support/RedisAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ public function xadd(string $key, array $dictionary): string|Pipeline|PhpRedis|R
*/
public function xrange(string $key, string $start, string $end, ?int $count = null): array
{
return collect($this->handle([ // @phpstan-ignore return.type argument.templateType argument.templateType
return collect($this->handle([ // @phpstan-ignore return.type, argument.templateType, argument.templateType
'XRANGE',
$this->config->get('database.redis.options.prefix').$key,
$start,
$end,
...$count !== null ? ['COUNT', "$count"] : [],
]))->mapWithKeys(fn ($value, $key) => [
$value[0] => collect($value[1]) // @phpstan-ignore argument.templateType argument.templateType
$value[0] => collect($value[1]) // @phpstan-ignore argument.templateType, argument.templateType
->chunk(2)
->map->values()
->mapWithKeys(fn ($value, $key) => [$value[0] => $value[1]])
Expand Down