Skip to content

Commit

Permalink
chore(collector): Make CollectorFactory methods final using annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
zlodes committed Jul 26, 2023
1 parent 9f9ad1c commit a273452
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
<element value="@mixin"/>
<element value="@codeCoverageIgnore,@deprecated"/>
<element value="@template,@psalm-template,@psalm-type,@psalm-import-type" />
<element value="@internal,@psalm-internal,@psalm-immutable" />
<element value="@internal,@final,@psalm-internal,@psalm-immutable" />
<element value="@no-named-arguments" />
<element value="@inheritDoc"/>
<element value="@property\"/>
Expand Down
1 change: 0 additions & 1 deletion src/Collector/ByType/CounterCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

/**
* @internal Zlodes\PrometheusClient\Collector
*
* @final
*/
class CounterCollector
Expand Down
1 change: 0 additions & 1 deletion src/Collector/ByType/GaugeCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

/**
* @internal Zlodes\PrometheusClient\Collector
*
* @final
*/
class GaugeCollector
Expand Down
1 change: 0 additions & 1 deletion src/Collector/ByType/HistogramCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

/**
* @internal Zlodes\PrometheusClient\Collector
*
* @final
*/
class HistogramCollector
Expand Down
15 changes: 11 additions & 4 deletions src/Collector/CollectorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,24 @@
*/
class CollectorFactory
{
final public function __construct(
public function __construct(
private readonly Registry $registry,
private readonly Storage $storage,
private readonly LoggerInterface $logger,
) {
}

/**
* @final
*
* @param non-empty-string $counterName
*
* @return CounterCollector
*
* @throws MetricNotFoundException
* @throws MetricHasWrongTypeException
*/
final public function counter(string $counterName): CounterCollector
public function counter(string $counterName): CounterCollector
{
$counter = $this->registry->getCounter($counterName);

Expand All @@ -45,14 +47,16 @@ final public function counter(string $counterName): CounterCollector
}

/**
* @final
*
* @param non-empty-string $gaugeName
*
* @return GaugeCollector
*
* @throws MetricNotFoundException
* @throws MetricHasWrongTypeException
*/
final public function gauge(string $gaugeName): GaugeCollector
public function gauge(string $gaugeName): GaugeCollector
{
$gauge = $this->registry->getGauge($gaugeName);

Expand All @@ -63,7 +67,10 @@ final public function gauge(string $gaugeName): GaugeCollector
);
}

final public function histogram(string $histogramName): HistogramCollector
/**
* @final
*/
public function histogram(string $histogramName): HistogramCollector
{
$histogram = $this->registry->getHistogram($histogramName);

Expand Down

0 comments on commit a273452

Please sign in to comment.