Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
romanzipp authored and github-actions[bot] committed Feb 27, 2024
1 parent c777a59 commit 01f6460
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Controllers/Payloads/Metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class Metric

public string $format;

public function __construct(string $title, float $value = 0, int $previousValue = null, string $format = '%d')
public function __construct(string $title, float $value = 0, ?int $previousValue = null, string $format = '%d')
{
$this->title = $title;
$this->value = $value;
Expand Down
18 changes: 9 additions & 9 deletions src/Models/Monitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
* @property string $job_id
* @property string|null $name
* @property string|null $queue
* @property \Illuminate\Support\Carbon|null $queued_at
* @property \Illuminate\Support\Carbon|null $started_at
* @property Carbon|null $queued_at
* @property Carbon|null $started_at
* @property string|null $started_at_exact
* @property \Illuminate\Support\Carbon|null $finished_at
* @property Carbon|null $finished_at
* @property string|null $finished_at_exact
* @property int $status
* @property int $attempt
Expand Down Expand Up @@ -145,16 +145,16 @@ public function getFinishedAtExact(): ?Carbon
/**
* Get the estimated remaining seconds. This requires a job progress to be set.
*
* @param \Illuminate\Support\Carbon|null $now
* @param Carbon|null $now
*
* @return float
*/
public function getRemainingSeconds(Carbon $now = null): float
public function getRemainingSeconds(?Carbon $now = null): float
{
return $this->getRemainingInterval($now)->totalSeconds;
}

public function getRemainingInterval(Carbon $now = null): CarbonInterval
public function getRemainingInterval(?Carbon $now = null): CarbonInterval
{
if (null === $now) {
$now = Carbon::now();
Expand All @@ -176,16 +176,16 @@ public function getRemainingInterval(Carbon $now = null): CarbonInterval
/**
* Get the currently elapsed seconds.
*
* @param \Illuminate\Support\Carbon|null $end
* @param Carbon|null $end
*
* @return float
*/
public function getElapsedSeconds(Carbon $end = null): float
public function getElapsedSeconds(?Carbon $end = null): float
{
return $this->getElapsedInterval($end)->seconds;
}

public function getElapsedInterval(Carbon $end = null): CarbonInterval
public function getElapsedInterval(?Carbon $end = null): CarbonInterval
{
if (null === $end) {
$end = $this->getFinishedAtExact() ?? $this->finished_at ?? Carbon::now();
Expand Down
6 changes: 3 additions & 3 deletions src/Services/QueueMonitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ protected static function jobStarted(JobContract $job): void
*
* @return void
*/
protected static function jobFinished(JobContract $job, int $status, \Throwable $exception = null): void
protected static function jobFinished(JobContract $job, int $status, ?\Throwable $exception = null): void
{
if ( ! self::shouldBeMonitored($job)) {
return;
}

$model = self::getModel();

/** @var \romanzipp\QueueMonitor\Models\Contracts\MonitorContract|null $monitor */
/** @var MonitorContract|null $monitor */
$monitor = $model::query()
->where('job_id', self::getJobId($job))
->where('attempt', $job->attempts())
Expand Down Expand Up @@ -249,7 +249,7 @@ protected static function jobFinished(JobContract $job, int $status, \Throwable
/**
* Determine weather the Job should be monitored, default true.
*
* @param object|\Illuminate\Contracts\Queue\Job $job
* @param object|JobContract $job
*
* @return bool
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/MonitorTimeCalculationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testElapsedSecondsInterval()
);
}

private function createMonitor(Carbon $startedAt, int $progress = null): Monitor
private function createMonitor(Carbon $startedAt, ?int $progress = null): Monitor
{
/** @var Monitor $monitor */
$monitor = Monitor::query()->create([
Expand Down

0 comments on commit 01f6460

Please sign in to comment.