Skip to content

Commit c1c3405

Browse files
committed
style: php8.2 readonly
1 parent cc1663a commit c1c3405

File tree

12 files changed

+42
-42
lines changed

12 files changed

+42
-42
lines changed

src/Exporter/FetcherExporter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
use Zlodes\PrometheusClient\Fetcher\Fetcher;
88

9-
final class FetcherExporter implements Exporter
9+
final readonly class FetcherExporter implements Exporter
1010
{
1111
public function __construct(
12-
private readonly Fetcher $fetcher,
12+
private Fetcher $fetcher,
1313
) {
1414
}
1515

src/Fetcher/DTO/FetchedMetric.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
use Zlodes\PrometheusClient\Metric\Metric;
88
use Zlodes\PrometheusClient\Storage\DTO\MetricValue;
99

10-
final class FetchedMetric
10+
final readonly class FetchedMetric
1111
{
1212
/**
1313
* @param list<MetricValue> $values
1414
*/
1515
public function __construct(
16-
public readonly Metric $metric,
17-
public readonly array $values,
16+
public Metric $metric,
17+
public array $values,
1818
) {
1919
}
2020
}

src/Fetcher/StoredMetricsFetcher.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
use Zlodes\PrometheusClient\Storage\DTO\SummaryMetricValue;
2323
use Zlodes\PrometheusClient\Summary\QuantileCalculator;
2424

25-
final class StoredMetricsFetcher implements Fetcher
25+
final readonly class StoredMetricsFetcher implements Fetcher
2626
{
2727
public function __construct(
28-
private readonly Registry $registry,
29-
private readonly CounterStorage $counterStorage,
30-
private readonly GaugeStorage $gaugeStorage,
31-
private readonly HistogramStorage $histogramStorage,
32-
private readonly SummaryStorage $summaryStorage,
28+
private Registry $registry,
29+
private CounterStorage $counterStorage,
30+
private GaugeStorage $gaugeStorage,
31+
private HistogramStorage $histogramStorage,
32+
private SummaryStorage $summaryStorage,
3333
) {
3434
}
3535

src/StopWatch/HRTimeStopWatch.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
/**
1010
* @see https://www.php.net/manual/en/class.hrtime-stopwatch.php
1111
*/
12-
final class HRTimeStopWatch implements StopWatch
12+
final readonly class HRTimeStopWatch implements StopWatch
1313
{
14-
private readonly float $startedAt;
14+
private float $startedAt;
1515

16-
public function __construct(private readonly Closure $onStop)
16+
public function __construct(private Closure $onStop)
1717
{
1818
$this->startedAt = hrtime(true);
1919
}

src/Storage/Commands/IncrementCounter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
use Zlodes\PrometheusClient\Storage\DTO\MetricNameWithLabels;
88

9-
final class IncrementCounter
9+
final readonly class IncrementCounter
1010
{
1111
public function __construct(
12-
public readonly MetricNameWithLabels $metricNameWithLabels,
13-
public readonly int|float $value = 1,
12+
public MetricNameWithLabels $metricNameWithLabels,
13+
public int|float $value = 1,
1414
) {
1515
}
1616
}

src/Storage/Commands/UpdateGauge.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
use Zlodes\PrometheusClient\Storage\DTO\MetricNameWithLabels;
88

9-
final class UpdateGauge
9+
final readonly class UpdateGauge
1010
{
1111
public function __construct(
12-
public readonly MetricNameWithLabels $metricNameWithLabels,
13-
public readonly int|float $value,
12+
public MetricNameWithLabels $metricNameWithLabels,
13+
public int|float $value,
1414
) {
1515
}
1616
}

src/Storage/Commands/UpdateHistogram.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
use Zlodes\PrometheusClient\Storage\DTO\MetricNameWithLabels;
88

9-
final class UpdateHistogram
9+
final readonly class UpdateHistogram
1010
{
1111
/**
1212
* @param non-empty-list<float> $buckets
1313
*/
1414
public function __construct(
15-
public readonly MetricNameWithLabels $metricNameWithLabels,
16-
public readonly array $buckets,
17-
public readonly int|float $value,
15+
public MetricNameWithLabels $metricNameWithLabels,
16+
public array $buckets,
17+
public int|float $value,
1818
) {
1919
}
2020
}

src/Storage/Commands/UpdateSummary.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
use Zlodes\PrometheusClient\Storage\DTO\MetricNameWithLabels;
88

9-
final class UpdateSummary
9+
final readonly class UpdateSummary
1010
{
1111
public function __construct(
12-
public readonly MetricNameWithLabels $metricNameWithLabels,
13-
public readonly int|float $value,
14-
public readonly int $maxItems = 1_000_000,
12+
public MetricNameWithLabels $metricNameWithLabels,
13+
public int|float $value,
14+
public int $maxItems = 1_000_000,
1515
) {
1616
}
1717
}

src/Storage/DTO/HistogramMetricValue.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
namespace Zlodes\PrometheusClient\Storage\DTO;
66

7-
final class HistogramMetricValue
7+
final readonly class HistogramMetricValue
88
{
99
/**
1010
* @param non-empty-array<non-empty-string|positive-int, int|float> $buckets
1111
*/
1212
public function __construct(
13-
public readonly MetricNameWithLabels $metricNameWithLabels,
14-
public readonly array $buckets,
15-
public readonly float $sum,
16-
public readonly int $count,
13+
public MetricNameWithLabels $metricNameWithLabels,
14+
public array $buckets,
15+
public float $sum,
16+
public int $count,
1717
) {
1818
}
1919
}

src/Storage/DTO/MetricNameWithLabels.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
use Webmozart\Assert\Assert;
88

9-
final class MetricNameWithLabels
9+
final readonly class MetricNameWithLabels
1010
{
1111
/**
1212
* @param non-empty-string $metricName
1313
* @param array<non-empty-string, non-empty-string> $labels
1414
*/
1515
public function __construct(
16-
public readonly string $metricName,
17-
public readonly array $labels = [],
16+
public string $metricName,
17+
public array $labels = [],
1818
) {
1919
Assert::allString(array_keys($labels));
2020
Assert::allStringNotEmpty($labels);

0 commit comments

Comments
 (0)