From 6d7328edbcaa1094bf06204f90d7e48a34440f1c Mon Sep 17 00:00:00 2001 From: Matias Ylipelto <129368437+lianatech-matias-ylipelto@users.noreply.github.com> Date: Mon, 2 Dec 2024 14:05:28 +0200 Subject: [PATCH] Use explicit nullable type parameters (#168) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matias Ylipelto <129368437+lianatech-matias-ylipelto@users.noreply.github.com> Co-authored-by: Lukas Kämmerling --- src/Prometheus/RegistryInterface.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Prometheus/RegistryInterface.php b/src/Prometheus/RegistryInterface.php index a66ae5e6..3bbc3b74 100644 --- a/src/Prometheus/RegistryInterface.php +++ b/src/Prometheus/RegistryInterface.php @@ -86,7 +86,7 @@ public function getOrRegisterCounter(string $namespace, string $name, string $he * @param string $name e.g. duration_seconds * @param string $help e.g. A histogram of the duration in seconds. * @param string[] $labels e.g. ['controller', 'action'] - * @param float[] $buckets e.g. [100, 200, 300] + * @param float[]|null $buckets e.g. [100, 200, 300] * * @return Histogram * @throws MetricsRegistrationException @@ -96,7 +96,7 @@ public function registerHistogram( string $name, string $help, array $labels = [], - array $buckets = null + ?array $buckets = null ): Histogram; /** @@ -113,12 +113,18 @@ public function getHistogram(string $namespace, string $name): Histogram; * @param string $name e.g. duration_seconds * @param string $help e.g. A histogram of the duration in seconds. * @param string[] $labels e.g. ['controller', 'action'] - * @param float[] $buckets e.g. [100, 200, 300] + * @param float[]|null $buckets e.g. [100, 200, 300] * * @return Histogram * @throws MetricsRegistrationException */ - public function getOrRegisterHistogram(string $namespace, string $name, string $help, array $labels = [], array $buckets = null): Histogram; + public function getOrRegisterHistogram( + string $namespace, + string $name, + string $help, + array $labels = [], + ?array $buckets = null + ): Histogram; /** * @param string $namespace e.g. cms @@ -137,7 +143,7 @@ public function registerSummary( string $help, array $labels = [], int $maxAgeSeconds = 86400, - array $quantiles = null + ?array $quantiles = null ): Summary; /** @@ -160,5 +166,12 @@ public function getSummary(string $namespace, string $name): Summary; * @return Summary * @throws MetricsRegistrationException */ - public function getOrRegisterSummary(string $namespace, string $name, string $help, array $labels = [], int $maxAgeSeconds = 86400, array $quantiles = null): Summary; + public function getOrRegisterSummary( + string $namespace, + string $name, + string $help, + array $labels = [], + int $maxAgeSeconds = 86400, + ?array $quantiles = null + ): Summary; }