Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use explicit nullable type parameters #168

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src/Prometheus/RegistryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -96,7 +96,7 @@ public function registerHistogram(
string $name,
string $help,
array $labels = [],
array $buckets = null
?array $buckets = null
): Histogram;

/**
Expand All @@ -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
Expand All @@ -137,7 +143,7 @@ public function registerSummary(
string $help,
array $labels = [],
int $maxAgeSeconds = 86400,
array $quantiles = null
?array $quantiles = null
): Summary;

/**
Expand All @@ -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;
}
Loading