Implicit conversion from float to int

Created on 13 March 2024, 3 months ago

Problem/Motivation

When rendering the block plugin, I get the deprecation warning: "Implicit conversion from float 24.821526716109474 to int loses precision in Drupal\Core\Datetime\DateFormatter->formatInterval() (line 154 of core/lib/Drupal/Core/Datetime/DateFormatter.php)."

This appears to be due to the DateIntervalStatistic trait calling formatInterval() on a floatval, which implicitly gets rounded.

Steps to reproduce

Insert the Queue statistics list block on a page and render it, ensure some items are in queue.

Proposed resolution

Explicitly round the floatval before formatting with formatInterval().

Remaining tasks

Review patch.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡°Denmark achton Denmark

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024