Skip to content

Commit

Permalink
Fixes PHP 8.2 deprecation warnings when calling round() with null f…
Browse files Browse the repository at this point in the history
…irst parameter.
  • Loading branch information
Pierre-Lannoy committed Sep 14, 2023
1 parent b054195 commit 9128ce7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to **Device Detector** are documented in this *changelog*.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and **Device Detector** adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.6.0] - Not Yet Released

### Fixed
- With PHP 8.2, in some edge cases, deprecation warnings may be triggered when viewing analytics.

## [3.5.0] - 2023-07-12

### Added
Expand Down
18 changes: 9 additions & 9 deletions includes/features/class-analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ public static function get_status_kpi_collection( $args = [] ) {
'ratio' => null,
'variation' => [
'raw' => round( $data['kpi-index-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-index-' . $query], 2 ),
'percent' => round( $data['kpi-index-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-index-' . $query] * 10, 2 ),
],
'value' => [
Expand All @@ -1058,7 +1058,7 @@ public static function get_status_kpi_collection( $args = [] ) {
'ratio' => null,
'variation' => [
'raw' => round( $data['kpi-index-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-index-' . $query], 2 ),
'percent' => round( $data['kpi-index-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-index-' . $query] * 10, 2 ),
],
'value' => [
Expand All @@ -1077,7 +1077,7 @@ public static function get_status_kpi_collection( $args = [] ) {
'ratio' => null,
'variation' => [
'raw' => round( $data['kpi-index-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-index-' . $query], 2 ),
'percent' => round( $data['kpi-index-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-index-' . $query] * 10, 2 ),
],
'value' => [
Expand All @@ -1095,12 +1095,12 @@ public static function get_status_kpi_collection( $args = [] ) {
'dimension' => 'none',
'ratio' => [
'raw' => round( $data['kpi-main-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-main-' . $query], 2 ),
'percent' => round( $data['kpi-main-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-main-' . $query] * 10, 2 ),
],
'variation' => [
'raw' => round( $data['kpi-index-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-index-' . $query], 2 ),
'percent' => round( $data['kpi-index-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-index-' . $query] * 10, 2 ),
],
'value' => [
Expand All @@ -1118,12 +1118,12 @@ public static function get_status_kpi_collection( $args = [] ) {
'dimension' => 'none',
'ratio' => [
'raw' => round( $data['kpi-main-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-main-' . $query], 2 ),
'percent' => round( $data['kpi-main-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-main-' . $query] * 10, 2 ),
],
'variation' => [
'raw' => round( $data['kpi-index-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-index-' . $query], 2 ),
'percent' => round( $data['kpi-index-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-index-' . $query] * 10, 2 ),
],
'value' => [
Expand All @@ -1141,12 +1141,12 @@ public static function get_status_kpi_collection( $args = [] ) {
'dimension' => 'none',
'ratio' => [
'raw' => round( $data['kpi-main-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-main-' . $query], 2 ),
'percent' => round( $data['kpi-main-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-main-' . $query] * 10, 2 ),
],
'variation' => [
'raw' => round( $data['kpi-index-' . $query] / 100, 6 ),
'percent' => round( $data['kpi-index-' . $query], 2 ),
'percent' => round( $data['kpi-index-' . $query] ?? 0, 2 ),
'permille' => round( $data['kpi-index-' . $query] * 10, 2 ),
],
'value' => [
Expand Down

0 comments on commit 9128ce7

Please sign in to comment.