diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index d03900a..4e8a6bb 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -5,6 +5,9 @@ $config = new class extends Amp\CodeStyle\Config { { return array_merge(parent::getRules(), [ 'void_return' => true, + 'phpdoc_to_param_type' => true, + 'phpdoc_to_return_type' => true, + 'phpdoc_to_property_type' => true, ]); } }; diff --git a/lib/BetterCollectorRegistry.php b/lib/BetterCollectorRegistry.php index ae1a88d..742e58f 100644 --- a/lib/BetterCollectorRegistry.php +++ b/lib/BetterCollectorRegistry.php @@ -87,7 +87,7 @@ final class BetterCollectorRegistry * * @throws MetricsRegistrationException */ - public function registerGauge(string $namespace, string $name, string $help, $labels = []): BetterGauge + public function registerGauge(string $namespace, string $name, string $help, array $labels = []): BetterGauge { $metricIdentifier = "$namespace:$name"; if (isset($this->gauges[$metricIdentifier])) { @@ -123,7 +123,7 @@ final class BetterCollectorRegistry * * @throws MetricsRegistrationException */ - public function getOrRegisterGauge(string $namespace, string $name, string $help, $labels = []): BetterGauge + public function getOrRegisterGauge(string $namespace, string $name, string $help, array $labels = []): BetterGauge { try { $gauge = $this->getGauge($namespace, $name); @@ -141,7 +141,7 @@ final class BetterCollectorRegistry * * @throws MetricsRegistrationException */ - public function registerCounter(string $namespace, string $name, string $help, $labels = []): BetterCounter + public function registerCounter(string $namespace, string $name, string $help, array $labels = []): BetterCounter { $metricIdentifier = "$namespace:$name"; if (isset($this->counters[$metricIdentifier])) { @@ -178,7 +178,7 @@ final class BetterCollectorRegistry * * @throws MetricsRegistrationException */ - public function getOrRegisterCounter(string $namespace, string $name, string $help, $labels = []): BetterCounter + public function getOrRegisterCounter(string $namespace, string $name, string $help, array $labels = []): BetterCounter { try { $counter = $this->getCounter($namespace, $name); diff --git a/lib/BetterGauge.php b/lib/BetterGauge.php index 9a13f12..9792929 100644 --- a/lib/BetterGauge.php +++ b/lib/BetterGauge.php @@ -36,7 +36,7 @@ final class BetterGauge extends BetterCollector $labels = $this->labels + $labels; $this->storageAdapter->updateGauge( [ - 'name' => $this->name, + 'name' => $this->metricName, 'help' => $this->help, 'type' => self::TYPE, 'labelNames' => \array_keys($labels), diff --git a/lib/BetterHistogram.php b/lib/BetterHistogram.php index 25b0a8b..18aa286 100644 --- a/lib/BetterHistogram.php +++ b/lib/BetterHistogram.php @@ -79,7 +79,7 @@ final class BetterHistogram extends BetterCollector } /** - * @param double $value e.g. 123 + * @param double|int $value e.g. 123 * @param array $labels e.g. ['status' => '201', 'opcode' => 'SOME_OP'] */ public function observe(float|int $value, array $labels = []): void diff --git a/lib/BetterSummary.php b/lib/BetterSummary.php index 216f011..3ba0b9a 100644 --- a/lib/BetterSummary.php +++ b/lib/BetterSummary.php @@ -93,10 +93,10 @@ final class BetterSummary extends BetterCollector } /** - * @param double $value e.g. 123 + * @param double|int $value e.g. 123 * @param array $labels e.g. ['status' => '404', 'opcode' => 'SOME_OP'] */ - public function observe(float $value, array $labels = []): void + public function observe(float|int $value, array $labels = []): void { self::assertValidLabels($labels); $labels = $this->labels + $labels;