Closed
Description
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...