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

PHP8 Issue Uncaught TypeError: round() #501

Closed
giovanni-sposito-edo opened this issue Jan 17, 2024 · 2 comments
Closed

PHP8 Issue Uncaught TypeError: round() #501

giovanni-sposito-edo opened this issue Jan 17, 2024 · 2 comments
Assignees
Labels

Comments

@giovanni-sposito-edo
Copy link

Bug report

  • phpmetrics v3.0.0rc4.
  • PHP 8.2.13

I'm getting this error

Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, null given in /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Violation/Package/StableDependenciesPrinciple.php:66
Stack trace:
#0 /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Violation/Package/StableDependenciesPrinciple.php(66): round(NULL, 3)
#1 /tmp/vendor/phpmetrics/phpmetrics/templates/html_report/violations.php(131): Hal\Violation\Package\StableDependenciesPrinciple->getDescription()
#2 /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Report/Html/Reporter.php(194): require('/tmp/vendor/php...')
#3 /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Report/Html/Reporter.php(156): Hal\Report\Html\Reporter->renderPage('/tmp/vendor/php...', 'build/quality/p...', Object(Hal\Metric\Consolidated), Array)
#4 /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Report/Html/Reporter.php(111): Hal\Report\Html\Reporter->renderHtmlPages('build/quality/p...', Object(Hal\Metric\Consolidated), Array)
#5 /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Application/ReporterHandler.php(32): Hal\Report\Html\Reporter->generate(Object(Hal\Metric\Metrics))
#6 [internal function]: Hal\Application\ReporterHandler::Hal\Application\{closure}(Object(Hal\Report\Html\Reporter))
#7 /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Application/ReporterHandler.php(31): array_map(Object(Closure), Array)
#8 /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Application/PhpMetrics.php(33): Hal\Application\ReporterHandler->report(Object(Hal\Metric\Metrics))
#9 /tmp/vendor/phpmetrics/phpmetrics/bin/phpmetrics(36): Hal\Application\PhpMetrics->run()
#10 /tmp/vendor/bin/phpmetrics(119): include('/tmp/vendor/php...')
#11 {main}
  thrown in /tmp/vendor/phpmetrics/phpmetrics/src/Hal/Violation/Package/StableDependenciesPrinciple.php on line 66

changing src/Hal/Violation/Package/StableDependenciesPrinciple.php:66
to
$instability = $this->metric->getInstability()??0

fixes the issue, but i'm not sure it's a proper fix...

@niconoe-
Copy link
Contributor

New version v3.0.0rc5 fixes this. Thanks for notice it!

@giovanni-sposito-edo
Copy link
Author

thank you so much for fixing it so quickly!

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

No branches or pull requests

2 participants