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

PHP 8.4 deprecation: explicit nullable type must be used #166

Closed
lianatech-matias-ylipelto opened this issue Nov 29, 2024 · 0 comments · Fixed by #168
Closed

PHP 8.4 deprecation: explicit nullable type must be used #166

lianatech-matias-ylipelto opened this issue Nov 29, 2024 · 0 comments · Fixed by #168

Comments

@lianatech-matias-ylipelto
Copy link
Contributor

Description

PHP 8.4 has deprecated implicitly marking parameters as nullable.

vendor/promphp/prometheus_client_php/src/Prometheus/RegistryInterface.php:94 Prometheus\RegistryInterface::registerHistogram(): Implicitly marking parameter $buckets as nullable is deprecated, the explicit nullable type must be used instead

These deprecation warnings could be fixed like this I think:

    public function registerHistogram(
        string $namespace,
        string $name,
        string $help,
        array $labels = [],
-       array $buckets = null
+       ?array $buckets = null
    ): Histogram;

Support for nullable types has been around since PHP 7.1.

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant