Skip to content

Commit 6d7328e

Browse files
Use explicit nullable type parameters (#168)
Signed-off-by: Matias Ylipelto <129368437+lianatech-matias-ylipelto@users.noreply.github.com> Co-authored-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
1 parent 12af805 commit 6d7328e

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/Prometheus/RegistryInterface.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getOrRegisterCounter(string $namespace, string $name, string $he
8686
* @param string $name e.g. duration_seconds
8787
* @param string $help e.g. A histogram of the duration in seconds.
8888
* @param string[] $labels e.g. ['controller', 'action']
89-
* @param float[] $buckets e.g. [100, 200, 300]
89+
* @param float[]|null $buckets e.g. [100, 200, 300]
9090
*
9191
* @return Histogram
9292
* @throws MetricsRegistrationException
@@ -96,7 +96,7 @@ public function registerHistogram(
9696
string $name,
9797
string $help,
9898
array $labels = [],
99-
array $buckets = null
99+
?array $buckets = null
100100
): Histogram;
101101

102102
/**
@@ -113,12 +113,18 @@ public function getHistogram(string $namespace, string $name): Histogram;
113113
* @param string $name e.g. duration_seconds
114114
* @param string $help e.g. A histogram of the duration in seconds.
115115
* @param string[] $labels e.g. ['controller', 'action']
116-
* @param float[] $buckets e.g. [100, 200, 300]
116+
* @param float[]|null $buckets e.g. [100, 200, 300]
117117
*
118118
* @return Histogram
119119
* @throws MetricsRegistrationException
120120
*/
121-
public function getOrRegisterHistogram(string $namespace, string $name, string $help, array $labels = [], array $buckets = null): Histogram;
121+
public function getOrRegisterHistogram(
122+
string $namespace,
123+
string $name,
124+
string $help,
125+
array $labels = [],
126+
?array $buckets = null
127+
): Histogram;
122128

123129
/**
124130
* @param string $namespace e.g. cms
@@ -137,7 +143,7 @@ public function registerSummary(
137143
string $help,
138144
array $labels = [],
139145
int $maxAgeSeconds = 86400,
140-
array $quantiles = null
146+
?array $quantiles = null
141147
): Summary;
142148

143149
/**
@@ -160,5 +166,12 @@ public function getSummary(string $namespace, string $name): Summary;
160166
* @return Summary
161167
* @throws MetricsRegistrationException
162168
*/
163-
public function getOrRegisterSummary(string $namespace, string $name, string $help, array $labels = [], int $maxAgeSeconds = 86400, array $quantiles = null): Summary;
169+
public function getOrRegisterSummary(
170+
string $namespace,
171+
string $name,
172+
string $help,
173+
array $labels = [],
174+
int $maxAgeSeconds = 86400,
175+
?array $quantiles = null
176+
): Summary;
164177
}

0 commit comments

Comments
 (0)